* Make AdobeFontMetricsLigature a struct
* Make AdobeFontMetricsCharacterSize a struct
* Eliminate allocation in CompactFontFormatData
* Pass TransformationMatrix by reference
* Seal Encoding classes
* Make SubTableHeaderEntry a readonly struct
* Introduce StringSplitter and eliminate various allocations in GlyphListFactory
* Eliminate a few substring allocations
* Use char overload on StringBuilder
* Eliminate virtual calls on stringIndex
* Optimize ReadHelper ReadLong and ReadInt methods
* Add additional readonly annotations to PdfRectangle
* Optimize NameTokenizer
* Eliminate allocation in TrueTypeGlyphTableSubsetter
* Use empty arrays
* Eliminate allocations in OperationWriteHelper.WriteHex
* Use simplified DecryptCbc method on .NET 6+
* Fix windows-1252 encoding not working on net6.0 and 8.0
* Update int buffers to exact unsigned max length and eliminate additional byte allocation
* Fix typo
* Remove unused constant
the additional stored fields made the struct slower to copy and had an impact on the performance. this moves non-essential fields back to computed properties.
since the rectangle constructor is a hot path any calculations slow the library down considerably. for this reason we move calculations for the following properties into the property getter:
* width (cached)
* height (cached)
* rotation
* area
* centroid
where values are cached they set their backing field once calculated. this won't be thread safe if the same rectangle is accessed on multiple threads.
now that rectangle constructor uses the order [ llx, lly, urx, ury ] and does not apply correction for points constructor parameters must be passed in the correct order. this change fixes the hyperlink factory which was passing them in the wrong order.
in addition the pdfpath bounding box was using left, right, top and bottom to calculate the minimum bounding box. this produced incorrect values now individual path operator bounding boxes are rotated, since for a rotated rectangle top may be less than bottom.
the performance seems to have taken a hit due to these changes however.
to make the project more useful and expose more usable classes we're rearchitecting in the following way. code used to read fonts from external file formats like truetype, adobe font metrics (afm) and adobe type 1 fonts are moving to a new project which doesn't reference most of the pdf logic. the shared logic is moving to a new flat-structured project called core. this is a sort-of onion type architecture, with core being the... core, fonts being the next layer of the onion, pdfpig itself the next. this will then support additional libraries/projects as outer layers of the onion as well as releasing standalone version of the font library as pdfbox does with fontbox.