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

[FEATURE REQUEST] Lookup font in text render based on family and style name #4502

Open
peterhorvath111 opened this issue Oct 22, 2024 · 1 comment

Comments

@peterhorvath111
Copy link

Currently, fonts are identified by the name of the file that defines the font. In Arnold we extended this logic to be able to find fonts based on the font family and style name. This makes it easier for end users to select fonts. For instance "Arial Bold" is defined by arialbd.ttf on Windows. Specifying arialbd is not that obvious and also file names could differ based on the platform.

If you find this useful, we can port our code back here.

I'd also like to point out that it's not that obvious from the current documentation that fontname supposed to be the file name and not the family name.

fontsize/fontname – Size and name of the font. If the name is not a full pathname to a font file, it will search for a matching font, defaulting to some reasonable system font if not supplied at all), and with a nominal height of fontsize (in pixels).

Specially because some examples suggest the family name should work, like this:

ImageBufAlgo::render_text(A, x, y, "Centered", 48, "Courier New");

Not sure about other platforms, but for instance on Windows this does not work currently, because "Courier New" is defined by cour.ttf.

@peterhorvath111
Copy link
Author

Created PR #4509 with the suggested changes.

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