SixLabors / Fonts

:black_nib: Font loading and layout library.
https://sixlabors.com/products/fonts
Other
313 stars 72 forks source link

Fix Woff2 bounds decompression and size measurement calculations. #380

Closed JimBobSquarePants closed 9 months ago

JimBobSquarePants commented 9 months ago

Prerequisites

Description

Fixes #375 #373 #367

We were calculating the bounds bitmap length calculation incorrectly which led to the wrong bounds being read.

Further investigation into determining the correct bounds led to the discovery that the bounds calculation could be simplified and that the size was being incorrectly calculated.

I've added some additional visual tooling in the samples project that helps to verify measurement results. This helped me to discover that we were not rendering the results of some ligature substitutions if the remaining glyph code point was non-rendering. The output is pretty cool.

šŸ‘©šŸ»ā€šŸ¤ā€šŸ‘©šŸ¼

I also fixed the line breaking algorithm to include a missed breaking opportunity and exactly match browser output.