[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[freetype2] GSoC-2019-moazin 0f87caf 02/11: No need to call `FT_Load_Gly
From: |
Moazin Khatti |
Subject: |
[freetype2] GSoC-2019-moazin 0f87caf 02/11: No need to call `FT_Load_Glyph' with `XX_NO_SCALE'. |
Date: |
Fri, 16 Aug 2019 04:30:02 -0400 (EDT) |
branch: GSoC-2019-moazin
commit 0f87cafa42d0c6b87c1f43ee72874148292cc0eb
Author: Moazin Khatti <address@hidden>
Commit: Moazin Khatti <address@hidden>
No need to call `FT_Load_Glyph' with `XX_NO_SCALE'.
We no longer need TTF/CFF outlines for SVG rendering.
---
src/base/ftobjs.c | 14 --------------
src/cff/cffgload.c | 18 ++++++++++++++++++
src/sfnt/ttsvg.c | 4 ----
src/truetype/ttgload.c | 18 ++++++++++++++++++
4 files changed, 36 insertions(+), 18 deletions(-)
diff --git a/src/base/ftobjs.c b/src/base/ftobjs.c
index a77c985..5e5da50 100644
--- a/src/base/ftobjs.c
+++ b/src/base/ftobjs.c
@@ -893,20 +893,6 @@
if ( load_flags & FT_LOAD_BITMAP_METRICS_ONLY )
load_flags &= ~FT_LOAD_RENDER;
-#ifdef FT_CONFIG_OPTION_SVG
- if ( ( load_flags & FT_LOAD_COLOR ) &&
- ( ttface->svg ) )
- {
- FT_TRACE3(( "SVG table exists, calling `FT_Load_Glyph' with
`FT_LOAD_NO_SCALE'\n" ));
- /* load the TTF/CFF glyph without any scaling,
- * this is so that ultimately, these outlines
- * can be used to calculate the bounding box and
- * the advance metrics
- */
- FT_Load_Glyph( face, glyph_index, FT_LOAD_NO_SCALE);
- }
-#endif
-
/*
* Determine whether we need to auto-hint or not.
* The general rules are:
diff --git a/src/cff/cffgload.c b/src/cff/cffgload.c
index 629b9b1..9911e8a 100644
--- a/src/cff/cffgload.c
+++ b/src/cff/cffgload.c
@@ -359,6 +359,24 @@
{
FT_TRACE3(( "Successfully loaded SVG glyph\n" ));
glyph->root.format = FT_GLYPH_FORMAT_SVG;
+ FT_Short leftBearing, topBearing;
+ FT_UShort advanceX, advanceY;
+ sfnt->get_metrics( face,
+ FALSE,
+ glyph_index,
+ &leftBearing,
+ &advanceX );
+ sfnt->get_metrics( face,
+ TRUE,
+ glyph_index,
+ &topBearing,
+ &advanceY );
+ advanceX *= ((float)glyph->root.face->size->metrics.x_ppem)/
+ ((float)glyph->root.face->units_per_EM) * 64.0;
+ advanceY *= ((float)glyph->root.face->size->metrics.y_ppem)/
+ ((float)glyph->root.face->units_per_EM) * 64.0;
+ glyph->root.metrics.horiAdvance = advanceX;
+ glyph->root.metrics.vertAdvance = advanceY;
return error;
}
FT_TRACE3(( "Failed to load SVG glyph\n" ));
diff --git a/src/sfnt/ttsvg.c b/src/sfnt/ttsvg.c
index f4a85ca..e8dcac9 100644
--- a/src/sfnt/ttsvg.c
+++ b/src/sfnt/ttsvg.c
@@ -328,10 +328,6 @@
FT_TRACE5(( "svg_document:\n%.*s\n", doc_length, doc_list ));
glyph->other = svg_document;
- glyph->metrics.horiAdvance *= ((float)glyph->face->size->metrics.x_ppem)/
- ((float)glyph->face->units_per_EM) * 64.0;
- glyph->metrics.vertAdvance *= ((float)glyph->face->size->metrics.y_ppem)/
- ((float)glyph->face->units_per_EM) * 64.0;
return FT_Err_Ok;
}
diff --git a/src/truetype/ttgload.c b/src/truetype/ttgload.c
index 817852a..f92cbd1 100644
--- a/src/truetype/ttgload.c
+++ b/src/truetype/ttgload.c
@@ -2919,6 +2919,24 @@
{
FT_TRACE3(( "Successfully loaded SVG glyph\n" ));
glyph->format = FT_GLYPH_FORMAT_SVG;
+ FT_Short leftBearing, topBearing;
+ FT_UShort advanceX, advanceY;
+ sfnt->get_metrics( glyph->face,
+ FALSE,
+ glyph_index,
+ &leftBearing,
+ &advanceX );
+ sfnt->get_metrics( glyph->face,
+ TRUE,
+ glyph_index,
+ &topBearing,
+ &advanceY );
+ advanceX *= ((float)glyph->face->size->metrics.x_ppem)/
+ ((float)glyph->face->units_per_EM) * 64.0;
+ advanceY *= ((float)glyph->face->size->metrics.y_ppem)/
+ ((float)glyph->face->units_per_EM) * 64.0;
+ glyph->metrics.horiAdvance = advanceX;
+ glyph->metrics.vertAdvance = advanceY;
return error;
}
FT_TRACE3(( "Failed to load SVG glyph\n" ));
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [freetype2] GSoC-2019-moazin 0f87caf 02/11: No need to call `FT_Load_Glyph' with `XX_NO_SCALE'.,
Moazin Khatti <=