Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Preserving aspect ratio #33

Open
imrek opened this issue May 29, 2018 · 1 comment
Open

Preserving aspect ratio #33

imrek opened this issue May 29, 2018 · 1 comment

Comments

@imrek
Copy link

imrek commented May 29, 2018

I have multiple issues, but all center around preserving the aspect ratio when I convert an asciicast file to an .svg.

I have been experimenting with the flags but I'm not sure what solves this problem.

I use gnome-terminal on Ubuntu 16.04. I would like to get output where the width : height ratio is 16 : 9. I've found that the closest cols/rows setting to this is 94 cols and 28 rows given the default font and font-size in gnome-terminal, so accordingly I add --width=94 and --height=28 to the command.

The full command I'm using is:

svg-term --in=htop --out=htop.svg --term=terminal --profile=profile4svgterm.dconf --no-optimize --width=94 --height=28

Unfortunately, the .svg output is rendered with a different aspect ratio.

Here's gnome-terminal running asciinema play htop:
screenshot from 2018-05-29 14-39-33

And then the .svg output as displayed by chromium-browser:

screenshot from 2018-05-29 14-36-11

It's probably hard to perceive at first glance, but the .svg output slightly taller and therefore has a different aspect ratio. Also, the characters on the right hand side are slightly cut off, but that probably also happens because of the different ratio.

As I understand, the terminal profile I specify is ignored by svg-term, or I am not specifying it correctly.
As of Ubuntu 16.04 the terminal profile is part of dconf, ie. it's not a stand-alone file somewhere in the home directory of the user, but part of a database and can be exported. Here's the file (profile4svgterm.dconf) I get after exporting from dconf.

[/]
foreground-color='rgb(0,255,0)'
visible-name='profile4svgterm'
default-size-columns=94
default-size-rows=28
use-system-font=false
use-theme-colors=false
font='Monospace 12'
use-theme-transparency=false
background-color='rgb(0,0,0)'

I am not sure svg-term understands this file and would like to know what format works the best.

Another, unrelated issue I have noticed that sometimes the .svg output is a file with 0 bytes and therefore the command has to be repeated to get a non-empty output.

Here's a gist with the input and output files.


UPDATE: After doing some troubleshooting, I've found that If I specify a non existing file for --profile, svg-term does not complain about the invalid path/file.

@marionebl
Copy link
Owner

marionebl commented Aug 11, 2018

Sorry for taking so long to respond to this.

I suspect the issues you see might at least partially be caused by svg-term (via. term-schemes) not parsing your --profile correctly.

The expected behavior would be for svg-term-cli to fail loudly (being unable to parse dconf files as the xml expected for --term=terminal), which is not what happens for you if I understand correctly? (Something with the terminal format detection appears to be off...)

svg-term-cli expects you to provide a --terminal flag that indicates the profile format to parse:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants