SixLabors / Fonts

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

Add exposed function to retrieve all unicode codepoints defined in fonts #308

Closed CptWesley closed 1 year ago

CptWesley commented 1 year ago

Prerequisites

Description

Fixes #307

As described in the suggestion, exposing this information can make it easier for users to retrieve some extra information about what code points and glyphs are available in a font and how they are being mapped. Whether or not this is the right strategy to allow these queries is of course up for debate.

Changes:

CLAassistant commented 1 year ago

CLA assistant check
All committers have signed the CLA.

codecov[bot] commented 1 year ago

Codecov Report

Merging #308 (51afd7c) into main (14b89e6) will decrease coverage by 1%. The diff coverage is 80%.

@@          Coverage Diff          @@
##            main    #308   +/-   ##
=====================================
- Coverage     83%     83%   -1%     
=====================================
  Files        224     224           
  Lines      12311   12331   +20     
  Branches    1787    1790    +3     
=====================================
+ Hits       10290   10306   +16     
- Misses      1601    1603    +2     
- Partials     420     422    +2     
Flag Coverage Δ
unittests 83% <80%> (-1%) :arrow_down:

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
src/SixLabors.Fonts/FontMetrics.cs 100% <ø> (ø)
...ixLabors.Fonts/Tables/General/CMap/CMapSubTable.cs 90% <ø> (ø)
...bors.Fonts/Tables/General/CMap/Format14SubTable.cs 78% <0%> (-2%) :arrow_down:
src/SixLabors.Fonts/Tables/General/CMapTable.cs 85% <66%> (-3%) :arrow_down:
src/SixLabors.Fonts/StreamFontMetrics.cs 87% <75%> (-1%) :arrow_down:
src/SixLabors.Fonts/FileFontMetrics.cs 96% <100%> (+<1%) :arrow_up:
src/SixLabors.Fonts/GlyphMetrics.cs 50% <100%> (ø)
...abors.Fonts/Tables/General/CMap/Format0SubTable.cs 100% <100%> (ø)
...bors.Fonts/Tables/General/CMap/Format12SubTable.cs 97% <100%> (+<1%) :arrow_up:
...abors.Fonts/Tables/General/CMap/Format4SubTable.cs 100% <100%> (ø)

:mega: We’re building smart automated test selection to slash your CI/CD build times. Learn more

JimBobSquarePants commented 1 year ago

I haven't forgotten about this. I'm just doing some research to ensure we can implement the correct thing.

CptWesley commented 1 year ago

@JimBobSquarePants My apologies for no longer replying due to the holiday season. I have not incorporated the requested changes due to the fact that it seems this might not be the right approach for solving this due to what you mentioned and what was mentioned in #307. My personal experience with font rendering is very minimal, so I'm not sure what the right approach would be, but if I can be of any help, please let me know.

JimBobSquarePants commented 1 year ago

Hi @CptWesley I did some research, and I cannot find a definitive answer regarding variations. As such I believe it's best to leave as-is.

The rest of your code is ace. All I changed was the review comments re optimization. Thanks!

CptWesley commented 1 year ago

@JimBobSquarePants Thank you very much!