Sam Atkins
54d0aafff0
LibGfx: Use FourCC as OpenType::Tag type
...
The one deviation from the spec here is to use this in the WOFF
TableDirectoryEntry's tag field. However, *not* making that a Tag made
a lot of things more complicated than they need to be.
2023-11-24 08:42:46 +01:00
Tim Schumacher
a2f60911fe
AK: Rename GenericTraits to DefaultTraits
...
This feels like a more fitting name for something that provides the
default values for Traits.
2023-11-09 10:05:51 -05:00
Andrew Kaster
86ce502ae2
LibGfx+Utilities: Add helpers to load vector fonts from Core::Resources
2023-10-29 13:12:28 -06:00
Tim Ledbetter
4b5b8fc564
LibGfx: Use safe version of count_leading_zeroes()
in WOFF parsers
...
This guards against undefined behavior when zero is given as an
argument.
2023-10-27 07:13:51 +02:00
Tim Ledbetter
7096ea82f9
LibGfx: Use count_leading_zeroes
to calculate nearest power of 2
...
This removes the possibility of an infinite loop.
2023-10-26 08:39:26 +02:00
Tim Ledbetter
52f78d07b8
LibGfx/WOFF2: Ensure numTables
is within expected range
...
An error is now returned if `numTables` is zero or greater than 4096.
While this isn't explicitly mentioned in the specification, subsequent
calculations will be incorrect if the value falls outside this range.
2023-10-26 08:39:26 +02:00
Tim Ledbetter
e9be1bcd09
LibGfx/WOFF2: Reject fonts with a compressed size larger than 10MiB
...
This prevents a potential OOM condition when the header is malformed.
2023-10-24 13:45:01 +02:00
Tim Ledbetter
af633523af
LibGfx/WOFF2: Tolerate incorrect totalSfntSize
in WOFF2 header
...
The specification says that this value is for reference only, so we
should be able to load a file where this value is incorrect.
2023-10-24 13:45:01 +02:00
Sam Atkins
e108f394bf
LibGfx: Replace manual offsets when producing WOFF2 loca table
2023-10-22 19:42:22 +02:00
Sam Atkins
885665b3a6
LibGfx: Simplify writing to WOFF2 reconstructed glyf table
2023-10-22 19:42:22 +02:00
Sam Atkins
ad717af63d
LibGfx: Read WOFF2 transformed GLYF table buffers in-place
...
This saves us from having to allocate a buffer and copying the data,
when it's already available to us. Also, less code. :^)
2023-10-22 19:42:22 +02:00
Sam Atkins
9642a0f43a
LibGfx: Use a struct for reading WOFF2 transformed GLYF table
2023-10-22 19:42:22 +02:00
Sam Atkins
8e96902c75
LibGfx: Use OpenType offset table structs when reading WOFF2 font data
2023-10-22 19:42:22 +02:00
Sam Atkins
b73b434f80
LibGfx: Use a Header struct when reading WOFF2 font data
2023-10-22 19:42:22 +02:00
Tim Schumacher
dbc25f18ec
LibCompress: Let BrotliDecompressionStream
take a MaybeOwned
2023-08-23 12:03:37 +01:00
Andreas Kling
2971ae59d8
LibGfx/WOFF2: Align all reconstructed glyf entries to 4 bytes
...
It wasn't enough to do it only for simple glyphs, we need to do it for
composite glyphs as well.
Fixes an issue where some glyph data was misaligned in the output and
thus ended up rendered incorrectly or not at all.
2023-08-16 14:49:59 +02:00
Andreas Kling
9ba4c33940
LibGfx: Add support for WOFF2 compressed web fonts
...
Co-authored-by: Luke Wilde <lukew@serenityos.org>
2023-08-12 20:12:13 +02:00