Index: lily/freetype.cc |
diff --git a/lily/freetype.cc b/lily/freetype.cc |
index 050b8dcd1e838becf2a9711eea92d36ad5790e3d..4eb35e6a447903f27abdcc4c3c4ff6163c430697 100644 |
--- a/lily/freetype.cc |
+++ b/lily/freetype.cc |
@@ -101,6 +101,11 @@ ly_FT_add_outline_to_skyline (Lazy_skyline_pair *lazy, |
return; |
} |
+ // TrueType and PS fonts have opposite ideas about contour |
+ // orientation. |
+ bool is_tt = std::string ("TrueType") == FT_Get_Font_Format (face); |
+ Orientation orientation = is_tt ? CW : CCW; |
+ |
FT_Outline *outline = &(face->glyph->outline); |
int contour_start = 0; |
for (short c = 0; c < outline->n_contours; c++) |
@@ -125,7 +130,7 @@ ly_FT_add_outline_to_skyline (Lazy_skyline_pair *lazy, |
{ |
// it is a line |
Offset p = ftvector2offset (contour[j]); |
- lazy->add_segment (transform, lastpos, p); |
+ lazy->add_contour_segment (transform, orientation, lastpos, p); |
lastpos = p; |
j++; |
} |
@@ -153,7 +158,7 @@ ly_FT_add_outline_to_skyline (Lazy_skyline_pair *lazy, |
// This would be faster if we did the Bezier computation in integers. |
Offset pt = curve.curve_point ( |
static_cast<Real> (i) / static_cast<Real> (quantization)); |
- lazy->add_segment (transform, last, pt); |
+ lazy->add_contour_segment (transform, orientation, last, pt); |
last = pt; |
} |
} |
@@ -162,11 +167,11 @@ ly_FT_add_outline_to_skyline (Lazy_skyline_pair *lazy, |
// It is a second order bezier. We don't have code to |
// handle these. Substitute a line segment instead. |
Offset p = ftvector2offset (contour[(j + 1) % sz]); |
- lazy->add_segment (transform, lastpos, p); |
+ lazy->add_contour_segment (transform, orientation, lastpos, p); |
lastpos = p; |
j += 2; |
} |
} |
- lazy->add_segment (transform, lastpos, firstpos); |
+ lazy->add_contour_segment (transform, orientation, lastpos, firstpos); |
} |
} |