[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[freetype2] svg_metrics 10c291507: * src/cff/cffgload.c (cff_slot_load):
From: |
Werner Lemberg |
Subject: |
[freetype2] svg_metrics 10c291507: * src/cff/cffgload.c (cff_slot_load): Simplify SVG metrics scaling. |
Date: |
Thu, 20 Oct 2022 11:39:55 -0400 (EDT) |
branch: svg_metrics
commit 10c2915075a34a31a30731a8e4b90cce6dedf63b
Author: Alexei Podtelezhnikov <apodtele@gmail.com>
Commit: Alexei Podtelezhnikov <apodtele@gmail.com>
* src/cff/cffgload.c (cff_slot_load): Simplify SVG metrics scaling.
---
src/cff/cffgload.c | 29 ++++++++++++-----------------
1 file changed, 12 insertions(+), 17 deletions(-)
diff --git a/src/cff/cffgload.c b/src/cff/cffgload.c
index d8fc31857..b19149048 100644
--- a/src/cff/cffgload.c
+++ b/src/cff/cffgload.c
@@ -356,17 +356,13 @@
#ifdef FT_CONFIG_OPTION_SVG
/* check for OT-SVG */
- if ( ( load_flags & FT_LOAD_COLOR ) &&
- ( (TT_Face)glyph->root.face )->svg )
+ if ( ( load_flags & FT_LOAD_COLOR ) && face->svg )
{
/*
* We load the SVG document and try to grab the advances from the
* table. For the bearings we rely on the presetting hook to do that.
*/
- FT_Short dummy;
- FT_UShort advanceX;
- FT_UShort advanceY;
SFNT_Service sfnt;
@@ -379,10 +375,18 @@
FT_TRACE3(( "Trying to load SVG glyph\n" ));
- sfnt = (SFNT_Service)((TT_Face)glyph->root.face)->sfnt;
+ sfnt = (SFNT_Service)face->sfnt;
error = sfnt->load_svg_doc( (FT_GlyphSlot)glyph, glyph_index );
if ( !error )
{
+ FT_Fixed x_scale = size->root.metrics.x_scale;
+ FT_Fixed y_scale = size->root.metrics.y_scale;
+
+ FT_Short dummy;
+ FT_UShort advanceX;
+ FT_UShort advanceY;
+
+
FT_TRACE3(( "Successfully loaded SVG glyph\n" ));
glyph->root.format = FT_GLYPH_FORMAT_SVG;
@@ -407,17 +411,8 @@
glyph->root.linearHoriAdvance = advanceX;
glyph->root.linearVertAdvance = advanceY;
- advanceX =
- (FT_UShort)FT_MulDiv( advanceX,
- glyph->root.face->size->metrics.x_ppem,
- glyph->root.face->units_per_EM );
- advanceY =
- (FT_UShort)FT_MulDiv( advanceY,
- glyph->root.face->size->metrics.y_ppem,
- glyph->root.face->units_per_EM );
-
- glyph->root.metrics.horiAdvance = advanceX << 6;
- glyph->root.metrics.vertAdvance = advanceY << 6;
+ glyph->root.metrics.horiAdvance = FT_MulFix( advanceX, x_scale );
+ glyph->root.metrics.vertAdvance = FT_MulFix( advanceY, y_scale );
return error;
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [freetype2] svg_metrics 10c291507: * src/cff/cffgload.c (cff_slot_load): Simplify SVG metrics scaling.,
Werner Lemberg <=