Minor changes.

* src/base/ftobjs.c (FT_Load_Glyph): Use the recrusive call with
`FT_LOAD_NO_SCALE' so that the loaded data is unscaled.

* src/base/ftobjs.c (FT_Render_Glyph_Internal): Change the format
to bitmap once an SVG glyph is successfully rendered.

* src/sfnt/ttsvg.c (tt_face_load_svg_doc): Make sure metrics are
grabbed. Scale `horiAdvance' and `vertAdvance' properly and
convert them to 26.6 format.
This commit is contained in:
Moazin Khatti 2019-06-22 22:58:08 +05:00
parent 6bf9ade45c
commit d1a0615f00
2 changed files with 11 additions and 2 deletions

View File

@ -839,9 +839,9 @@
load_flags &= ~FT_LOAD_RENDER;
if ( ( load_flags & FT_LOAD_COLOR ) &&
( ((TT_Face)face)->svg ) )
( ttface->svg ) )
{
FT_Load_Glyph( face, glyph_index, FT_LOAD_DEFAULT );
FT_Load_Glyph( face, glyph_index, FT_LOAD_NO_SCALE);
}
/*
@ -4548,6 +4548,11 @@
case FT_GLYPH_FORMAT_SVG: /* handle svg rendering */
renderer = FT_Lookup_Renderer( library, slot->format, NULL );
error = renderer->clazz->render_glyph( renderer, slot, FT_RENDER_MODE_NORMAL, NULL);
if( error == FT_Err_Ok )
{
slot->format = FT_GLYPH_FORMAT_BITMAP;
}
return error;
break;
default:
if ( slot->internal->load_flags & FT_LOAD_COLOR )

View File

@ -232,7 +232,11 @@
svg_document->svg_document = doc_list;
svg_document->svg_document_length = doc_length;
svg_document->metrics = glyph->face->size->metrics;
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;
}