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

Support typographic features #5

Open
jminer opened this issue Jun 29, 2022 · 0 comments
Open

Support typographic features #5

jminer opened this issue Jun 29, 2022 · 0 comments

Comments

@jminer
Copy link
Owner

jminer commented Jun 29, 2022

It should be possible to turn on typographic features in a font.

For DirectWrite, the GetGlyph() function takes an array of DWRITE_FONT_FEATUREs.

For Core Text, it looks like you have to create another CTFont with the features enabled:

https://stackoverflow.com/questions/59464935/uifont-how-to-use-stylistic-alternate-character

I could probably do the same, and have the enabled features in the Font struct. But I think the DirectWrite API is better. I could easily implement the Core Text API using DirectWrite, but I couldn't implement the DirectWrite API using Core Text as easily, so I think the DirectWrite API is better. Pango's API seems closer to DirectWrite's. You can apply a font features attr to an item returned from pango_itemize() before passing it to pango_shape(). It even gives font features as an example:

https://docs.gtk.org/Pango/method.Item.apply_attrs.html

Perhaps it would be best to have the TextAnalyzer::get_glyphs_and_positions() method take a Vec<FeatureRange> or something. Not sure.

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