summaryrefslogtreecommitdiff
path: root/source/tools/murun.c
diff options
context:
space:
mode:
Diffstat (limited to 'source/tools/murun.c')
-rw-r--r--source/tools/murun.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/source/tools/murun.c b/source/tools/murun.c
index 810b32ce..961d6a7a 100644
--- a/source/tools/murun.c
+++ b/source/tools/murun.c
@@ -3285,9 +3285,12 @@ static void ffi_PDFDocument_addSimpleFont(js_State *J)
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;
+ if (!strcmp(encname, "Latin") || !strcmp(encname, "Latn"))
+ enc = PDF_SIMPLE_ENCODING_LATIN;
+ else if (!strcmp(encname, "Greek") || !strcmp(encname, "Grek"))
+ enc = PDF_SIMPLE_ENCODING_GREEK;
+ else if (!strcmp(encname, "Cyrillic") || !strcmp(encname, "Cyrl"))
+ enc = PDF_SIMPLE_ENCODING_CYRILLIC;
fz_try(ctx)
ind = pdf_add_simple_font(ctx, pdf, font, enc);
@@ -3302,18 +3305,15 @@ static void ffi_PDFDocument_addCJKFont(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 *on = js_tostring(J, 2);
+ const char *lang = js_tostring(J, 2);
const char *wm = js_tostring(J, 3);
const char *ss = js_tostring(J, 4);
- int ord = FZ_ADOBE_JAPAN_1;
+ int ordering;
int wmode = 0;
int serif = 1;
pdf_obj *ind = NULL;
- if (!strcmp(on, "CNS1") || !strcmp(on, "TW") || !strcmp(on, "TC") || !strcmp(on, "Hant")) ord = FZ_ADOBE_CNS_1;
- else if (!strcmp(on, "GB1") || !strcmp(on, "CN") || !strcmp(on, "SC") || !strcmp(on, "Hans")) ord = FZ_ADOBE_GB_1;
- else if (!strcmp(on, "Korea1") || !strcmp(on, "KR") || !strcmp(on, "KO")) ord = FZ_ADOBE_KOREA_1;
- else if (!strcmp(on, "Japan1") || !strcmp(on, "JP") || !strcmp(on, "JA")) ord = FZ_ADOBE_JAPAN_1;
+ ordering = fz_lookup_cjk_ordering_by_language(lang);
if (!strcmp(wm, "V"))
wmode = 1;
@@ -3321,7 +3321,7 @@ static void ffi_PDFDocument_addCJKFont(js_State *J)
serif = 0;
fz_try(ctx)
- ind = pdf_add_cjk_font(ctx, pdf, font, ord, wmode, serif);
+ ind = pdf_add_cjk_font(ctx, pdf, font, ordering, wmode, serif);
fz_catch(ctx)
rethrow(J);