summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMoazin Khatti <moazinkhatri@gmail.com>2019-06-24 00:33:45 +0500
committerMoazin Khatti <moazinkhatri@gmail.com>2019-08-17 20:36:05 +0500
commite48cf716f89bbf7b206e71499525d88acbf755ae (patch)
tree0390f074c7bbea8771a12b6410b1be8ca98c4a4d /src
parent7275d6562f8eb8f591b5e1a2d73ef9b8bcb92a0a (diff)
downloadfreetype2-e48cf716f89bbf7b206e71499525d88acbf755ae.tar.gz
Add a `units_per_EM' field.
A field `units_per_EM' is added to `FT_SVG_DocumentRec' and `FT_SvgGlyphRec'. This is needed because the renderer needs this info to properly scale the SVGs if the viewbox width and height differ from `face->units_per_EM'. Face object can't be accessed because of the restrictions put by `FT_Glyph_To_Bitmap' thus this has to be provided separately just like `metrics'.
Diffstat (limited to 'src')
-rw-r--r--src/base/ftglyph.c3
-rw-r--r--src/sfnt/ttsvg.c1
2 files changed, 4 insertions, 0 deletions
diff --git a/src/base/ftglyph.c b/src/base/ftglyph.c
index 095469500..22cf25b75 100644
--- a/src/base/ftglyph.c
+++ b/src/base/ftglyph.c
@@ -327,6 +327,7 @@
glyph->svg_document_length = doc_length;
glyph->glyph_index = slot->glyph_index;
glyph->metrics = document->metrics;
+ glyph->units_per_EM = document->units_per_EM;
/* copy the document into glyph */
FT_MEM_COPY( glyph->svg_document, document->svg_document, doc_length );
@@ -376,6 +377,7 @@
target->glyph_index = source->glyph_index;
target->svg_document_length = source->svg_document_length;
target->metrics = source->metrics;
+ target->units_per_EM = source->units_per_EM;
/* allocate space for the svg document */
target->svg_document = memory->alloc( memory,
@@ -410,6 +412,7 @@
document->svg_document = glyph->svg_document;
document->svg_document_length = glyph->svg_document_length;
document->metrics = glyph->metrics;
+ document->units_per_EM = glyph->units_per_EM;
slot->format = FT_GLYPH_FORMAT_SVG;
slot->other = document;
diff --git a/src/sfnt/ttsvg.c b/src/sfnt/ttsvg.c
index d9ad75a1d..798c9071a 100644
--- a/src/sfnt/ttsvg.c
+++ b/src/sfnt/ttsvg.c
@@ -232,6 +232,7 @@
svg_document->svg_document = doc_list;
svg_document->svg_document_length = doc_length;
svg_document->metrics = glyph->face->size->metrics;
+ svg_document->units_per_EM = glyph->face->units_per_EM;
glyph->other = svg_document;
glyph->metrics.horiAdvance *= ((float)glyph->face->size->metrics.x_ppem)/((float)glyph->face->units_per_EM) * 64.0;