ft2font: Add internal API for accessing font variations#31434
Open
QuLogic wants to merge 1 commit intomatplotlib:text-overhaulfrom
Open
ft2font: Add internal API for accessing font variations#31434QuLogic wants to merge 1 commit intomatplotlib:text-overhaulfrom
QuLogic wants to merge 1 commit intomatplotlib:text-overhaulfrom
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR summary
This is internal API for querying font variations and setting them. FreeType sometimes calls them MM (multiple master) vars or variation axes, but I tried to stick to variations/variation axis. For the named styles, FreeType sometimes calls that a named style or a named instance, and I tried to use named style everywhere.
Font variations essentially allow fonts to have multiple styles in one by varying some parameter along an "Axis". For example, one font can contain all weights with a Weight axis ranging from Thin to Extra Bold, or an upright and italic font with a Slant axis for the angle. Some fonts may contain named styles which group some specific settings together under a a name (e.g., Bold may be Weight=700 or whatever the designer decides.)
Current internal API additions are:
FT2Font.get_variation_descriptorwhich returns a list of the variation axes and a list of the named styles.FT2Font.get_default_variation_stylewhich returns the index of the default name style (in the above list.)FT2Font.get_variationswhich returns the float values for each axis (in the order of the above list.)FT2Font.set_variationswhich allows setting the float values for each axis as a list, or selecting a named style by index.This does not contain any public API; for that there are some questions that we might need to think about:
Text.set_fontvariationsand/orFontProperties.set_variations?I do not expect this to be ready for 3.11 until we discuss some of these options.
AI Disclosure
None
PR checklist