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

YAD font selection output for some fonts is confusing #272

Open
Sadi58 opened this issue Jul 17, 2024 · 0 comments
Open

YAD font selection output for some fonts is confusing #272

Sadi58 opened this issue Jul 17, 2024 · 0 comments

Comments

@Sadi58
Copy link

Sadi58 commented Jul 17, 2024

I use a YAD form in a ZSH shell script which includes --field="Font Name:":FN among others.
This outputs the font name and size selected, and works mostly as expected.
However, there are some exceptions where YAD seems to get the font name wrong (or at least “incompatible”).
For instance, when the user selects “DejaVu Sans Condensed Bold Oblique” from the list displayed by YAD, its output is “DejaVu Sans Bold Oblique Semi-Condensed”.
This creates problems in the rest of the script where a CSS style, including “font-family”, “font-stretch”, “font-weight” and “font-style”, is created using this output.
The method used for this purpose is based on ImageMagick, in particular the command identify -list font | grep -E '^\s*Font: .*$' | sed -e 's/^\s*Font: \s*//g' -e 's/-Regular//g' | sort -u which lists all available fonts with such properties.
For instance, the section for this font is the following:

  Font: DejaVu-Sans-Condensed-Bold-Oblique
    family: DejaVu Sans
    style: Oblique
    stretch: SemiCondensed
    weight: 700
    glyphs: /usr/share/fonts/truetype/dejavu/DejaVuSansCondensed-BoldOblique.ttf

Replacing spaces with hyphens in YAD font name output, and searching it in this list easily gives the values for the CSS style, but some exceptions to the rule as in this example create problems.
Perhaps a workaround can be found by adding some extra commands for such exceptional deviations, but it will require going through a very long list of fonts, and getting their names through YAD (How this can be done without selecting each and every one of hundreds of fonts in that list), comparing this list with ImageMagick’s list, and then figuring out a solution to address such deviations.
But I think the real solution would be to get YAD output font names as seen in the list displayed by itself.

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

No branches or pull requests

1 participant