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

reversed outlines when building fonts from quadratic curves #1045

Open
RosaWagner opened this issue Oct 5, 2023 · 13 comments
Open

reversed outlines when building fonts from quadratic curves #1045

RosaWagner opened this issue Oct 5, 2023 · 13 comments

Comments

@RosaWagner
Copy link

We are trying to onboard a font with quadratic sources and manual hinting. The problem is that the outlines get reversed during export (as if the sources were postscript) and the manual hinting is then completely wrong.

The fonts can be build with manual hinting with gftools builder in that branch: https://github.com/RosaWagner/intel-one-mono/tree/googlefonts

This is the image the designers send after testing:

Their build:
Intel One Mono hinting (FJT build 1_3)

Fontmake build:
Intel One Mono hinting (Google build)

cc @simoncozens @m4rc1e

@anthrotype
Copy link
Member

there's --keep-direction option, have you tried with that?

@RosaWagner
Copy link
Author

Ah it might not be supported by gftools builder

@anthrotype
Copy link
Member

for a font with quadratic sources and manual hinting, in addition to --keep-direction, you could also pass --ttf-curves=keep-quad so cu2qu is skipped as well (it should not modify the quads but it's quicker if you know in advance there are no cubic to convert). Also --keep-overlaps if you're building a static font, so the original quadratic outlines are not messed with.

@anthrotype
Copy link
Member

fontmake's defaults are geared towards the most common use case i.e. source containing cubic bezier (hence drawn following PostScript counter-clockwise direction) => TrueType with quadratic curves and clockwise direction

@RosaWagner
Copy link
Author

for a font with quadratic sources and manual hinting, in addition to --keep-direction, you could also pass --ttf-curves=keep-quad so cu2qu is skipped as well (it should not modify the quads but it's quicker if you know in advance there are no cubic to convert). Also --keep-overlaps if you're building a static font, so the original quadratic outlines are not messed with.

Okay thanks!

fontmake's defaults are geared towards the most common use case i.e. source containing cubic bezier (hence drawn following PostScript counter-clockwise direction) => TrueType with quadratic curves and clockwise direction

yeah I am aware.

@simoncozens
Copy link
Contributor

I feel like you shouldn't need to pass an optional flag to do the right thing. The right thing should be the default.

@anthrotype
Copy link
Member

but how?

@anthrotype
Copy link
Member

perhaps are you suggesting something like, if a glyph contours only contain quadratic curves (or any?) then fontmake can assume they are already in the correct direction and not flip it, whereas if there's all (or any?) cubic curves then proceed with the reversal?

@simoncozens
Copy link
Contributor

Exactly.

@anthrotype
Copy link
Member

or you want to sum the signed area of all the glyph's contours to obtain an overall direction and flip accordingly to match the recommeded orientation for a given output format?
that seems a bit risky..

@simoncozens
Copy link
Contributor

That does sound a bit risky. Wouldn't it work to just not reverse quadratic-only curves? Unless I've misunderstood something, it seems like there is a right order for quadratic curves and we're currently doing the wrong thing by reversing them.

@anthrotype
Copy link
Member

yeah, there is a recommended order but fontmake isn't actually checking which order it currently is and acting based on that. fontmake doesn't know nor checks whether the current order is right or wrong; it can only know whether the glyph contains all-quadratic, all cubic, or a mix of the two which is also legal in sources.

@anthrotype
Copy link
Member

technically a font could contain only lines, no curves at all, how do you know in that case what the right thing to do is?..
I'm very tempted to not change anything and keep it like this tbh.

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

3 participants