diff options
| -rw-r--r-- | src/libnrtype/FontInstance.cpp | 20 |
1 files 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; |
