From 0be32d46f7e5ca3b4f4fc6c5f7f19b110b948551 Mon Sep 17 00:00:00 2001 From: Jasper van de Gronde Date: Sat, 4 Jun 2011 16:16:57 +0200 Subject: Fixed font problem on win32. (bzr r9508.1.87) --- src/libnrtype/FontInstance.cpp | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/src/libnrtype/FontInstance.cpp b/src/libnrtype/FontInstance.cpp index 7dc8bb859..1b65dd88c 100644 --- a/src/libnrtype/FontInstance.cpp +++ b/src/libnrtype/FontInstance.cpp @@ -557,13 +557,19 @@ void font_instance::LoadGlyph(int glyph_id) break; case TT_PRIM_QSPLINE: - //g_assert(polyCurve->cpfx % 2 == 0); - if (polyCurve->cpfx % 2 != 0) return; - - while ( p != endp ) { - path_builder.quadTo(pointfx_to_nrpoint(p[0], scale), - pointfx_to_nrpoint(p[1], scale)); - p += 2; + { + g_assert(polyCurve->cpfx >= 2); + + // The list of points specifies one or more control points and ends with the end point. + // The intermediate points (on the curve) are the points between the control points. + Geom::Point this_control = pointfx_to_nrpoint(*p++, scale); + while ( p+1 != endp ) { // Process all "midpoints" (all points except the last) + Geom::Point new_control = pointfx_to_nrpoint(*p++, scale); + path_builder.quadTo(this_control, (new_control+this_control)/2); + this_control = new_control; + } + Geom::Point end = pointfx_to_nrpoint(*p++, scale); + path_builder.quadTo(this_control, end); } break; -- cgit v1.2.3