SixLabors / Fonts

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

Fix potential endianness and alignment problems with Span-based UnicodeTrie constructor #284

Closed DaZombieKiller closed 2 years ago

DaZombieKiller commented 2 years ago

Prerequisites

Description

This is a small PR making some changes to the recently-introduced ReadOnlySpan<byte> constructor for UnicodeTrie. Currently, the data provided to this constructor is constant data generated via the Roslyn ROS<byte> = new byte[] trick, which doesn't guarantee alignment on the data. The data is also stored in little-endian, which requires swapping for big-endian platforms.

CLAassistant commented 2 years ago

CLA assistant check
All committers have signed the CLA.

JimBobSquarePants commented 2 years ago

Haha... You beat me by seconds. Was just committing to a branch with your changes! 😁

codecov[bot] commented 2 years ago

Codecov Report

Merging #284 (1c6bd54) into main (fc97cb1) will decrease coverage by 0%. The diff coverage is 22%.

@@          Coverage Diff          @@
##            main    #284   +/-   ##
=====================================
- Coverage     83%     83%   -1%     
=====================================
  Files        222     222           
  Lines      12200   12199    -1     
  Branches    1756    1759    +3     
=====================================
- Hits       10167   10159    -8     
- Misses      1606    1610    +4     
- Partials     427     430    +3     
Flag Coverage Δ
unittests 83% <22%> (-1%) :arrow_down:

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

Impacted Files Coverage Δ
src/SixLabors.Fonts/Unicode/UnicodeTrie.cs 88% <22%> (-12%) :arrow_down:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update fc97cb1...1c6bd54. Read the comment docs.