Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(91)

Unified Diff: lily/freetype.cc

Issue 569700043: Split glyph contours in up/down segments for skylines
Patch Set: rebase on bugfix change Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | lily/include/lazy-skyline-pair.hh » ('j') | lily/include/lazy-skyline-pair.hh » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
}
}
« no previous file with comments | « no previous file | lily/include/lazy-skyline-pair.hh » ('j') | lily/include/lazy-skyline-pair.hh » ('J')

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b