mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 11:57:35 +00:00
LibGfx/OpenType: Survive simple glyphs with 0 contours
These are valid per spec, and do sometimes occur in practice, e.g. in embedded fonts in 0000550.pdf and 0000246.pdf in 0000.zip in the PDFA test set.
This commit is contained in:
parent
486c562c7e
commit
fa24fbf120
1 changed files with 3 additions and 1 deletions
|
@ -246,7 +246,9 @@ ReadonlyBytes Glyf::Glyph::program() const
|
||||||
void Glyf::Glyph::append_path_impl(Gfx::Path& path, Gfx::AffineTransform const& transform) const
|
void Glyf::Glyph::append_path_impl(Gfx::Path& path, Gfx::AffineTransform const& transform) const
|
||||||
{
|
{
|
||||||
// Get offset for flags, x, and y.
|
// Get offset for flags, x, and y.
|
||||||
u16 num_points = be_u16(m_slice.offset((m_num_contours - 1) * 2)) + 1;
|
u16 num_points = 0;
|
||||||
|
if (m_num_contours > 0)
|
||||||
|
num_points = be_u16(m_slice.offset((m_num_contours - 1) * 2)) + 1;
|
||||||
u16 num_instructions = be_u16(m_slice.offset(m_num_contours * 2));
|
u16 num_instructions = be_u16(m_slice.offset(m_num_contours * 2));
|
||||||
u32 flags_offset = m_num_contours * 2 + 2 + num_instructions;
|
u32 flags_offset = m_num_contours * 2 + 2 + num_instructions;
|
||||||
u32 x_offset = 0;
|
u32 x_offset = 0;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue