From 2612c20b725319833caeef36ccf4240f34e0e24b Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Wed, 14 Mar 2018 17:52:17 +0100 Subject: Add simple CJK font creation. Create a non-embedded CJK font using UTF-16 encoding. This can be used in mutool create like so: %%CJKFont Ming GB1 BT /Ming 10 Tf 100 100 Td <4F60 597D> Tj ET --- platform/java/mupdf_native.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'platform/java/mupdf_native.c') diff --git a/platform/java/mupdf_native.c b/platform/java/mupdf_native.c index 7235d50e..31f76d7b 100644 --- a/platform/java/mupdf_native.c +++ b/platform/java/mupdf_native.c @@ -7053,6 +7053,28 @@ FUN(PDFDocument_addFont)(JNIEnv *env, jobject self, jobject jfont) return to_PDFObject_safe_own(ctx, env, self, ind); } +JNIEXPORT jobject JNICALL +FUN(PDFDocument_addCJKFont)(JNIEnv *env, jobject self, jobject jfont, jint ordering) +{ + fz_context *ctx = get_context(env); + pdf_document *pdf = from_PDFDocument(env, self); + fz_font *font = from_Font(env, jfont); + pdf_obj *ind = NULL; + + if (!ctx || !pdf) return NULL; + if (!font) { jni_throw_arg(env, "font must not be null"); return NULL; } + + fz_try(ctx) + ind = pdf_add_cjk_font(ctx, pdf, font, ordering); + fz_catch(ctx) + { + jni_rethrow(env, ctx); + return NULL; + } + + return to_PDFObject_safe_own(ctx, env, self, ind); +} + JNIEXPORT jobject JNICALL FUN(PDFDocument_addSimpleFont)(JNIEnv *env, jobject self, jobject jfont) { -- cgit v1.2.3