From 1cd2046b3cce264a3d13481652868fd1c31537fc Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Thu, 15 Mar 2018 11:55:06 +0100 Subject: 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 Tj ET The alternatives are "Latin", "Greek", and "Cyrillic". --- include/mupdf/pdf/font.h | 8 +++++++- include/mupdf/pdf/resource.h | 1 + 2 files changed, 8 insertions(+), 1 deletion(-) (limited to 'include/mupdf/pdf') diff --git a/include/mupdf/pdf/font.h b/include/mupdf/pdf/font.h index 730d3459..dae52d3e 100644 --- a/include/mupdf/pdf/font.h +++ b/include/mupdf/pdf/font.h @@ -30,6 +30,12 @@ extern const char * const pdf_mac_expert[256]; extern const char * const pdf_win_ansi[256]; extern const char * const pdf_standard[256]; +extern const char * const pdf_glyph_name_from_koi8u[128]; +extern const char * const pdf_glyph_name_from_iso8859_7[128]; + +int pdf_cyrillic_from_unicode(int u); +int pdf_greek_from_unicode(int u); + typedef struct pdf_font_desc_s pdf_font_desc; typedef struct pdf_hmtx_s pdf_hmtx; typedef struct pdf_vmtx_s pdf_vmtx; @@ -123,7 +129,7 @@ float pdf_text_stride(fz_context *ctx, pdf_font_desc *fontdesc, float fontsize, void pdf_run_glyph(fz_context *ctx, pdf_document *doc, pdf_obj *resources, fz_buffer *contents, fz_device *dev, const fz_matrix *ctm, void *gstate, int nested_depth, fz_default_colorspaces *default_cs); -pdf_obj *pdf_add_simple_font(fz_context *ctx, pdf_document *doc, fz_font *font); +pdf_obj *pdf_add_simple_font(fz_context *ctx, pdf_document *doc, fz_font *font, int encoding); pdf_obj *pdf_add_cid_font(fz_context *ctx, pdf_document *doc, fz_font *font); pdf_obj *pdf_add_cjk_font(fz_context *ctx, pdf_document *doc, fz_font *font, int script); diff --git a/include/mupdf/pdf/resource.h b/include/mupdf/pdf/resource.h index 885a404e..05de95b2 100644 --- a/include/mupdf/pdf/resource.h +++ b/include/mupdf/pdf/resource.h @@ -18,6 +18,7 @@ void pdf_empty_store(fz_context *ctx, pdf_document *doc); */ enum { PDF_SIMPLE_FONT_RESOURCE=1, PDF_CID_FONT_RESOURCE=2, PDF_CJK_FONT_RESOURCE=3 }; +enum { PDF_SIMPLE_ENCODING_LATIN, PDF_SIMPLE_ENCODING_GREEK, PDF_SIMPLE_ENCODING_CYRILLIC }; pdf_obj *pdf_find_font_resource(fz_context *ctx, pdf_document *doc, int type, int encoding, fz_buffer *item, unsigned char md5[16]); pdf_obj *pdf_insert_font_resource(fz_context *ctx, pdf_document *doc, unsigned char md5[16], pdf_obj *obj); -- cgit v1.2.3