-
Notifications
You must be signed in to change notification settings - Fork 612
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
Comments
5 tasks
Created PR #4509 with the suggested changes. |
5 tasks
lgritz
pushed a commit
that referenced
this issue
Oct 29, 2024
Fixes #4502. This PR lets you specify fonts (for `IBA::render_text()` or `oiiotool --text`) by family and style name, rather than only by filename of the font file. The implementation is to add `init_font_families()` function, that iterates over the available font files, reads family and style name via the freetype API and caches them. The function is called from `resolve_font()` on demand. Added a new test to the oiiotool-text folder, that loads a font by the name "Droid Serif Bold". --------- Signed-off-by: peter.horvath <[email protected]>
lgritz
pushed a commit
to lgritz/OpenImageIO
that referenced
this issue
Oct 29, 2024
…emySoftwareFoundation#4509) Fixes AcademySoftwareFoundation#4502. This PR lets you specify fonts (for `IBA::render_text()` or `oiiotool --text`) by family and style name, rather than only by filename of the font file. The implementation is to add `init_font_families()` function, that iterates over the available font files, reads family and style name via the freetype API and caches them. The function is called from `resolve_font()` on demand. Added a new test to the oiiotool-text folder, that loads a font by the name "Droid Serif Bold". --------- Signed-off-by: peter.horvath <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Specially because some examples suggest the family name should work, like this:
Not sure about other platforms, but for instance on Windows this does not work currently, because "Courier New" is defined by
cour.ttf
.The text was updated successfully, but these errors were encountered: