forked from minhngoc25a/freetype2
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:
parent
2a9f8aea1f
commit
4288f4a70a
|
@ -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 )
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue