From 90ab2be4e6913245ce85848129ef8233f6467cf0 Mon Sep 17 00:00:00 2001 From: Joshua Granick Date: Thu, 23 Oct 2014 13:49:11 -0700 Subject: [PATCH] Better approximation of cubic curves --- project/src/graphics/Font.cpp | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/project/src/graphics/Font.cpp b/project/src/graphics/Font.cpp index c8cf197c0..b7182a341 100644 --- a/project/src/graphics/Font.cpp +++ b/project/src/graphics/Font.cpp @@ -210,12 +210,16 @@ namespace { // TODO: divide into multiple curves glyph *g = static_cast(user); - + + FT_Vector ctl; + ctl.x = (-0.25 * g->x) + (0.75 * ctl1->x) + (0.75 * ctl2->x) + (-0.25 * to->x); + ctl.y = (-0.25 * g->y) + (0.75 * ctl1->y) + (0.75 * ctl2->y) + (-0.25 * to->y); + g->pts.push_back(PT_CURVE); - g->pts.push_back((ctl1->x + ctl2->x) / 2 - g->x); - g->pts.push_back((ctl1->y + ctl2->y) / 2 - g->y); - g->pts.push_back(to->x - (ctl1->x + ctl2->x) / 2); - g->pts.push_back(to->y - (ctl1->y + ctl2->y) / 2); + g->pts.push_back(ctl.x - g->x); + g->pts.push_back(ctl.y - g->y); + g->pts.push_back(to->x - ctl.x); + g->pts.push_back(to->y - ctl.y); g->x = to->x; g->y = to->y;