-
Notifications
You must be signed in to change notification settings - Fork 43
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
Decompose scaled or rotated components #399
Decompose scaled or rotated components #399
Conversation
Which ones? :O |
2eee156
to
8a00c37
Compare
Shouldn't this filter class live in its own separate module? I think that's what is expectated for the getFilterClass function used by loadFilters to load the filters from the lib.plist: ufo2ft/Lib/ufo2ft/filters/__init__.py Lines 14 to 26 in e1c08f6
|
I believe Denis is referring to those transformations (like flipping horizontally/vertically) that reverse the component's contour direction, and thus may create white gaps if such transformed components overlap with other components. Am I right? There's code in ufo2ft.util.deepCopyContours that checks for those transforms (a negative determinant is the trigger): Lines 192 to 197 in e1c08f6
Perhaps the issue is that by default we only decomposing glyphs that are "mixed" with both contour and components; whereas Denis would like to trigger this for such problematic composite glyphs as well. There's also a related fontmake issue: googlefonts/fontmake#253 (comment) |
I don't think there's anything wrong with merely having a component scaled or rotated, I've never come across an implementation that doesn't render such components properly. It's when they overlap other components and have transforms that flip their direction that you get rendering issues (as exemplified in the linked fontmake issue) |
Any implementation of the TrueType implementation that doesn’t understand the component flags SCALED_COMPONENT_OFFSET or UNSCALED_COMPONENT_OFFSET for example, or any implementation that expects the component flag WE_HAVE_A_SCALE to apply scaling. We probably should set more flags from https://docs.microsoft.com/en-us/typography/opentype/spec/glyf#composite-glyph-description. |
8a00c37
to
740279b
Compare
I moved the filter to its own module. http://pfaedit.sourceforge.net/Composites/ (pfaedit is the super old name of Fontforge) also documents the issue about how Apple’s and Microsoft’s understanding of scaled components differs. |
I have been using scaled and rotated components for almost 10 years, if there is a problem I would have known by now. The only issue I had with components was Mac OS X not liking nested components (they get displaced), so for a long time I had code to de-nest them, but I dropped this recently because I can no longer reproduce it, no complaints so far. |
(nested and transformed components, that is it) |
There are several printers that have issues with nested components. See for example JulietaUla/Montserrat#108 which I suspect is the issue, since Udieresis has a nested component. For scaled components, this merge request is for a module that is optional, like the flattenComponentsFilter one is. I have no intention in making fontmake/ufo2ft using it be default.
|
Yes, makes sense to have such an optional filter available. Note that Glyphs.app has a custom parameter "Keep Transformed Components" which off by default; so by default Glyphs.app will decompose "distorted and mirrored components", unless that parameter is set. See https://glyphsapp.com/blog/new-features-in-glyphs-2-5 |
740279b
to
b4d4707
Compare
I’ve renamed it "Decompose Transformed Components". |
This adds a filter to decomposed rotated or scaled components. Some TrueType implementations don’t deal well with those.