From 187acd8f2154f1694e1e2ebca8a39b348c3426f7 Mon Sep 17 00:00:00 2001 From: Stephan Unverwerth Date: Tue, 29 Dec 2020 16:12:58 +0100 Subject: [PATCH] LibTTF: Do not assert on glyphs with broken line coordinates Until we figure out what causes this problem or we can fixup the coordinates we should simply not render this line. --- Libraries/LibTTF/Glyf.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Libraries/LibTTF/Glyf.cpp b/Libraries/LibTTF/Glyf.cpp index 2bcaf669a5..381fbff152 100644 --- a/Libraries/LibTTF/Glyf.cpp +++ b/Libraries/LibTTF/Glyf.cpp @@ -263,6 +263,16 @@ void Rasterizer::draw_line(Gfx::FloatPoint p0, Gfx::FloatPoint p1) p1.set_y(roundf(p1.y())); } + if (!(p0.x() >= 0.0 && p0.y() >= 0.0 && p0.x() <= m_size.width() && p0.y() <= m_size.height())) { + dbgln("!P0({},{})", p0.x(), p0.y()); + return; + } + + if (!(p1.x() >= 0.0 && p1.y() >= 0.0 && p1.x() <= m_size.width() && p1.y() <= m_size.height())) { + dbgln("!P1({},{})", p1.x(), p1.y()); + return; + } + ASSERT(p0.x() >= 0.0 && p0.y() >= 0.0 && p0.x() <= m_size.width() && p0.y() <= m_size.height()); ASSERT(p1.x() >= 0.0 && p1.y() >= 0.0 && p1.x() <= m_size.width() && p1.y() <= m_size.height());