diff --git a/Userland/Libraries/LibGfx/Font/OpenType/Tables.h b/Userland/Libraries/LibGfx/Font/OpenType/Tables.h index 60d9c66a22..037da95439 100644 --- a/Userland/Libraries/LibGfx/Font/OpenType/Tables.h +++ b/Userland/Libraries/LibGfx/Font/OpenType/Tables.h @@ -2,6 +2,7 @@ * Copyright (c) 2020, Srimanta Barua * Copyright (c) 2022, Jelle Raaijmakers * Copyright (c) 2023, Lukas Affolter + * Copyright (c) 2023, Sam Atkins * * SPDX-License-Identifier: BSD-2-Clause */ @@ -42,6 +43,26 @@ using Tag = BigEndian; using Offset16 = BigEndian; using Offset32 = BigEndian; +// https://learn.microsoft.com/en-us/typography/opentype/spec/otff#table-directory +// Table Directory (known as the Offset Table in ISO-IEC 14496-22:2019) +struct [[gnu::packed]] TableDirectory { + BigEndian sfnt_version; + BigEndian num_tables; // Number of tables. + BigEndian search_range; // (Maximum power of 2 <= numTables) x 16. + BigEndian entry_selector; // Log2(maximum power of 2 <= numTables). + BigEndian range_shift; // NumTables x 16 - searchRange. +}; +static_assert(AssertSize()); + +// https://learn.microsoft.com/en-us/typography/opentype/spec/otff#table-directory +struct [[gnu::packed]] TableRecord { + Tag table_tag; // Table identifier. + BigEndian checksum; // CheckSum for this table. + Offset32 offset; // Offset from beginning of TrueType font file. + BigEndian length; // Length of this table. +}; +static_assert(AssertSize()); + // https://learn.microsoft.com/en-us/typography/opentype/spec/head // head: Font Header Table class Head {