summaryrefslogtreecommitdiff
path: root/source/tools/pdfcreate.c
diff options
context:
space:
mode:
authorTor Andersson <tor.andersson@artifex.com>2018-03-29 22:25:09 +0200
committerTor Andersson <tor.andersson@artifex.com>2018-04-24 16:47:43 +0200
commit51b8205a513e86c62121a927a067632c1a933839 (patch)
treec2882a6c253a715bfc2ea72854c75350f0b2024b /source/tools/pdfcreate.c
parent67a7449fc1f186f318942b9c6b8d66d4458b7d87 (diff)
downloadmupdf-51b8205a513e86c62121a927a067632c1a933839.tar.xz
Remove need for namedump by using macros and preprocessor.
Add a PDF_NAME(Foo) macro that evaluates to a pdf_obj for /Foo. Use the C preprocessor to create the enum values and string table from one include file instead of using a separate code generator tool.
Diffstat (limited to 'source/tools/pdfcreate.c')
-rw-r--r--source/tools/pdfcreate.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/source/tools/pdfcreate.c b/source/tools/pdfcreate.c
index 74929fe9..33892b45 100644
--- a/source/tools/pdfcreate.c
+++ b/source/tools/pdfcreate.c
@@ -45,11 +45,11 @@ static void add_font_res(pdf_obj *resources, char *name, char *path, char *encna
else
font = fz_new_font_from_file(ctx, NULL, path, 0, 0);
- subres = pdf_dict_get(ctx, resources, PDF_NAME_Font);
+ subres = pdf_dict_get(ctx, resources, PDF_NAME(Font));
if (!subres)
{
subres = pdf_new_dict(ctx, doc, 10);
- pdf_dict_put_drop(ctx, resources, PDF_NAME_Font, subres);
+ pdf_dict_put_drop(ctx, resources, PDF_NAME(Font), subres);
}
enc = PDF_SIMPLE_ENCODING_LATIN;
@@ -83,11 +83,11 @@ static void add_cjkfont_res(pdf_obj *resources, char *name, char *on)
data = fz_lookup_cjk_font(ctx, ordering, 0, 0, &size, &index);
font = fz_new_font_from_memory(ctx, NULL, data, size, index, 0);
- subres = pdf_dict_get(ctx, resources, PDF_NAME_Font);
+ subres = pdf_dict_get(ctx, resources, PDF_NAME(Font));
if (!subres)
{
subres = pdf_new_dict(ctx, doc, 10);
- pdf_dict_put_drop(ctx, resources, PDF_NAME_Font, subres);
+ pdf_dict_put_drop(ctx, resources, PDF_NAME(Font), subres);
}
ref = pdf_add_cjk_font(ctx, doc, font, ordering);
@@ -104,11 +104,11 @@ static void add_image_res(pdf_obj *resources, char *name, char *path)
image = fz_new_image_from_file(ctx, path);
- subres = pdf_dict_get(ctx, resources, PDF_NAME_XObject);
+ subres = pdf_dict_get(ctx, resources, PDF_NAME(XObject));
if (!subres)
{
subres = pdf_new_dict(ctx, doc, 10);
- pdf_dict_put_drop(ctx, resources, PDF_NAME_XObject, subres);
+ pdf_dict_put_drop(ctx, resources, PDF_NAME(XObject), subres);
}
ref = pdf_add_image(ctx, doc, image, 0);