summaryrefslogtreecommitdiff
path: root/source/tools/murun.c
diff options
context:
space:
mode:
authorTor Andersson <tor.andersson@artifex.com>2018-03-15 11:55:06 +0100
committerTor Andersson <tor.andersson@artifex.com>2018-03-16 14:51:41 +0100
commit1cd2046b3cce264a3d13481652868fd1c31537fc (patch)
tree8ba181113cc22f2ffe4ba1a3ed549926b747bc8c /source/tools/murun.c
parent2612c20b725319833caeef36ccf4240f34e0e24b (diff)
downloadmupdf-1cd2046b3cce264a3d13481652868fd1c31537fc.tar.xz
Add simple fonts with 8-bit greek and cyrillic encodings.
Use KOI8-U for Cyrillic, and ISO 8859-7 for Greek. Use with 'mutool create' using an extra argument to the %%Font directive: %%Font TmRmC Times-Roman Cyrillic BT /TmRmC 16 Tf 10 10 Td <fa c4 d2 c1 d7 d3 d4 d7 d5 ca d4 c5 21> Tj ET The alternatives are "Latin", "Greek", and "Cyrillic".
Diffstat (limited to 'source/tools/murun.c')
-rw-r--r--source/tools/murun.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/source/tools/murun.c b/source/tools/murun.c
index 911fcf35..8b9cd29d 100644
--- a/source/tools/murun.c
+++ b/source/tools/murun.c
@@ -3251,10 +3251,16 @@ static void ffi_PDFDocument_addSimpleFont(js_State *J)
fz_context *ctx = js_getcontext(J);
pdf_document *pdf = js_touserdata(J, 0, "pdf_document");
fz_font *font = js_touserdata(J, 1, "fz_font");
+ const char *encname = js_tostring(J, 2);
pdf_obj *ind = NULL;
+ int enc = PDF_SIMPLE_ENCODING_LATIN;
+
+ if (!strcmp(encname, "Latin")) enc = PDF_SIMPLE_ENCODING_LATIN;
+ else if (!strcmp(encname, "Greek")) enc = PDF_SIMPLE_ENCODING_GREEK;
+ else if (!strcmp(encname, "Cyrillic")) enc = PDF_SIMPLE_ENCODING_CYRILLIC;
fz_try(ctx)
- ind = pdf_add_simple_font(ctx, pdf, font);
+ ind = pdf_add_simple_font(ctx, pdf, font, enc);
fz_catch(ctx)
rethrow(J);
@@ -4697,7 +4703,7 @@ int murun_main(int argc, char **argv)
jsB_propfun(J, "PDFDocument.addObject", ffi_PDFDocument_addObject, 1);
jsB_propfun(J, "PDFDocument.addStream", ffi_PDFDocument_addStream, 2);
jsB_propfun(J, "PDFDocument.addRawStream", ffi_PDFDocument_addRawStream, 2);
- jsB_propfun(J, "PDFDocument.addSimpleFont", ffi_PDFDocument_addSimpleFont, 1);
+ jsB_propfun(J, "PDFDocument.addSimpleFont", ffi_PDFDocument_addSimpleFont, 2);
jsB_propfun(J, "PDFDocument.addCJKFont", ffi_PDFDocument_addCJKFont, 2);
jsB_propfun(J, "PDFDocument.addFont", ffi_PDFDocument_addFont, 1);
jsB_propfun(J, "PDFDocument.addImage", ffi_PDFDocument_addImage, 1);