MuPDF X.Y.Z

pdf/font.h

Index

struct

enum

function

Font

enum pdf_font_descriptor_flags

enum pdf_font_descriptor_flags
{
        PDF_FD_FIXED_PITCH = 1 << 0,
        PDF_FD_SERIF = 1 << 1,
        PDF_FD_SYMBOLIC = 1 << 2,
        PDF_FD_SCRIPT = 1 << 3,
        PDF_FD_NONSYMBOLIC = 1 << 5,
        PDF_FD_ITALIC = 1 << 6,
        PDF_FD_ALL_CAP = 1 << 16,
        PDF_FD_SMALL_CAP = 1 << 17,
        PDF_FD_FORCE_BOLD = 1 << 18
}

function pdf_load_encoding

void
pdf_load_encoding (
        const char **estrings,
        const char *encoding
)

struct pdf_hmtx

struct pdf_hmtx
{
        unsigned short lo;
        unsigned short hi;
        int w;  /* type3 fonts can be big! */
}

struct pdf_vmtx

struct pdf_vmtx
{
        unsigned short lo;
        unsigned short hi;
        short x;
        short y;
        short w;
}

struct pdf_font_desc

struct pdf_font_desc
{
        fz_storable storable;
        size_t size;

        fz_font *font;

        /* FontDescriptor */
        int flags;
        float italic_angle;
        float ascent;
        float descent;
        float cap_height;
        float x_height;
        float missing_width;

        /* Encoding (CMap) */
        pdf_cmap *encoding;
        pdf_cmap *to_ttf_cmap;
        size_t cid_to_gid_len;
        unsigned short *cid_to_gid;

        /* ToUnicode */
        pdf_cmap *to_unicode;
        size_t cid_to_ucs_len;
        unsigned short *cid_to_ucs;

        /* Metrics (given in the PDF file) */
        int wmode;

        int hmtx_len, hmtx_cap;
        pdf_hmtx dhmtx;
        pdf_hmtx *hmtx;

        int vmtx_len, vmtx_cap;
        pdf_vmtx dvmtx;
        pdf_vmtx *vmtx;

        int is_embedded;
}

function pdf_set_font_wmode

void
pdf_set_font_wmode (
        fz_context *ctx,
        pdf_font_desc *font,
        int wmode
)

function pdf_set_default_hmtx

void
pdf_set_default_hmtx (
        fz_context *ctx,
        pdf_font_desc *font,
        int w
)

function pdf_set_default_vmtx

void
pdf_set_default_vmtx (
        fz_context *ctx,
        pdf_font_desc *font,
        int y,
        int w
)

function pdf_add_hmtx

void
pdf_add_hmtx (
        fz_context *ctx,
        pdf_font_desc *font,
        int lo,
        int hi,
        int w
)

function pdf_add_vmtx

void
pdf_add_vmtx (
        fz_context *ctx,
        pdf_font_desc *font,
        int lo,
        int hi,
        int x,
        int y,
        int w
)

function pdf_end_hmtx

void
pdf_end_hmtx (
        fz_context *ctx,
        pdf_font_desc *font
)

function pdf_end_vmtx

void
pdf_end_vmtx (
        fz_context *ctx,
        pdf_font_desc *font
)

function pdf_lookup_hmtx

pdf_hmtx
pdf_lookup_hmtx (
        fz_context *ctx,
        pdf_font_desc *font,
        int cid
)

function pdf_lookup_vmtx

pdf_vmtx
pdf_lookup_vmtx (
        fz_context *ctx,
        pdf_font_desc *font,
        int cid
)

function pdf_load_to_unicode

void
pdf_load_to_unicode (
        fz_context *ctx,
        pdf_document *doc,
        pdf_font_desc *font,
        const char **strings,
        char *collection,
        pdf_obj *cmapstm
)

function pdf_font_cid_to_gid

int
pdf_font_cid_to_gid (
        fz_context *ctx,
        pdf_font_desc *fontdesc,
        int cid
)

function pdf_clean_font_name

const char *
pdf_clean_font_name (
        const char *fontname
)

function pdf_lookup_substitute_font

const unsigned char *
pdf_lookup_substitute_font (
        fz_context *ctx,
        int mono,
        int serif,
        int bold,
        int italic,
        int *len
)

function pdf_load_type3_font

pdf_font_desc *
pdf_load_type3_font (
        fz_context *ctx,
        pdf_document *doc,
        pdf_resource_stack *rdb,
        pdf_obj *obj
)

function pdf_load_type3_glyphs

void
pdf_load_type3_glyphs (
        fz_context *ctx,
        pdf_document *doc,
        pdf_font_desc *fontdesc
)

function pdf_load_font

pdf_font_desc *
pdf_load_font (
        fz_context *ctx,
        pdf_document *doc,
        pdf_resource_stack *rdb,
        pdf_obj *obj
)

function pdf_load_hail_mary_font

pdf_font_desc *
pdf_load_hail_mary_font (
        fz_context *ctx,
        pdf_document *doc
)

function pdf_new_font_desc

pdf_font_desc *
pdf_new_font_desc (
        fz_context *ctx
)

function pdf_keep_font

pdf_font_desc *
pdf_keep_font (
        fz_context *ctx,
        pdf_font_desc *fontdesc
)

function pdf_drop_font

void
pdf_drop_font (
        fz_context *ctx,
        pdf_font_desc *font
)

function pdf_print_font

void
pdf_print_font (
        fz_context *ctx,
        fz_output *out,
        pdf_font_desc *fontdesc
)

function pdf_run_glyph

void
pdf_run_glyph (
        fz_context *ctx,
        pdf_document *doc,
        pdf_obj *resources,
        fz_buffer *contents,
        fz_device *dev,
        fz_matrix ctm,
        void *gstate,
        fz_default_colorspaces *default_cs,
        void *fill_gstate,
        void *stroke_gstate
)

function pdf_add_simple_font

pdf_obj *
pdf_add_simple_font (
        fz_context *ctx,
        pdf_document *doc,
        fz_font *font,
        int encoding
)

function pdf_add_cid_font

pdf_obj *
pdf_add_cid_font (
        fz_context *ctx,
        pdf_document *doc,
        fz_font *font
)

Creates CID font with Identity-H CMap and a ToUnicode CMap that is created by using the TTF cmap table “backwards” to go from the GID to a Unicode value.

We can possibly get width information that may have been embedded in the PDF /W array (or W2 if vertical text)

function pdf_add_cjk_font

pdf_obj *
pdf_add_cjk_font (
        fz_context *ctx,
        pdf_document *doc,
        fz_font *font,
        int script,
        int wmode,
        int serif
)

Add a non-embedded UTF16-encoded CID-font for the CJK scripts: CNS1, GB1, Japan1, or Korea1

function pdf_add_substitute_font

pdf_obj *
pdf_add_substitute_font (
        fz_context *ctx,
        pdf_document *doc,
        fz_font *font
)

Add a substitute font for any script.

function pdf_font_writing_supported

int
pdf_font_writing_supported (
        fz_context *ctx,
        fz_font *font
)

function pdf_subset_fonts

void
pdf_subset_fonts (
        fz_context *ctx,
        pdf_document *doc,
        int pages_len,
        const int *pages
)

Subset fonts by scanning the document to establish usage, and then rewriting the font files.

Calling with pages_len == 0 means do the whole document.

EXPERIMENTAL AND SUBJECT TO CHANGE.