diff options
author | Tor Andersson <tor.andersson@artifex.com> | 2012-07-20 14:37:27 +0200 |
---|---|---|
committer | Tor Andersson <tor.andersson@artifex.com> | 2012-07-20 16:38:27 +0200 |
commit | 2bfb37fd1d0b0eecd001cb61ffcd15887c4603f7 (patch) | |
tree | 3a6ffb3c122913b23c7cda6d709faab226eaab1c /fitz | |
parent | f8aa12ebc18d84bd6b18bf266f128cf6738ca812 (diff) | |
download | mupdf-2bfb37fd1d0b0eecd001cb61ffcd15887c4603f7.tar.xz |
Pass original font name to fz_new_font from PDF interpreter.
Improves text device output when using substitute fonts.
Fixes bug #693019.
Diffstat (limited to 'fitz')
-rw-r--r-- | fitz/fitz-internal.h | 4 | ||||
-rw-r--r-- | fitz/res_font.c | 14 |
2 files changed, 12 insertions, 6 deletions
diff --git a/fitz/fitz-internal.h b/fitz/fitz-internal.h index 2670a335..20e9e8b0 100644 --- a/fitz/fitz-internal.h +++ b/fitz/fitz-internal.h @@ -732,8 +732,8 @@ void fz_drop_font_context(fz_context *ctx); fz_font *fz_new_type3_font(fz_context *ctx, char *name, fz_matrix matrix); -fz_font *fz_new_font_from_memory(fz_context *ctx, unsigned char *data, int len, int index, int use_glyph_bbox); -fz_font *fz_new_font_from_file(fz_context *ctx, char *path, int index, int use_glyph_bbox); +fz_font *fz_new_font_from_memory(fz_context *ctx, char *name, unsigned char *data, int len, int index, int use_glyph_bbox); +fz_font *fz_new_font_from_file(fz_context *ctx, char *name, char *path, int index, int use_glyph_bbox); fz_font *fz_keep_font(fz_context *ctx, fz_font *font); void fz_drop_font(fz_context *ctx, fz_font *font); diff --git a/fitz/res_font.c b/fitz/res_font.c index 568308be..a68a1ff1 100644 --- a/fitz/res_font.c +++ b/fitz/res_font.c @@ -254,7 +254,7 @@ fz_drop_freetype(fz_context *ctx) } fz_font * -fz_new_font_from_file(fz_context *ctx, char *path, int index, int use_glyph_bbox) +fz_new_font_from_file(fz_context *ctx, char *name, char *path, int index, int use_glyph_bbox) { FT_Face face; fz_font *font; @@ -271,7 +271,10 @@ fz_new_font_from_file(fz_context *ctx, char *path, int index, int use_glyph_bbox fz_throw(ctx, "freetype: cannot load font: %s", ft_error_string(fterr)); } - font = fz_new_font(ctx, face->family_name, use_glyph_bbox, face->num_glyphs); + if (!name) + name = face->family_name; + + font = fz_new_font(ctx, name, use_glyph_bbox, face->num_glyphs); font->ft_face = face; font->bbox.x0 = (float) face->bbox.xMin / face->units_per_EM; font->bbox.y0 = (float) face->bbox.yMin / face->units_per_EM; @@ -282,7 +285,7 @@ fz_new_font_from_file(fz_context *ctx, char *path, int index, int use_glyph_bbox } fz_font * -fz_new_font_from_memory(fz_context *ctx, unsigned char *data, int len, int index, int use_glyph_bbox) +fz_new_font_from_memory(fz_context *ctx, char *name, unsigned char *data, int len, int index, int use_glyph_bbox) { FT_Face face; fz_font *font; @@ -299,7 +302,10 @@ fz_new_font_from_memory(fz_context *ctx, unsigned char *data, int len, int index fz_throw(ctx, "freetype: cannot load font: %s", ft_error_string(fterr)); } - font = fz_new_font(ctx, face->family_name, use_glyph_bbox, face->num_glyphs); + if (!name) + name = face->family_name; + + font = fz_new_font(ctx, name, use_glyph_bbox, face->num_glyphs); font->ft_face = face; font->bbox.x0 = (float) face->bbox.xMin / face->units_per_EM; font->bbox.y0 = (float) face->bbox.yMin / face->units_per_EM; |