nerd-fonts icon indicating copy to clipboard operation
nerd-fonts copied to clipboard

Draft: Fix unequal weather icon scale

Open Finii opened this issue 3 years ago • 1 comments

[why] The weather icons have some symbols that have a different bounding box but should nevertheless be scaled alike, because for example one is the outer line of a thermometer and one is the matching stem.

[how] Just add a scaleGlyph set.

Fixes: #915

Requirements / Checklist

What does this Pull Request (PR) do?

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 avatar Sep 07 '22 14:09 Finii

This is not enough, because while the scaling is kept identical within a group, the shifting is not.

This will still not match despite same scale factor:

image

The stem is too high to fit into the outer line.

But that is already tackled by

  • #837

because we have the same problem there: https://github.com/ryanoasis/nerd-fonts/pull/837#discussion_r886717207 :grimacing:

Finii avatar Sep 07 '22 14:09 Finii

This required a lot of rework on the ScaleGlyph side.

Now the combined / virtual bounding box of all symbol glyphs that are in one ScaleGlyph entry is retained. Previously it hast just been calculated, used to determine the scaling, and dropped. Now we can reuse it in the later patch process to move (align) all glyphs in a ScaleGlyph entry the same way.

For all glyphs in a ScaleGlyph entry the vertical alignment is the same and based on the virtual bounding box. This solves the issue described above with the thermometer.

If all glyphs in the ScaleGlyph have the same advance width they (as a group) are considered 'monospaced', and additionally to the vertical alignment also the horizontal alignemnt is synchronized for them based on the bounding box.

Finii avatar Oct 13 '22 11:10 Finii

Rebase on master, force push

Finii avatar Dec 21 '22 14:12 Finii

:thinking: .o( This needs a test ) ;)

Finii avatar Jan 04 '23 16:01 Finii

Ahh, setting up the tests and then using fontforge Compare fonts, this is nice:

image

Showing the degrees-icon moving up to were it belongs

Finii avatar Jan 05 '23 18:01 Finii

Pffff, what a PR.

All tests seem to be okay and this is indeed doing what is intened ;-)

Finii avatar Jan 05 '23 18:01 Finii