mirror of
https://github.com/SerenityOS/serenity.git
synced 2025-01-23 18:02:05 -05:00
LibGfx: Remove bit casting in OpenType CBDT table after construction
This commit is contained in:
parent
4e944e676b
commit
21f2f09df4
2 changed files with 6 additions and 3 deletions
|
@ -506,7 +506,8 @@ ErrorOr<CBDT> CBDT::from_slice(ReadonlyBytes slice)
|
|||
{
|
||||
if (slice.size() < sizeof(CbdtHeader))
|
||||
return Error::from_string_literal("CBDT table too small");
|
||||
return CBDT { slice };
|
||||
auto const& header = *bit_cast<CbdtHeader*>(slice.data());
|
||||
return CBDT { slice, header };
|
||||
}
|
||||
|
||||
ErrorOr<GPOS> GPOS::from_slice(ReadonlyBytes slice)
|
||||
|
|
|
@ -586,15 +586,17 @@ public:
|
|||
static ErrorOr<CBDT> from_slice(ReadonlyBytes);
|
||||
ReadonlyBytes bytes() const { return m_slice; }
|
||||
|
||||
CbdtHeader const& header() const { return *bit_cast<CbdtHeader const*>(m_slice.data()); }
|
||||
CbdtHeader const& header() const { return m_header; }
|
||||
|
||||
private:
|
||||
explicit CBDT(ReadonlyBytes slice)
|
||||
explicit CBDT(ReadonlyBytes slice, CbdtHeader const& header)
|
||||
: m_slice(slice)
|
||||
, m_header(header)
|
||||
{
|
||||
}
|
||||
|
||||
ReadonlyBytes m_slice;
|
||||
CbdtHeader const& m_header;
|
||||
};
|
||||
|
||||
// https://learn.microsoft.com/en-us/typography/opentype/spec/chapter2#feature-list-table
|
||||
|
|
Loading…
Add table
Reference in a new issue