Skip to content

Use unrounded glyphs as source - #1849

Merged
Finii merged 3 commits into
masterfrom
feature/use-unrounded-source
Apr 22, 2025
Merged

Use unrounded glyphs as source#1849
Finii merged 3 commits into
masterfrom
feature/use-unrounded-source

Conversation

@Finii

@Finii Finii commented Apr 22, 2025

Copy link
Copy Markdown
Collaborator

Description

We take svgs and produce intermediate font files; these font files will be used to patch in the glyphs.

When a ttf font is created the coordinates will be rounded to integers, and doing this twice (with scaling in between) adds more rounding errors than would be needed.

image
Detail of 2665 in octicons.ttf (left) and octicons.otf (right)

The imperfections of the left glyph will be exaggerated when it is scaled and again coordinate-rouneded, like for example:

image
Patched Hermit with floating point node coordinates (left) and with integer rounding of coordinates (right)

Requirements / Checklist

  • Read the Contributing Guidelines
  • I've discussed this with core contributors already. If not checked, I'm ready to accept this work might be rejected in favor of a different grand plan.
    Issue number where discussion took place: #xxx
  • If this contains a font/glyph add its origin as background info below (e.g. URL)
  • Verified the license of any newly added font, glyph, or glyph set. License is: xxx

What does this Pull Request (PR) do?

Minimize rounding errors introduced by the intermediate glyph fonts that we use to patch in lots and lots of svgs.

How should this be manually tested?

Any background context you can provide?

What are the relevant tickets (if any)?

Screenshots (if appropriate or helpful)

Finii added 2 commits April 22, 2025 15:19
[why]
We construct the octicons font file from the original svgs.
To put them into the font file the svg is interpreted and transformed
into the font coordinate system, and then again scaled.

The resulting font file is then saved as `ttf`, thereby rounding all
coordinates. That font is then used as source for the real patching
process - and will be rounded again (possibly).

The rounding errors accumulate and we should only round once. That means
intermediate fonts need to be `otf`.

Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
See previous commit for explanation.

Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
@Finii Finii added this to the v3.4.0 milestone Apr 22, 2025
@Finii

Finii commented Apr 22, 2025

Copy link
Copy Markdown
Collaborator Author

@allcontributors please add @duytrung for bug

@allcontributors

Copy link
Copy Markdown
Contributor

@Finii

I've put up a pull request to add @duytrung! 🎉

[why]
With commit
     801fb9f Update CascadiaCode to 2407.24

(PR #1844) we dropped the subdir structure of Cascadia Code.
The workflow file did not follow that change.

Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
@Finii

Finii commented Apr 22, 2025

Copy link
Copy Markdown
Collaborator Author

Example of what this fixes:

This is Lilex NFM, left side before the PR, right side after.
All the problematic (rounding induced) issues have an arrow.

image

This needs to be looked at big. Note for example the lower-right stem of the H. It is wobbely left (before) and straight after (right). Some rounding issues are still there, but much less so.

image

Some new small scale issues turn up after the PR, but these are even more minuscule.

@Finii
Finii merged commit c240c95 into master Apr 22, 2025
@Finii
Finii deleted the feature/use-unrounded-source branch April 22, 2025 15:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant