summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Rasmussen <sebras@gmail.com>2016-06-27 07:07:32 +0200
committerTor Andersson <tor.andersson@artifex.com>2016-06-29 11:10:08 +0200
commit810aefd58b22b275ee48accf038f0ec0b48b9dca (patch)
treee0ed91f2d378f438f85e7dd1d649f9458673ed79
parentc161c5d5864384f42e540e8dcaed1c2cada63da7 (diff)
downloadmupdf-810aefd58b22b275ee48accf038f0ec0b48b9dca.tar.xz
Print font encoding in mutool info.
-rw-r--r--source/tools/pdfinfo.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/source/tools/pdfinfo.c b/source/tools/pdfinfo.c
index fcede5f7..9331a8bf 100644
--- a/source/tools/pdfinfo.c
+++ b/source/tools/pdfinfo.c
@@ -36,6 +36,7 @@ struct info
pdf_obj *obj;
pdf_obj *subtype;
pdf_obj *name;
+ pdf_obj *encoding;
} font;
struct {
pdf_obj *obj;
@@ -251,6 +252,7 @@ gatherfonts(fz_context *ctx, globals *glo, int page, pdf_obj *pageref, pdf_obj *
pdf_obj *subtype = NULL;
pdf_obj *basefont = NULL;
pdf_obj *name = NULL;
+ pdf_obj *encoding = NULL;
int k;
fontdict = pdf_dict_get_val(ctx, dict, i);
@@ -264,6 +266,9 @@ gatherfonts(fz_context *ctx, globals *glo, int page, pdf_obj *pageref, pdf_obj *
basefont = pdf_dict_get(ctx, fontdict, PDF_NAME_BaseFont);
if (!basefont || pdf_is_null(ctx, basefont))
name = pdf_dict_get(ctx, fontdict, PDF_NAME_Name);
+ encoding = pdf_dict_get(ctx, fontdict, PDF_NAME_Encoding);
+ if (pdf_is_dict(ctx, encoding))
+ encoding = pdf_dict_get(ctx, encoding, PDF_NAME_BaseEncoding);
for (k = 0; k < glo->fonts; k++)
if (!pdf_objcmp(ctx, glo->font[k].u.font.obj, fontdict))
@@ -281,6 +286,7 @@ gatherfonts(fz_context *ctx, globals *glo, int page, pdf_obj *pageref, pdf_obj *
glo->font[glo->fonts - 1].u.font.obj = fontdict;
glo->font[glo->fonts - 1].u.font.subtype = subtype;
glo->font[glo->fonts - 1].u.font.name = basefont ? basefont : name;
+ glo->font[glo->fonts - 1].u.font.encoding = encoding;
}
}
@@ -692,12 +698,14 @@ printinfo(fz_context *ctx, globals *glo, char *filename, int show, int page)
fz_printf(ctx, out, "Fonts (%d):\n", glo->fonts);
for (i = 0; i < glo->fonts; i++)
{
- fz_printf(ctx, out, PAGE_FMT_zu "%s '%s' (%d %d R)\n",
+ fz_printf(ctx, out, PAGE_FMT_zu "%s '%s' %s%s(%d %d R)\n",
glo->font[i].page,
pdf_to_num(ctx, glo->font[i].pageref),
pdf_to_gen(ctx, glo->font[i].pageref),
pdf_to_name(ctx, glo->font[i].u.font.subtype),
pdf_to_name(ctx, glo->font[i].u.font.name),
+ glo->font[i].u.font.encoding ? pdf_to_name(ctx, glo->font[i].u.font.encoding) : "",
+ glo->font[i].u.font.encoding ? " " : "",
pdf_to_num(ctx, glo->font[i].u.font.obj),
pdf_to_gen(ctx, glo->font[i].u.font.obj));
}