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

Bugfix composite glyphs #35

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

Finii
Copy link

@Finii Finii commented Jan 30, 2024

[why]
Glyphs with references, for example a i acute that is assembled (in some
fonts) from dottless i and actue fail to come out with correct
bearings.

[how]
It is rather hard to adjust all the layers correctly.
The simple approach is to replace the composit glyphs with their actual
component-outlines. After that the scaling can happen as any ordinary
glyph.

The drawback is that the font needs more memory, especially if it has a
large amount of composite glyphs.

We need to do this in two loops because the unlinking must happen before
any referenced glyph has been modified.

[note]
Also fix some code already fixed in PR #34 here for convenience.

Fixes: #29
Fixes: #32
Fixes: fontforge/fontforge#5222

Related: #25

[why]
Glyphs with references, for example a `i acute` that is assembled (in some
fonts) from `dottless i` and `actue` fail  to come out with correct
bearings.

[how]
With refenence-glyphs we can not set the width.
Handle all referenced glyphs first and then correct the left side
bearing.

Assumes that no composite glyph references another composite glyph; but
that is rather rare.

[note]
Also fix some code already fixed in PR cpitclaudel#34 here for convenience.

Signed-off-by: Fini Jastrow <[email protected]>
[why]
The previous fix can distort the composite glyphs if the width change is
drastic.

[how]
It is rather hard to adjust all the layers correctly.
The simple approach is to replace the composit glyphs with their actual
component-outlines. After that the scaling can happen as any ordinary
glyph.

The drawback is that the font needs more memory, especially if it has a
large amount of composite glyphs.

We need to do this in two loops because the unlinking must happen before
any referenced glyph has been modified.

Signed-off-by: Fini Jastrow <[email protected]>
@Finii
Copy link
Author

Finii commented Jan 30, 2024

This PR has two commits, both fix the problem

commit / solution 1

  • Keeps composite glyphs composits (does not replicate the referenced glyphs)
  • Introduces small shifts of the components if the width change is bigger

commit / solution 2

  • Converts all composite glyphs to ordinary outline glyphs (means the outlines are duplicated)
  • Size increase
  • No resizing errors even with big changes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment