Skip to content

SVG Freesans rendering #927

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 6, 2012
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 31 additions & 7 deletions src/ft2font.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -536,6 +536,7 @@ FT2Font::get_path()
for (n = 0; n < outline.n_contours; n++)
{
int last; // index of last point in contour
bool starts_with_last;

last = outline.contours[n];
limit = outline.points + last;
Expand All @@ -554,13 +555,22 @@ FT2Font::get_path()
{
throw Py::RuntimeError("A contour cannot start with a cubic control point");
}
else if (tag == FT_CURVE_TAG_CONIC)
{
starts_with_last = true;
} else {
starts_with_last = false;
}

count++;

while (point < limit)
{
point++;
tags++;
if (!starts_with_last) {
point++;
tags++;
}
starts_with_last = false;

tag = FT_CURVE_TAG(tags[0]);
switch (tag)
Expand Down Expand Up @@ -656,7 +666,8 @@ FT2Font::get_path()
first = 0;
for (n = 0; n < outline.n_contours; n++)
{
int last; // index of last point in contour
int last; // index of last point in contour
bool starts_with_last;

last = outline.contours[n];
limit = outline.points + last;
Expand All @@ -670,16 +681,29 @@ FT2Font::get_path()
tags = outline.tags + first;
tag = FT_CURVE_TAG(tags[0]);

double x = conv(v_start.x);
double y = flip_y ? -conv(v_start.y) : conv(v_start.y);
double x, y;
if (tag != FT_CURVE_TAG_ON)
{
x = conv(v_last.x);
y = flip_y ? -conv(v_last.y) : conv(v_last.y);
starts_with_last = true;
} else {
x = conv(v_start.x);
y = flip_y ? -conv(v_start.y) : conv(v_start.y);
starts_with_last = false;
}

*(outpoints++) = x;
*(outpoints++) = y;
*(outcodes++) = MOVETO;

while (point < limit)
{
point++;
tags++;
if (!starts_with_last) {
point++;
tags++;
}
starts_with_last = false;

tag = FT_CURVE_TAG(tags[0]);
switch (tag)
Expand Down