From 7b52cc13af4e85f1ca2deb6b6c77de9c95ea0dcf Mon Sep 17 00:00:00 2001 From: scuri Date: Fri, 17 Oct 2008 06:10:33 +0000 Subject: First commit - moving from LuaForge to SourceForge --- src/pdflib/font/ft_cid.c | 295 +++++ src/pdflib/font/ft_cid.h | 63 + src/pdflib/font/ft_corefont.c | 411 +++++++ src/pdflib/font/ft_corefont.h | 2642 +++++++++++++++++++++++++++++++++++++++++ src/pdflib/font/ft_font.c | 532 +++++++++ src/pdflib/font/ft_font.h | 267 +++++ src/pdflib/font/ft_generr.h | 109 ++ src/pdflib/font/ft_hostfont.c | 24 + src/pdflib/font/ft_pdffont.c | 18 + src/pdflib/font/ft_pdffont.h | 26 + src/pdflib/font/ft_truetype.c | 2310 +++++++++++++++++++++++++++++++++++ src/pdflib/font/ft_truetype.h | 558 +++++++++ src/pdflib/font/ft_type1.c | 39 + 13 files changed, 7294 insertions(+) create mode 100644 src/pdflib/font/ft_cid.c create mode 100644 src/pdflib/font/ft_cid.h create mode 100644 src/pdflib/font/ft_corefont.c create mode 100644 src/pdflib/font/ft_corefont.h create mode 100644 src/pdflib/font/ft_font.c create mode 100644 src/pdflib/font/ft_font.h create mode 100644 src/pdflib/font/ft_generr.h create mode 100644 src/pdflib/font/ft_hostfont.c create mode 100644 src/pdflib/font/ft_pdffont.c create mode 100644 src/pdflib/font/ft_pdffont.h create mode 100644 src/pdflib/font/ft_truetype.c create mode 100644 src/pdflib/font/ft_truetype.h create mode 100644 src/pdflib/font/ft_type1.c (limited to 'src/pdflib/font') diff --git a/src/pdflib/font/ft_cid.c b/src/pdflib/font/ft_cid.c new file mode 100644 index 0000000..aff9784 --- /dev/null +++ b/src/pdflib/font/ft_cid.c @@ -0,0 +1,295 @@ +/*---------------------------------------------------------------------------* + | PDFlib - A library for generating PDF on the fly | + +---------------------------------------------------------------------------+ + | Copyright (c) 1997-2006 Thomas Merz and PDFlib GmbH. All rights reserved. | + +---------------------------------------------------------------------------+ + | | + | This software is subject to the PDFlib license. It is NOT in the | + | public domain. Extended versions and commercial licenses are | + | available, please check http://www.pdflib.com. | + | | + *---------------------------------------------------------------------------*/ + +/* $Id: ft_cid.c,v 1.1 2008/10/17 06:10:43 scuri Exp $ + * + * FONT CID functions + * + */ + +#define FT_CID_C + +#include + +#include "ft_font.h" +#include "pc_file.h" + +/* ------------------------ Predefined CMaps ------------------------ */ + +/* Predefined CMaps and the corresponding character collection */ +static const fnt_cmap_info fnt_predefined_cmaps[] = +{ + { "83pv-RKSJ-H", cc_japanese, 0, PDC_1_3, 1, 1, 1, 1, 0}, + { "90ms-RKSJ-H", cc_japanese, 0, PDC_1_3, 2, 2, 2, 2, 0}, + { "90ms-RKSJ-V", cc_japanese, 0, PDC_1_3, 2, 2, 2, 2, 1}, + { "90msp-RKSJ-H", cc_japanese, 0, PDC_1_3, 2, 2, 2, 2, 0}, + { "90msp-RKSJ-V", cc_japanese, 0, PDC_1_3, 2, 2, 2, 2, 1}, + { "90pv-RKSJ-H", cc_japanese, 0, PDC_1_3, 1, 1, 1, 1, 0}, + { "Add-RKSJ-H", cc_japanese, 0, PDC_1_3, 1, 1, 1, 1, 0}, + { "Add-RKSJ-V", cc_japanese, 0, PDC_1_3, 1, 1, 1, 1, 1}, + { "EUC-H", cc_japanese, 0, PDC_1_3, 1, 1, 1, 1, 0}, + { "EUC-V", cc_japanese, 0, PDC_1_3, 1, 1, 1, 1, 1}, + { "Ext-RKSJ-H", cc_japanese, 0, PDC_1_3, 2, 2, 2, 2, 0}, + { "Ext-RKSJ-V", cc_japanese, 0, PDC_1_3, 2, 2, 2, 2, 1}, + { "H", cc_japanese, 0, PDC_1_3, 1, 1, 1, 1, 0}, + { "V", cc_japanese, 0, PDC_1_3, 1, 1, 1, 1, 1}, + { "UniJIS-UCS2-H", cc_japanese, 2, PDC_1_3, 2, 4, 4, 6, 0}, + { "UniJIS-UCS2-V", cc_japanese, 2, PDC_1_3, 2, 4, 4, 6, 1}, + { "UniJIS-UCS2-HW-H", cc_japanese,-2, PDC_1_3, 2, 4, 4, 6, 0}, + { "UniJIS-UCS2-HW-V", cc_japanese -2, PDC_1_3, 2, 4, 4, 6, 1}, + { "UniJIS-UTF16-H", cc_japanese, 2, PDC_1_5, 0, 0, 5, 6, 0}, + { "UniJIS-UTF16-V", cc_japanese, 2, PDC_1_5, 0, 0, 5, 6, 1}, + + { "GB-EUC-H", cc_simplified_chinese, 0, PDC_1_3, 0, 0, 0, 0, 0}, + { "GB-EUC-V", cc_simplified_chinese, 0, PDC_1_3, 0, 0, 0, 0, 1}, + { "GBpc-EUC-H", cc_simplified_chinese, 0, PDC_1_3, 0, 0, 0, 0, 0}, + { "GBpc-EUC-V", cc_simplified_chinese, 0, PDC_1_3, 0, 0, 0, 0, 1}, + { "GBK-EUC-H", cc_simplified_chinese, 0, PDC_1_3, 2, 2, 2, 2, 0}, + { "GBK-EUC-V", cc_simplified_chinese, 0, PDC_1_3, 2, 2, 2, 2, 1}, + { "GBKp-EUC-H", cc_simplified_chinese, 0, PDC_1_4, 0, 2, 2, 2, 0}, + { "GBKp-EUC-V", cc_simplified_chinese, 0, PDC_1_4, 0, 2, 2, 2, 1}, + { "GBK2K-H", cc_simplified_chinese, 0, PDC_1_4, 0, 4, 4, 4, 0}, + { "GBK2K-V", cc_simplified_chinese, 0, PDC_1_4, 0, 4, 4, 4, 1}, + { "UniGB-UCS2-H", cc_simplified_chinese, 2, PDC_1_3, 2, 4, 4, 4, 0}, + { "UniGB-UCS2-V", cc_simplified_chinese, 2, PDC_1_3, 2, 4, 4, 4, 1}, + { "UniGB-UTF16-H", cc_simplified_chinese, 2, PDC_1_5, 0, 0, 4, 4, 0}, + { "UniGB-UTF16-V", cc_simplified_chinese, 2, PDC_1_5, 0, 0, 4, 4, 1}, + + { "B5pc-H", cc_traditional_chinese, 0, PDC_1_3, 0, 0, 0, 0, 0}, + { "B5pc-V", cc_traditional_chinese, 0, PDC_1_3, 0, 0, 0, 0, 1}, + { "HKscs-B5-H", cc_traditional_chinese, 0, PDC_1_4, 0, 3, 3, 3, 0}, + { "HKscs-B5-V", cc_traditional_chinese, 0, PDC_1_4, 0, 3, 3, 3, 1}, + { "ETen-B5-H", cc_traditional_chinese, 0, PDC_1_3, 0, 0, 0, 0, 0}, + { "ETen-B5-V", cc_traditional_chinese, 0, PDC_1_3, 0, 0, 0, 0, 1}, + { "ETenms-B5-H", cc_traditional_chinese, 0, PDC_1_3, 0, 0, 0, 0, 0}, + { "ETenms-B5-V", cc_traditional_chinese, 0, PDC_1_3, 0, 0, 0, 0, 1}, + { "CNS-EUC-H", cc_traditional_chinese, 0, PDC_1_3, 0, 0, 0, 0, 0}, + { "CNS-EUC-V", cc_traditional_chinese, 0, PDC_1_3, 0, 0, 0, 0, 1}, + { "UniCNS-UCS2-H", cc_traditional_chinese, 2, PDC_1_3, 0, 3, 3, 3, 0}, + { "UniCNS-UCS2-V", cc_traditional_chinese, 2, PDC_1_3, 0, 3, 3, 3, 1}, + { "UniCNS-UTF16-H", cc_traditional_chinese, 2, PDC_1_5, 0, 0, 4, 4, 0}, + { "UniCNS-UTF16-V", cc_traditional_chinese, 2, PDC_1_5, 0, 0, 4, 4, 1}, + + { "KSC-EUC-H", cc_korean, 0, PDC_1_3, 0, 0, 0, 0, 0}, + { "KSC-EUC-V", cc_korean, 0, PDC_1_3, 0, 0, 0, 0, 1}, + { "KSCms-UHC-H", cc_korean, 0, PDC_1_3, 1, 1, 1, 1, 0}, + { "KSCms-UHC-V", cc_korean, 0, PDC_1_3, 1, 1, 1, 1, 1}, + { "KSCms-UHC-HW-H", cc_korean, 0, PDC_1_3, 1, 1, 1, 1, 0}, + { "KSCms-UHC-HW-V", cc_korean, 0, PDC_1_3, 1, 1, 1, 1, 1}, + { "KSCpc-EUC-H", cc_korean, 0, PDC_1_3, 0, 0, 0, 0, 0}, + { "UniKS-UCS2-H", cc_korean, 2, PDC_1_3, 1, 1, 1, 1, 0}, + { "UniKS-UCS2-V", cc_korean, 2, PDC_1_3, 1, 1, 1, 1, 1}, + { "UniKS-UTF16-H", cc_korean, 2, PDC_1_5, 0, 0, 2, 2, 0}, + { "UniKS-UTF16-V", cc_korean, 2, PDC_1_5, 0, 0, 2, 2, 1}, + + { "Identity-H", cc_identity, 0, PDC_1_3, 0, 0, 0, 0, 0}, + { "Identity-V", cc_identity, 0, PDC_1_3, 0, 0, 0, 0, 1}, + + { NULL, 0, 0, 0, 0, 0, 0, 0, 0}, +}; + +static int +fnt_get_predefined_cmap_slot(const char *cmapname) +{ + int slot; + + for (slot = 0; ; slot++) + { + if (fnt_predefined_cmaps[slot].name == NULL) + { + slot = -1; + break; + } + if (!strcmp(fnt_predefined_cmaps[slot].name, cmapname)) + break; + } + + return slot; +} + +int +fnt_get_predefined_cmap_info(const char *cmapname, fnt_cmap_info *cmapinfo) +{ + int slot; + + slot = fnt_get_predefined_cmap_slot(cmapname); + + if (slot == -1) + return cc_none; + + if (cmapinfo) + *cmapinfo = fnt_predefined_cmaps[slot]; + + return fnt_predefined_cmaps[slot].charcoll; +} + +static const pdc_keyconn fnt_charcoll_keylist[] = +{ + { "Japan1", cc_japanese}, + { "GB1", cc_simplified_chinese}, + { "CNS1", cc_traditional_chinese}, + { "Korea1", cc_korean}, + { "Identity", cc_identity}, + { "Unknown", cc_unknown}, + { NULL, 0} +}; + +const char * +fnt_get_ordering_cid(int charcoll) +{ + return pdc_get_keyword(charcoll, fnt_charcoll_keylist); +} + +int +fnt_get_charcoll(const char *ordering) +{ + int charcoll; + + charcoll = (int) pdc_get_keycode(ordering, fnt_charcoll_keylist); + + if (charcoll == PDC_KEY_NOTFOUND) + return cc_unknown; + else + return charcoll; +} + +int +fnt_get_supplement(fnt_cmap_info *cmapinfo, int compatibility) +{ + int retval = 0; + + switch(compatibility) + { + case PDC_1_3: + retval = cmapinfo->supplement13; + break; + + case PDC_1_4: + retval = cmapinfo->supplement14; + break; + + case PDC_1_5: + retval = cmapinfo->supplement15; + break; + + default: + case PDC_1_6: + retval = cmapinfo->supplement16; + break; + } + + return retval; +} + +/* + * See: + * Adobe Technical Note #5078 (Japanese1) + * Adobe Technical Note #5079 (GB1) + * Adobe Technical Note #5080 (CNS1) + * Adobe Technical Note #5093 (Korea1) + * + */ + +int +fnt_get_maxcid(int charcoll, int supplement) +{ + switch(charcoll) + { + case cc_japanese: + switch(supplement) + { + case 0: + return 8283; + + case 1: + return 8358; + + case 2: + return 8719; + + case 3: + return 9353; + + case 4: + return 15443; + + case 5: + return 20316; + + case 6: + default: + return 23057; + } + + case cc_simplified_chinese: + switch(supplement) + { + case 0: + return 7716; + + case 1: + return 9896; + + case 2: + return 22126; + + case 3: + return 22352; + + case 4: + default: + return 29063; + } + + case cc_traditional_chinese: + switch(supplement) + { + case 0: + return 14098; + + case 1: + return 17407; + + case 2: + return 17600; + + case 3: + return 18845; + + case 4: + default: + return 18964; + } + + case cc_korean: + switch(supplement) + { + case 0: + return 9332; + + case 1: + return 18154; + + case 2: + default: + return 18351; + } + + case cc_identity: + case cc_unknown: + return FNT_MAXCID; + + default: + return 0; + } +} + diff --git a/src/pdflib/font/ft_cid.h b/src/pdflib/font/ft_cid.h new file mode 100644 index 0000000..12187cb --- /dev/null +++ b/src/pdflib/font/ft_cid.h @@ -0,0 +1,63 @@ +/*---------------------------------------------------------------------------* + | PDFlib - A library for generating PDF on the fly | + +---------------------------------------------------------------------------+ + | Copyright (c) 1997-2006 Thomas Merz and PDFlib GmbH. All rights reserved. | + +---------------------------------------------------------------------------+ + | | + | This software is subject to the PDFlib license. It is NOT in the | + | public domain. Extended versions and commercial licenses are | + | available, please check http://www.pdflib.com. | + | | + *---------------------------------------------------------------------------*/ + +/* $Id: ft_cid.h,v 1.1 2008/10/17 06:10:43 scuri Exp $ + * + * CID data structures + * + */ + +#ifndef FT_CID_H +#define FT_CID_H + +typedef struct fnt_cmap_s fnt_cmap; +typedef struct fnt_cmap_info_s fnt_cmap_info; +typedef struct fnt_cmap_stack_s fnt_cmap_stack; + +#define FNT_MAXCID 30000 /* actual maximal CID */ + +#define FNT_CIDMETRIC_INCR 5 /* increment of table fnt_cid_width_arrays */ + +#define FNT_MAX_ILLBYTES 8 /* maximal number of illegal bytes */ + + +/* Predefined CMap info */ +struct fnt_cmap_info_s +{ + const char *name; /* CMap name */ + int charcoll; /* character collection */ + short codesize; /* =0: not UTF-16, =2: UTF-16, -2: HW UTF-16 */ + short compatibility; /* PDF version */ + short supplement13; /* supplement for PDF 1.3 */ + short supplement14; /* supplement for PDF 1.4 */ + short supplement15; /* supplement for PDF 1.5 */ + short supplement16; /* supplement for PDF 1.6 */ + short vertical; /* =1: vertical, =0: horizontal */ +}; + +/* internal CMap types */ +typedef enum +{ + cmap_code2cid, + cmap_cid2unicode, + cmap_code2unicode +} +fnt_cmaptype; + +int fnt_get_predefined_cmap_info(const char *cmapname, fnt_cmap_info *cmapinfo); +const char *fnt_get_ordering_cid(int charcoll); +int fnt_get_maxcid(int charcoll, int supplement); +int fnt_get_charcoll(const char *ordering); +int fnt_get_supplement(fnt_cmap_info *cmapinfo, int compatibility); + + +#endif /* FT_CID_H */ diff --git a/src/pdflib/font/ft_corefont.c b/src/pdflib/font/ft_corefont.c new file mode 100644 index 0000000..b368f67 --- /dev/null +++ b/src/pdflib/font/ft_corefont.c @@ -0,0 +1,411 @@ +/*---------------------------------------------------------------------------* + | PDFlib - A library for generating PDF on the fly | + +---------------------------------------------------------------------------+ + | Copyright (c) 1997-2006 Thomas Merz and PDFlib GmbH. All rights reserved. | + +---------------------------------------------------------------------------+ + | | + | This software is subject to the PDFlib license. It is NOT in the | + | public domain. Extended versions and commercial licenses are | + | available, please check http://www.pdflib.com. | + | | + *---------------------------------------------------------------------------*/ + +/* $Id: ft_corefont.c,v 1.1 2008/10/17 06:10:43 scuri Exp $ + * + * FONT in-core and basic font metric functions + * + */ + +#define FT_COREFONT_C + +#include "ft_font.h" +#include "ft_corefont.h" + + +/* ------------------------------ core fonts ------------------------------ */ + +/* PDF basic font names */ +static const char *fnt_base14_names[] = +{ + "Courier", + "Courier-Bold", + "Courier-Oblique", + "Courier-BoldOblique", + "Helvetica", + "Helvetica-Bold", + "Helvetica-Oblique", + "Helvetica-BoldOblique", + "Symbol", + "Times-Roman", + "Times-Bold", + "Times-Italic", + "Times-BoldItalic", + "ZapfDingbats" +}; + +pdc_bool +fnt_is_standard_font(const char *fontname) +{ + int slot; + + for (slot = 0; + slot < (int)(sizeof(fnt_base14_names) / sizeof(fnt_base14_names[0])); + slot++) + { + if (!strcmp(fnt_base14_names[slot], fontname)) + return pdc_true; + } + + return pdc_false; +} + +/* abbreviations of PDF basic font names for form fields */ +static const char *fnt_abb_base14_names[] = +{ + "Cour", + "CoBo", + "CoOb", + "CoBO", + "Helv", + "HeBo", + "HeOb", + "HeBO", + "Symb", + "TiRo", + "TiBo", + "TiIt", + "TiBI", + "ZaDb" +}; + +const char * +fnt_get_abb_std_fontname(const char *fontname) +{ + int slot; + + for (slot = 0; + slot < (int)(sizeof(fnt_base14_names) / sizeof(fnt_base14_names[0])); + slot++) + { + if (!strcmp(fnt_base14_names[slot], fontname)) + return fnt_abb_base14_names[slot]; + } + + return NULL; +} + + +/* Basic fonts core metrics */ +static const fnt_font_metric *fnt_base_font_metrics[] = +{ + &fnt_font_metric_01, + &fnt_font_metric_02, + &fnt_font_metric_03, + &fnt_font_metric_04, + &fnt_font_metric_05, + &fnt_font_metric_06, + &fnt_font_metric_07, + &fnt_font_metric_08, + &fnt_font_metric_09, + &fnt_font_metric_10, + &fnt_font_metric_11, + &fnt_font_metric_12, + &fnt_font_metric_13, + &fnt_font_metric_14 +}; + +const fnt_font_metric * +fnt_get_core_metric(const char *fontname) +{ +#ifdef PDF_BUILTINMETRIC_SUPPORTED + const fnt_font_metric *metric = NULL; + int slot; + + for (slot = 0; + slot < (int)(sizeof(fnt_base_font_metrics) / + sizeof(fnt_base_font_metrics[0])); + slot++) + { + metric = fnt_base_font_metrics[slot]; + if (!strcmp(metric->name, fontname)) + return metric; + } +#endif /* PDF_BUILTINMETRIC_SUPPORTED */ + return(NULL); +} + + +/* --------------------- Pre-installed CID fonts ---------------------- */ + +int +fnt_get_preinstalled_cidfont(const char *fontname, + const fnt_font_metric **fontmetric) +{ + int slot; + + for (slot = 0; slot < FNT_NUM_OF_CIDFONTS; slot++) + { + if (!strcmp(fnt_cid_metrics[slot].name, fontname)) + { + if (fontmetric) + *fontmetric = &fnt_cid_metrics[slot]; + return fnt_cid_metrics[slot].charcoll; + } + } + + if (fontmetric) + *fontmetric = NULL; + + return (int) cc_none; +} + +/* abbreviations of PDF basic CJK font names for form fields */ +static const char *fnt_abb_cjk_names[] = +{ + "KaGo", + "KaMi", + "HyGo", + "HySm", + "MHei", + "MSun", + "STSo", +}; + +const char * +fnt_get_abb_cjk_fontname(const char *fontname) +{ + int slot; + + for (slot = 0; + slot < (int)(sizeof(fnt_abb_cjk_names) / sizeof(fnt_abb_cjk_names[0])); + slot++) + { + if (!strcmp(fnt_cid_metrics[slot].name, fontname)) + return fnt_abb_cjk_names[slot]; + } + + return NULL; +} + +#ifdef PDF_CJKFONTWIDTHS_SUPPORTED + +const char ** +fnt_get_cid_widths_array(pdc_core *pdc, fnt_font *font) +{ + int slot, slotm; + + (void) pdc; + + /* search for font name */ + slotm = 100; + for (slot = 0; slot < slotm; slot += FNT_CIDMETRIC_INCR) + { + if (!strcmp(fnt_cid_width_arrays[slot], font->name)) + break; + } + + return &fnt_cid_width_arrays[slot + 1]; /* skip font name */ +} + +static void +fnt_parse_cid_widths(pdc_core *pdc, fnt_font *font) +{ + static const char fn[] = "fnt_parse_cid_widths"; + int slot, slota, slotm; + const char *chunk; + char **strlist = NULL, **sstrlist = NULL, *str; + int cid = 0, cidfirst, cidlast, width; + int il, is, ns, nss = 0; + int wformat = 2; + + /* search for font name */ + slotm = 100; + for (slot = 0; slot < slotm; slot += FNT_CIDMETRIC_INCR) + { + if (!strcmp(fnt_cid_width_arrays[slot], font->name)) + break; + } + if (slot == slotm) + return; + + /* we take the maximum */ + font->m.numwidths = fnt_get_maxcid(font->m.charcoll, -1) + 1; + font->m.widths = (int *) pdc_malloc(pdc, + font->m.numwidths * sizeof(int), fn); + + slota = slot + 1; /* skip font name */ + slotm = slot + FNT_CIDMETRIC_INCR; + for (slot = slota; slot < slotm; slot++) + { + chunk = fnt_cid_width_arrays[slot]; + + ns = pdc_split_stringlist(pdc, chunk, " \n", 0, &strlist); + for (is = 0; is < ns; is++) + { + str = strlist[is]; + + /* check for next format 1 chunk */ + if (wformat == 2 && strchr(str, '[')) + { + nss = pdc_split_stringlist(pdc, str, " [", 0, &sstrlist); + str = sstrlist[0]; + pdc_str2integer(str, 0, &cidfirst); + for (; cid < cidfirst; cid++) + font->m.widths[cid] = FNT_DEFAULT_CIDWIDTH; + str = sstrlist[1]; + wformat = 1; + } + + /* format 1: cid [width_1 width_2 ... width_n] */ + if (wformat == 1) + { + il = (int) strlen(str) - 1; + if (str[il] == ']') + { + str[il] = 0; + wformat = 2; + } + + pdc_str2integer(str, 0, &font->m.widths[cid]); + cid++; + + if (nss) + { + pdc_cleanup_stringlist(pdc, sstrlist); + nss = 0; + } + } + else + { + /* format 2: cid_first cid_last width */ + pdc_str2integer(str, 0, &cidfirst); + is++; + str = strlist[is]; + pdc_str2integer(str, 0, &cidlast); + is++; + str = strlist[is]; + pdc_str2integer(str, 0, &width); + + for (; cid < cidfirst; cid++) + font->m.widths[cid] = FNT_DEFAULT_CIDWIDTH; + for (; cid <= cidlast; cid++) + font->m.widths[cid] = width; + } + } + + pdc_cleanup_stringlist(pdc, strlist); + } + + for (; cid < font->m.numwidths; cid++) + font->m.widths[cid] = FNT_DEFAULT_CIDWIDTH; + + if (pdc_logg_is_enabled(pdc, 5, trc_font)) + { + for (cid = 0; cid < font->m.numwidths; cid++) + pdc_logg(pdc, "\t\t\tCID width[%d]: %d\n", + cid, font->m.widths[cid]); + } +} + +#endif /* PDF_CJKFONTWIDTHS_SUPPORTED */ + + +/* ------------------------- general functions -------------------------- */ + +/* + * Fill font metric struct from core metric struct + */ +void +fnt_fill_font_metric(pdc_core *pdc, fnt_font *font, pdc_bool kerning, + const fnt_font_metric *metric) +{ + static const char fn[] = "fnt_fill_font_metric"; + + (void) kerning; + + /* Fill font metric struct. Font struct must be initialized */ + font->m = *metric; + font->m.charcoll = abs(font->m.charcoll); + font->m.name = pdc_strdup(pdc, metric->name); + font->name = pdc_strdup(pdc, metric->name); + + /* Fill glyph widths array (double mapping Unicode <-> code <-> width) */ + if (font->m.numglwidths) + { + font->m.glw = (fnt_glyphwidth *) pdc_calloc(pdc, + metric->numglwidths * sizeof(fnt_glyphwidth), fn); + memcpy(font->m.glw, metric->glw, + metric->numglwidths * sizeof(fnt_glyphwidth)); + } + + /* Fill glyph width array (mapping Unicode interval <-> width) */ + if (metric->numinters) + { + /* We must convert */ + if (font->m.type == fnt_Type1) + { + int i, j, iw, iwe; + pdc_ushort uv; + + for (i = 0; i < metric->numinters; i++) + { + if (i && metric->ciw[i-1].width != 0) + font->m.numglwidths += metric->ciw[i].startcode - + metric->ciw[i-1].startcode; + } + font->m.glw = (fnt_glyphwidth *) pdc_calloc(pdc, + font->m.numglwidths * sizeof(fnt_glyphwidth), fn); + + j = 0; + iw = 0; + for (i = 0; i < metric->numinters; i++) + { + if (i && metric->ciw[j].width != 0) + { + uv = metric->ciw[j].startcode; + iwe = iw + metric->ciw[i].startcode - uv; + for (; iw < iwe; iw++) + { + font->m.glw[iw].unicode = uv; + font->m.glw[iw].width = metric->ciw[j].width; + uv++; + } + } + j = i; + } + font->m.numinters = 0; + font->m.ciw = NULL; + } + else + { + font->m.ciw = (fnt_interwidth *) pdc_calloc(pdc, + font->m.numinters * sizeof(fnt_interwidth), fn); + memcpy(font->m.ciw, metric->ciw, + metric->numinters * sizeof(fnt_interwidth)); + } + } + +#ifdef PDF_CJKFONTWIDTHS_SUPPORTED + /* Fill glyph width array (mapping CID -> width) */ + if (font->m.type == fnt_CIDFontType0) + fnt_parse_cid_widths(pdc, font); +#endif /* PDF_CJKFONTWIDTHS_SUPPORTED */ + + /* Number of glyphs */ + if (font->m.type == fnt_Type1) + font->numglyphs = font->m.numglwidths; + + + /* font weight */ + font->weight = fnt_stemv2weight(font->m.StdVW); + + /* standard Adobe font */ + font->isstdfont = pdc_true; + + /* symbol font */ + if (!(font->m.flags & FNT_SYMBOL)) + font->issymbfont = pdc_false; +} + + + diff --git a/src/pdflib/font/ft_corefont.h b/src/pdflib/font/ft_corefont.h new file mode 100644 index 0000000..526212e --- /dev/null +++ b/src/pdflib/font/ft_corefont.h @@ -0,0 +1,2642 @@ +/*---------------------------------------------------------------------------* + | PDFlib - A library for generating PDF on the fly | + +---------------------------------------------------------------------------+ + | Copyright (c) 1997-2006 Thomas Merz and PDFlib GmbH. All rights reserved. | + +---------------------------------------------------------------------------+ + | | + | This software is subject to the PDFlib license. It is NOT in the | + | public domain. Extended versions and commercial licenses are | + | available, please check http://www.pdflib.com. | + | | + *---------------------------------------------------------------------------*/ + +/* $Id: ft_corefont.h,v 1.1 2008/10/17 06:10:43 scuri Exp $ + * + * This file contains the metric for the base and + * pre-installed CID fonts of PDF + * + * ft_corefont.h is included only in ft_corefont.c. + * + */ + +#ifndef FT_COREMETR_H +#define FT_COREMETR_H + +#ifdef PDF_BUILTINMETRIC_SUPPORTED + +/* -------- Generated from CourierStd.otf -------- */ + +static fnt_interwidth fnt_glyph_width_01[203] = +{ + {0x0000, 600}, {0x0001, 0}, {0x0020, 600}, {0x007F, 0}, + {0x00A0, 600}, {0x0100, 0}, {0x0111, 600}, {0x0112, 0}, + {0x0126, 600}, {0x0128, 0}, {0x0131, 600}, {0x0134, 0}, + {0x0138, 600}, {0x0139, 0}, {0x013F, 600}, {0x0143, 0}, + {0x0149, 600}, {0x014C, 0}, {0x0152, 600}, {0x0154, 0}, + {0x0160, 600}, {0x0162, 0}, {0x0166, 600}, {0x0168, 0}, + {0x0178, 600}, {0x0179, 0}, {0x017D, 600}, {0x017F, 0}, + {0x0192, 600}, {0x0193, 0}, {0x02C6, 600}, {0x02C8, 0}, + {0x02C9, 600}, {0x02CA, 0}, {0x02D8, 600}, {0x02DE, 0}, + {0x0393, 600}, {0x0394, 0}, {0x0398, 600}, {0x0399, 0}, + {0x03A6, 600}, {0x03A7, 0}, {0x03A9, 600}, {0x03AA, 0}, + {0x03B1, 600}, {0x03B2, 0}, {0x03B4, 600}, {0x03B6, 0}, + {0x03BC, 600}, {0x03BD, 0}, {0x03C0, 600}, {0x03C1, 0}, + {0x03C3, 600}, {0x03C5, 0}, {0x03D5, 600}, {0x03D6, 0}, + {0x2013, 600}, {0x2015, 0}, {0x2017, 600}, {0x201F, 0}, + {0x2020, 600}, {0x2023, 0}, {0x2026, 600}, {0x2027, 0}, + {0x2030, 600}, {0x2031, 0}, {0x2039, 600}, {0x203B, 0}, + {0x203C, 600}, {0x203D, 0}, {0x203E, 600}, {0x203F, 0}, + {0x2044, 600}, {0x2045, 0}, {0x207F, 600}, {0x2080, 0}, + {0x20A3, 600}, {0x20A4, 0}, {0x20A7, 600}, {0x20A8, 0}, + {0x20AC, 600}, {0x20AD, 0}, {0x2113, 600}, {0x2114, 0}, + {0x2122, 600}, {0x2123, 0}, {0x2126, 600}, {0x2127, 0}, + {0x212E, 600}, {0x212F, 0}, {0x215B, 600}, {0x215F, 0}, + {0x2190, 600}, {0x2196, 0}, {0x21A8, 600}, {0x21A9, 0}, + {0x2202, 600}, {0x2203, 0}, {0x2206, 600}, {0x2207, 0}, + {0x220F, 600}, {0x2210, 0}, {0x2211, 600}, {0x2213, 0}, + {0x2215, 600}, {0x2216, 0}, {0x2219, 600}, {0x221B, 0}, + {0x221E, 600}, {0x221F, 0}, {0x2229, 600}, {0x222A, 0}, + {0x222B, 600}, {0x222C, 0}, {0x2248, 600}, {0x2249, 0}, + {0x2260, 600}, {0x2262, 0}, {0x2264, 600}, {0x2266, 0}, + {0x22C5, 600}, {0x22C6, 0}, {0x2302, 600}, {0x2303, 0}, + {0x2304, 600}, {0x2305, 0}, {0x2310, 600}, {0x2311, 0}, + {0x2319, 600}, {0x231A, 0}, {0x2320, 600}, {0x2322, 0}, + {0x2500, 600}, {0x2501, 0}, {0x2502, 600}, {0x2503, 0}, + {0x250C, 600}, {0x250D, 0}, {0x2510, 600}, {0x2511, 0}, + {0x2514, 600}, {0x2515, 0}, {0x2518, 600}, {0x2519, 0}, + {0x251C, 600}, {0x251D, 0}, {0x2524, 600}, {0x2525, 0}, + {0x252C, 600}, {0x252D, 0}, {0x2534, 600}, {0x2535, 0}, + {0x253C, 600}, {0x253D, 0}, {0x2550, 600}, {0x256D, 0}, + {0x2580, 600}, {0x2581, 0}, {0x2584, 600}, {0x2585, 0}, + {0x2588, 600}, {0x2589, 0}, {0x258C, 600}, {0x258D, 0}, + {0x2590, 600}, {0x2594, 0}, {0x25A0, 600}, {0x25A1, 0}, + {0x25B2, 600}, {0x25B3, 0}, {0x25B6, 600}, {0x25B7, 0}, + {0x25BC, 600}, {0x25BD, 0}, {0x25C0, 600}, {0x25C1, 0}, + {0x25CA, 600}, {0x25CC, 0}, {0x25D8, 600}, {0x25DA, 0}, + {0x263A, 600}, {0x263D, 0}, {0x2640, 600}, {0x2641, 0}, + {0x2642, 600}, {0x2643, 0}, {0x2660, 600}, {0x2661, 0}, + {0x2662, 600}, {0x2664, 0}, {0x2665, 600}, {0x2667, 0}, + {0x266A, 600}, {0x266B, 0}, {0x266C, 600}, {0x266D, 0}, + {0xE000, 600}, {0xE002, 0}, {0xF638, 600}, {0xF639, 0}, + {0xFB01, 600}, {0xFB03, 0}, {0xFFFF, 0} +}; + +static const fnt_font_metric fnt_font_metric_01 = +{ + "Courier", + 35L, + fnt_Type1, + cc_none, + 0, + 1, + -56, + -250, + 678, + 857, + -198, + 52, + 573, + 435, + 627, + -373, + 109, + 0, + + FNT_DEFAULT_WIDTH, + 0, + NULL, + 203, + fnt_glyph_width_01, + 0, + NULL, + +}; + +/* -------- Generated from CourierStd-Bold.otf -------- */ + +static fnt_interwidth fnt_glyph_width_02[203] = +{ + {0x0000, 600}, {0x0001, 0}, {0x0020, 600}, {0x007F, 0}, + {0x00A0, 600}, {0x0100, 0}, {0x0111, 600}, {0x0112, 0}, + {0x0126, 600}, {0x0128, 0}, {0x0131, 600}, {0x0134, 0}, + {0x0138, 600}, {0x0139, 0}, {0x013F, 600}, {0x0143, 0}, + {0x0149, 600}, {0x014C, 0}, {0x0152, 600}, {0x0154, 0}, + {0x0160, 600}, {0x0162, 0}, {0x0166, 600}, {0x0168, 0}, + {0x0178, 600}, {0x0179, 0}, {0x017D, 600}, {0x017F, 0}, + {0x0192, 600}, {0x0193, 0}, {0x02C6, 600}, {0x02C8, 0}, + {0x02C9, 600}, {0x02CA, 0}, {0x02D8, 600}, {0x02DE, 0}, + {0x0393, 600}, {0x0394, 0}, {0x0398, 600}, {0x0399, 0}, + {0x03A6, 600}, {0x03A7, 0}, {0x03A9, 600}, {0x03AA, 0}, + {0x03B1, 600}, {0x03B2, 0}, {0x03B4, 600}, {0x03B6, 0}, + {0x03BC, 600}, {0x03BD, 0}, {0x03C0, 600}, {0x03C1, 0}, + {0x03C3, 600}, {0x03C5, 0}, {0x03D5, 600}, {0x03D6, 0}, + {0x2013, 600}, {0x2015, 0}, {0x2017, 600}, {0x201F, 0}, + {0x2020, 600}, {0x2023, 0}, {0x2026, 600}, {0x2027, 0}, + {0x2030, 600}, {0x2031, 0}, {0x2039, 600}, {0x203B, 0}, + {0x203C, 600}, {0x203D, 0}, {0x203E, 600}, {0x203F, 0}, + {0x2044, 600}, {0x2045, 0}, {0x207F, 600}, {0x2080, 0}, + {0x20A3, 600}, {0x20A4, 0}, {0x20A7, 600}, {0x20A8, 0}, + {0x20AC, 600}, {0x20AD, 0}, {0x2113, 600}, {0x2114, 0}, + {0x2122, 600}, {0x2123, 0}, {0x2126, 600}, {0x2127, 0}, + {0x212E, 600}, {0x212F, 0}, {0x215B, 600}, {0x215F, 0}, + {0x2190, 600}, {0x2196, 0}, {0x21A8, 600}, {0x21A9, 0}, + {0x2202, 600}, {0x2203, 0}, {0x2206, 600}, {0x2207, 0}, + {0x220F, 600}, {0x2210, 0}, {0x2211, 600}, {0x2213, 0}, + {0x2215, 600}, {0x2216, 0}, {0x2219, 600}, {0x221B, 0}, + {0x221E, 600}, {0x221F, 0}, {0x2229, 600}, {0x222A, 0}, + {0x222B, 600}, {0x222C, 0}, {0x2248, 600}, {0x2249, 0}, + {0x2260, 600}, {0x2262, 0}, {0x2264, 600}, {0x2266, 0}, + {0x22C5, 600}, {0x22C6, 0}, {0x2302, 600}, {0x2303, 0}, + {0x2304, 600}, {0x2305, 0}, {0x2310, 600}, {0x2311, 0}, + {0x2319, 600}, {0x231A, 0}, {0x2320, 600}, {0x2322, 0}, + {0x2500, 600}, {0x2501, 0}, {0x2502, 600}, {0x2503, 0}, + {0x250C, 600}, {0x250D, 0}, {0x2510, 600}, {0x2511, 0}, + {0x2514, 600}, {0x2515, 0}, {0x2518, 600}, {0x2519, 0}, + {0x251C, 600}, {0x251D, 0}, {0x2524, 600}, {0x2525, 0}, + {0x252C, 600}, {0x252D, 0}, {0x2534, 600}, {0x2535, 0}, + {0x253C, 600}, {0x253D, 0}, {0x2550, 600}, {0x256D, 0}, + {0x2580, 600}, {0x2581, 0}, {0x2584, 600}, {0x2585, 0}, + {0x2588, 600}, {0x2589, 0}, {0x258C, 600}, {0x258D, 0}, + {0x2590, 600}, {0x2594, 0}, {0x25A0, 600}, {0x25A1, 0}, + {0x25B2, 600}, {0x25B3, 0}, {0x25B6, 600}, {0x25B7, 0}, + {0x25BC, 600}, {0x25BD, 0}, {0x25C0, 600}, {0x25C1, 0}, + {0x25CA, 600}, {0x25CC, 0}, {0x25D8, 600}, {0x25DA, 0}, + {0x263A, 600}, {0x263D, 0}, {0x2640, 600}, {0x2641, 0}, + {0x2642, 600}, {0x2643, 0}, {0x2660, 600}, {0x2661, 0}, + {0x2662, 600}, {0x2664, 0}, {0x2665, 600}, {0x2667, 0}, + {0x266A, 600}, {0x266B, 0}, {0x266C, 600}, {0x266D, 0}, + {0xE000, 600}, {0xE002, 0}, {0xF638, 600}, {0xF639, 0}, + {0xFB01, 600}, {0xFB03, 0}, {0xFFFF, 0} +}; + +static const fnt_font_metric fnt_font_metric_02 = +{ + "Courier-Bold", + 262179L, + fnt_Type1, + cc_none, + 0, + 1, + -88, + -250, + 697, + 854, + -198, + 52, + 573, + 435, + 627, + -373, + 166, + 0, + + FNT_DEFAULT_WIDTH, + 0, + NULL, + 203, + fnt_glyph_width_02, + 0, + NULL, + +}; + +/* -------- Generated from CourierStd-Oblique.otf -------- */ + +static fnt_interwidth fnt_glyph_width_03[203] = +{ + {0x0000, 600}, {0x0001, 0}, {0x0020, 600}, {0x007F, 0}, + {0x00A0, 600}, {0x0100, 0}, {0x0111, 600}, {0x0112, 0}, + {0x0126, 600}, {0x0128, 0}, {0x0131, 600}, {0x0134, 0}, + {0x0138, 600}, {0x0139, 0}, {0x013F, 600}, {0x0143, 0}, + {0x0149, 600}, {0x014C, 0}, {0x0152, 600}, {0x0154, 0}, + {0x0160, 600}, {0x0162, 0}, {0x0166, 600}, {0x0168, 0}, + {0x0178, 600}, {0x0179, 0}, {0x017D, 600}, {0x017F, 0}, + {0x0192, 600}, {0x0193, 0}, {0x02C6, 600}, {0x02C8, 0}, + {0x02C9, 600}, {0x02CA, 0}, {0x02D8, 600}, {0x02DE, 0}, + {0x0393, 600}, {0x0394, 0}, {0x0398, 600}, {0x0399, 0}, + {0x03A6, 600}, {0x03A7, 0}, {0x03A9, 600}, {0x03AA, 0}, + {0x03B1, 600}, {0x03B2, 0}, {0x03B4, 600}, {0x03B6, 0}, + {0x03BC, 600}, {0x03BD, 0}, {0x03C0, 600}, {0x03C1, 0}, + {0x03C3, 600}, {0x03C5, 0}, {0x03D5, 600}, {0x03D6, 0}, + {0x2013, 600}, {0x2015, 0}, {0x2017, 600}, {0x201F, 0}, + {0x2020, 600}, {0x2023, 0}, {0x2026, 600}, {0x2027, 0}, + {0x2030, 600}, {0x2031, 0}, {0x2039, 600}, {0x203B, 0}, + {0x203C, 600}, {0x203D, 0}, {0x203E, 600}, {0x203F, 0}, + {0x2044, 600}, {0x2045, 0}, {0x207F, 600}, {0x2080, 0}, + {0x20A3, 600}, {0x20A4, 0}, {0x20A7, 600}, {0x20A8, 0}, + {0x20AC, 600}, {0x20AD, 0}, {0x2113, 600}, {0x2114, 0}, + {0x2122, 600}, {0x2123, 0}, {0x2126, 600}, {0x2127, 0}, + {0x212E, 600}, {0x212F, 0}, {0x215B, 600}, {0x215F, 0}, + {0x2190, 600}, {0x2196, 0}, {0x21A8, 600}, {0x21A9, 0}, + {0x2202, 600}, {0x2203, 0}, {0x2206, 600}, {0x2207, 0}, + {0x220F, 600}, {0x2210, 0}, {0x2211, 600}, {0x2213, 0}, + {0x2215, 600}, {0x2216, 0}, {0x2219, 600}, {0x221B, 0}, + {0x221E, 600}, {0x221F, 0}, {0x2229, 600}, {0x222A, 0}, + {0x222B, 600}, {0x222C, 0}, {0x2248, 600}, {0x2249, 0}, + {0x2260, 600}, {0x2262, 0}, {0x2264, 600}, {0x2266, 0}, + {0x22C5, 600}, {0x22C6, 0}, {0x2302, 600}, {0x2303, 0}, + {0x2304, 600}, {0x2305, 0}, {0x2310, 600}, {0x2311, 0}, + {0x2319, 600}, {0x231A, 0}, {0x2320, 600}, {0x2322, 0}, + {0x2500, 600}, {0x2501, 0}, {0x2502, 600}, {0x2503, 0}, + {0x250C, 600}, {0x250D, 0}, {0x2510, 600}, {0x2511, 0}, + {0x2514, 600}, {0x2515, 0}, {0x2518, 600}, {0x2519, 0}, + {0x251C, 600}, {0x251D, 0}, {0x2524, 600}, {0x2525, 0}, + {0x252C, 600}, {0x252D, 0}, {0x2534, 600}, {0x2535, 0}, + {0x253C, 600}, {0x253D, 0}, {0x2550, 600}, {0x256D, 0}, + {0x2580, 600}, {0x2581, 0}, {0x2584, 600}, {0x2585, 0}, + {0x2588, 600}, {0x2589, 0}, {0x258C, 600}, {0x258D, 0}, + {0x2590, 600}, {0x2594, 0}, {0x25A0, 600}, {0x25A1, 0}, + {0x25B2, 600}, {0x25B3, 0}, {0x25B6, 600}, {0x25B7, 0}, + {0x25BC, 600}, {0x25BD, 0}, {0x25C0, 600}, {0x25C1, 0}, + {0x25CA, 600}, {0x25CC, 0}, {0x25D8, 600}, {0x25DA, 0}, + {0x263A, 600}, {0x263D, 0}, {0x2640, 600}, {0x2641, 0}, + {0x2642, 600}, {0x2643, 0}, {0x2660, 600}, {0x2661, 0}, + {0x2662, 600}, {0x2664, 0}, {0x2665, 600}, {0x2667, 0}, + {0x266A, 600}, {0x266B, 0}, {0x266C, 600}, {0x266D, 0}, + {0xE000, 600}, {0xE002, 0}, {0xF638, 600}, {0xF639, 0}, + {0xFB01, 600}, {0xFB03, 0}, {0xFFFF, 0} +}; + +static const fnt_font_metric fnt_font_metric_03 = +{ + "Courier-Oblique", + 99L, + fnt_Type1, + cc_none, + -11, + 1, + -48, + -250, + 748, + 857, + -198, + 52, + 573, + 435, + 627, + -373, + 109, + 0, + + FNT_DEFAULT_WIDTH, + 0, + NULL, + 203, + fnt_glyph_width_03, + 0, + NULL, + +}; + +/* -------- Generated from CourierStd-BoldOblique.otf -------- */ + +static fnt_interwidth fnt_glyph_width_04[203] = +{ + {0x0000, 600}, {0x0001, 0}, {0x0020, 600}, {0x007F, 0}, + {0x00A0, 600}, {0x0100, 0}, {0x0111, 600}, {0x0112, 0}, + {0x0126, 600}, {0x0128, 0}, {0x0131, 600}, {0x0134, 0}, + {0x0138, 600}, {0x0139, 0}, {0x013F, 600}, {0x0143, 0}, + {0x0149, 600}, {0x014C, 0}, {0x0152, 600}, {0x0154, 0}, + {0x0160, 600}, {0x0162, 0}, {0x0166, 600}, {0x0168, 0}, + {0x0178, 600}, {0x0179, 0}, {0x017D, 600}, {0x017F, 0}, + {0x0192, 600}, {0x0193, 0}, {0x02C6, 600}, {0x02C8, 0}, + {0x02C9, 600}, {0x02CA, 0}, {0x02D8, 600}, {0x02DE, 0}, + {0x0393, 600}, {0x0394, 0}, {0x0398, 600}, {0x0399, 0}, + {0x03A6, 600}, {0x03A7, 0}, {0x03A9, 600}, {0x03AA, 0}, + {0x03B1, 600}, {0x03B2, 0}, {0x03B4, 600}, {0x03B6, 0}, + {0x03BC, 600}, {0x03BD, 0}, {0x03C0, 600}, {0x03C1, 0}, + {0x03C3, 600}, {0x03C5, 0}, {0x03D5, 600}, {0x03D6, 0}, + {0x2013, 600}, {0x2015, 0}, {0x2017, 600}, {0x201F, 0}, + {0x2020, 600}, {0x2023, 0}, {0x2026, 600}, {0x2027, 0}, + {0x2030, 600}, {0x2031, 0}, {0x2039, 600}, {0x203B, 0}, + {0x203C, 600}, {0x203D, 0}, {0x203E, 600}, {0x203F, 0}, + {0x2044, 600}, {0x2045, 0}, {0x207F, 600}, {0x2080, 0}, + {0x20A3, 600}, {0x20A4, 0}, {0x20A7, 600}, {0x20A8, 0}, + {0x20AC, 600}, {0x20AD, 0}, {0x2113, 600}, {0x2114, 0}, + {0x2122, 600}, {0x2123, 0}, {0x2126, 600}, {0x2127, 0}, + {0x212E, 600}, {0x212F, 0}, {0x215B, 600}, {0x215F, 0}, + {0x2190, 600}, {0x2196, 0}, {0x21A8, 600}, {0x21A9, 0}, + {0x2202, 600}, {0x2203, 0}, {0x2206, 600}, {0x2207, 0}, + {0x220F, 600}, {0x2210, 0}, {0x2211, 600}, {0x2213, 0}, + {0x2215, 600}, {0x2216, 0}, {0x2219, 600}, {0x221B, 0}, + {0x221E, 600}, {0x221F, 0}, {0x2229, 600}, {0x222A, 0}, + {0x222B, 600}, {0x222C, 0}, {0x2248, 600}, {0x2249, 0}, + {0x2260, 600}, {0x2262, 0}, {0x2264, 600}, {0x2266, 0}, + {0x22C5, 600}, {0x22C6, 0}, {0x2302, 600}, {0x2303, 0}, + {0x2304, 600}, {0x2305, 0}, {0x2310, 600}, {0x2311, 0}, + {0x2319, 600}, {0x231A, 0}, {0x2320, 600}, {0x2322, 0}, + {0x2500, 600}, {0x2501, 0}, {0x2502, 600}, {0x2503, 0}, + {0x250C, 600}, {0x250D, 0}, {0x2510, 600}, {0x2511, 0}, + {0x2514, 600}, {0x2515, 0}, {0x2518, 600}, {0x2519, 0}, + {0x251C, 600}, {0x251D, 0}, {0x2524, 600}, {0x2525, 0}, + {0x252C, 600}, {0x252D, 0}, {0x2534, 600}, {0x2535, 0}, + {0x253C, 600}, {0x253D, 0}, {0x2550, 600}, {0x256D, 0}, + {0x2580, 600}, {0x2581, 0}, {0x2584, 600}, {0x2585, 0}, + {0x2588, 600}, {0x2589, 0}, {0x258C, 600}, {0x258D, 0}, + {0x2590, 600}, {0x2594, 0}, {0x25A0, 600}, {0x25A1, 0}, + {0x25B2, 600}, {0x25B3, 0}, {0x25B6, 600}, {0x25B7, 0}, + {0x25BC, 600}, {0x25BD, 0}, {0x25C0, 600}, {0x25C1, 0}, + {0x25CA, 600}, {0x25CC, 0}, {0x25D8, 600}, {0x25DA, 0}, + {0x263A, 600}, {0x263D, 0}, {0x2640, 600}, {0x2641, 0}, + {0x2642, 600}, {0x2643, 0}, {0x2660, 600}, {0x2661, 0}, + {0x2662, 600}, {0x2664, 0}, {0x2665, 600}, {0x2667, 0}, + {0x266A, 600}, {0x266B, 0}, {0x266C, 600}, {0x266D, 0}, + {0xE000, 600}, {0xE002, 0}, {0xF638, 600}, {0xF639, 0}, + {0xFB01, 600}, {0xFB03, 0}, {0xFFFF, 0} +}; + +static const fnt_font_metric fnt_font_metric_04 = +{ + "Courier-BoldOblique", + 262243L, + fnt_Type1, + cc_none, + -11, + 1, + -48, + -250, + 757, + 854, + -198, + 52, + 573, + 435, + 627, + -373, + 166, + 0, + + FNT_DEFAULT_WIDTH, + 0, + NULL, + 203, + fnt_glyph_width_04, + 0, + NULL, + +}; + +/* -------- Generated from ARIAL.TTF -------- */ + +static fnt_interwidth fnt_glyph_width_05[268] = +{ + {0x0000, 0}, {0x0020, 278}, {0x0022, 355}, {0x0023, 556}, + {0x0025, 889}, {0x0026, 667}, {0x0027, 191}, {0x0028, 333}, + {0x002A, 389}, {0x002B, 584}, {0x002C, 278}, {0x002D, 333}, + {0x002E, 278}, {0x0030, 556}, {0x003A, 278}, {0x003C, 584}, + {0x003F, 556}, {0x0040,1015}, {0x0041, 667}, {0x0043, 722}, + {0x0045, 667}, {0x0046, 611}, {0x0047, 778}, {0x0048, 722}, + {0x0049, 278}, {0x004A, 500}, {0x004B, 667}, {0x004C, 556}, + {0x004D, 833}, {0x004E, 722}, {0x004F, 778}, {0x0050, 667}, + {0x0051, 778}, {0x0052, 722}, {0x0053, 667}, {0x0054, 611}, + {0x0055, 722}, {0x0056, 667}, {0x0057, 944}, {0x0058, 667}, + {0x005A, 611}, {0x005B, 278}, {0x005E, 469}, {0x005F, 556}, + {0x0060, 333}, {0x0061, 556}, {0x0063, 500}, {0x0064, 556}, + {0x0066, 278}, {0x0067, 556}, {0x0069, 222}, {0x006B, 500}, + {0x006C, 222}, {0x006D, 833}, {0x006E, 556}, {0x0072, 333}, + {0x0073, 500}, {0x0074, 278}, {0x0075, 556}, {0x0076, 500}, + {0x0077, 722}, {0x0078, 500}, {0x007B, 334}, {0x007C, 260}, + {0x007D, 334}, {0x007E, 584}, {0x007F, 0}, {0x00A0, 278}, + {0x00A1, 333}, {0x00A2, 556}, {0x00A6, 260}, {0x00A7, 556}, + {0x00A8, 333}, {0x00A9, 737}, {0x00AA, 370}, {0x00AB, 556}, + {0x00AC, 584}, {0x00AD, 333}, {0x00AE, 737}, {0x00AF, 552}, + {0x00B0, 400}, {0x00B1, 549}, {0x00B2, 333}, {0x00B5, 576}, + {0x00B6, 537}, {0x00B7, 278}, {0x00B8, 333}, {0x00BA, 365}, + {0x00BB, 556}, {0x00BC, 834}, {0x00BF, 611}, {0x00C0, 667}, + {0x00C6,1000}, {0x00C7, 722}, {0x00C8, 667}, {0x00CC, 278}, + {0x00D0, 722}, {0x00D2, 778}, {0x00D7, 584}, {0x00D8, 778}, + {0x00D9, 722}, {0x00DD, 667}, {0x00DF, 611}, {0x00E0, 556}, + {0x00E6, 889}, {0x00E7, 500}, {0x00E8, 556}, {0x00EC, 278}, + {0x00F0, 556}, {0x00F7, 549}, {0x00F8, 611}, {0x00F9, 556}, + {0x00FD, 500}, {0x00FE, 556}, {0x00FF, 500}, {0x0100, 667}, + {0x0101, 556}, {0x0102, 667}, {0x0103, 556}, {0x0104, 667}, + {0x0105, 556}, {0x0106, 722}, {0x0107, 500}, {0x0108, 0}, + {0x010C, 722}, {0x010D, 500}, {0x010E, 722}, {0x010F, 615}, + {0x0110, 722}, {0x0111, 556}, {0x0112, 667}, {0x0113, 556}, + {0x0114, 0}, {0x0116, 667}, {0x0117, 556}, {0x0118, 667}, + {0x0119, 556}, {0x011A, 667}, {0x011B, 556}, {0x011C, 0}, + {0x011E, 778}, {0x011F, 556}, {0x0120, 0}, {0x0122, 778}, + {0x0123, 556}, {0x0124, 0}, {0x0128, 278}, {0x012C, 0}, + {0x012E, 278}, {0x012F, 222}, {0x0130, 278}, {0x0132, 0}, + {0x0136, 667}, {0x0137, 500}, {0x0139, 556}, {0x013A, 222}, + {0x013B, 556}, {0x013C, 222}, {0x013D, 556}, {0x013E, 292}, + {0x013F, 0}, {0x0141, 556}, {0x0142, 222}, {0x0143, 722}, + {0x0144, 556}, {0x0145, 722}, {0x0146, 556}, {0x0147, 722}, + {0x0148, 556}, {0x0149, 0}, {0x014A, 723}, {0x014B, 556}, + {0x014C, 778}, {0x014D, 556}, {0x014E, 0}, {0x0150, 778}, + {0x0151, 556}, {0x0152,1000}, {0x0153, 944}, {0x0154, 722}, + {0x0155, 333}, {0x0156, 722}, {0x0157, 333}, {0x0158, 722}, + {0x0159, 333}, {0x015A, 667}, {0x015B, 500}, {0x015C, 0}, + {0x015E, 667}, {0x015F, 500}, {0x0160, 667}, {0x0161, 500}, + {0x0162, 611}, {0x0163, 278}, {0x0164, 611}, {0x0165, 375}, + {0x0166, 611}, {0x0167, 278}, {0x0168, 722}, {0x0169, 556}, + {0x016A, 722}, {0x016B, 556}, {0x016C, 0}, {0x016E, 722}, + {0x016F, 556}, {0x0170, 722}, {0x0171, 556}, {0x0172, 722}, + {0x0173, 556}, {0x0174, 0}, {0x0178, 667}, {0x0179, 611}, + {0x017A, 500}, {0x017B, 611}, {0x017C, 500}, {0x017D, 611}, + {0x017E, 500}, {0x017F, 0}, {0x0192, 556}, {0x0193, 0}, + {0x0218, 750}, {0x021A, 611}, {0x021B, 278}, {0x021C, 0}, + {0x02C6, 333}, {0x02C8, 0}, {0x02D8, 333}, {0x02DA, 0}, + {0x02DB, 333}, {0x02DE, 0}, {0x2013, 556}, {0x2014,1000}, + {0x2016, 0}, {0x2018, 222}, {0x201B, 0}, {0x201C, 333}, + {0x201F, 0}, {0x2020, 556}, {0x2022, 350}, {0x2023, 0}, + {0x2026,1000}, {0x2027, 0}, {0x2030,1000}, {0x2031, 0}, + {0x2039, 333}, {0x203B, 0}, {0x20AC, 556}, {0x20AD, 0}, + {0x2122,1000}, {0x2123, 0}, {0x2202, 494}, {0x2203, 0}, + {0x2211, 713}, {0x2212, 584}, {0x2213, 0}, {0x221A, 549}, + {0x221B, 0}, {0x2260, 549}, {0x2261, 0}, {0x2264, 549}, + {0x2266, 0}, {0x25CA, 494}, {0x25CB, 0}, {0xF6C3, 750}, + {0xF6C4, 0}, {0xFB01, 500}, {0xFB03, 0}, {0xFFFF, 0} +}; + + +static const fnt_font_metric fnt_font_metric_05 = +{ + "Helvetica", + 32L, + fnt_Type1, + cc_none, + 0, + 0, + -665, + -325, + 2028, + 1037, + -106, + 73, + 718, + 523, + 718, + -207, + 88, + 0, + FNT_DEFAULT_WIDTH, + 0, + NULL, + 268, + fnt_glyph_width_05, + 0, + NULL, + +}; + +/* -------- Generated from ARIALBD.TTF -------- */ + +static fnt_interwidth fnt_glyph_width_06[269] = +{ + {0x0000, 0}, {0x0020, 278}, {0x0021, 333}, {0x0022, 474}, + {0x0023, 556}, {0x0025, 889}, {0x0026, 722}, {0x0027, 238}, + {0x0028, 333}, {0x002A, 389}, {0x002B, 584}, {0x002C, 278}, + {0x002D, 333}, {0x002E, 278}, {0x0030, 556}, {0x003A, 333}, + {0x003C, 584}, {0x003F, 611}, {0x0040, 975}, {0x0041, 722}, + {0x0045, 667}, {0x0046, 611}, {0x0047, 778}, {0x0048, 722}, + {0x0049, 278}, {0x004A, 556}, {0x004B, 722}, {0x004C, 611}, + {0x004D, 833}, {0x004E, 722}, {0x004F, 778}, {0x0050, 667}, + {0x0051, 778}, {0x0052, 722}, {0x0053, 667}, {0x0054, 611}, + {0x0055, 722}, {0x0056, 667}, {0x0057, 944}, {0x0058, 667}, + {0x005A, 611}, {0x005B, 333}, {0x005C, 278}, {0x005D, 333}, + {0x005E, 584}, {0x005F, 556}, {0x0060, 333}, {0x0061, 556}, + {0x0062, 611}, {0x0063, 556}, {0x0064, 611}, {0x0065, 556}, + {0x0066, 333}, {0x0067, 611}, {0x0069, 278}, {0x006B, 556}, + {0x006C, 278}, {0x006D, 889}, {0x006E, 611}, {0x0072, 389}, + {0x0073, 556}, {0x0074, 333}, {0x0075, 611}, {0x0076, 556}, + {0x0077, 778}, {0x0078, 556}, {0x007A, 500}, {0x007B, 389}, + {0x007C, 280}, {0x007D, 389}, {0x007E, 584}, {0x007F, 0}, + {0x00A0, 278}, {0x00A1, 333}, {0x00A2, 556}, {0x00A6, 280}, + {0x00A7, 556}, {0x00A8, 333}, {0x00A9, 737}, {0x00AA, 370}, + {0x00AB, 556}, {0x00AC, 584}, {0x00AD, 333}, {0x00AE, 737}, + {0x00AF, 552}, {0x00B0, 400}, {0x00B1, 549}, {0x00B2, 333}, + {0x00B5, 576}, {0x00B6, 556}, {0x00B7, 278}, {0x00B8, 333}, + {0x00BA, 365}, {0x00BB, 556}, {0x00BC, 834}, {0x00BF, 611}, + {0x00C0, 722}, {0x00C6,1000}, {0x00C7, 722}, {0x00C8, 667}, + {0x00CC, 278}, {0x00D0, 722}, {0x00D2, 778}, {0x00D7, 584}, + {0x00D8, 778}, {0x00D9, 722}, {0x00DD, 667}, {0x00DF, 611}, + {0x00E0, 556}, {0x00E6, 889}, {0x00E7, 556}, {0x00EC, 278}, + {0x00F0, 611}, {0x00F7, 549}, {0x00F8, 611}, {0x00FD, 556}, + {0x00FE, 611}, {0x00FF, 556}, {0x0100, 722}, {0x0101, 556}, + {0x0102, 722}, {0x0103, 556}, {0x0104, 722}, {0x0105, 556}, + {0x0106, 722}, {0x0107, 556}, {0x0108, 0}, {0x010C, 722}, + {0x010D, 556}, {0x010E, 722}, {0x010F, 719}, {0x0110, 722}, + {0x0111, 611}, {0x0112, 667}, {0x0113, 556}, {0x0114, 0}, + {0x0116, 667}, {0x0117, 556}, {0x0118, 667}, {0x0119, 556}, + {0x011A, 667}, {0x011B, 556}, {0x011C, 0}, {0x011E, 778}, + {0x011F, 611}, {0x0120, 0}, {0x0122, 778}, {0x0123, 611}, + {0x0124, 0}, {0x0128, 278}, {0x012C, 0}, {0x012E, 278}, + {0x0132, 0}, {0x0136, 722}, {0x0137, 556}, {0x0139, 611}, + {0x013A, 278}, {0x013B, 611}, {0x013C, 278}, {0x013D, 611}, + {0x013E, 385}, {0x013F, 0}, {0x0141, 611}, {0x0142, 278}, + {0x0143, 722}, {0x0144, 611}, {0x0145, 722}, {0x0146, 611}, + {0x0147, 722}, {0x0148, 611}, {0x0149, 0}, {0x014A, 723}, + {0x014B, 611}, {0x014C, 778}, {0x014D, 611}, {0x014E, 0}, + {0x0150, 778}, {0x0151, 611}, {0x0152,1000}, {0x0153, 944}, + {0x0154, 722}, {0x0155, 389}, {0x0156, 722}, {0x0157, 389}, + {0x0158, 722}, {0x0159, 389}, {0x015A, 667}, {0x015B, 556}, + {0x015C, 0}, {0x015E, 667}, {0x015F, 556}, {0x0160, 667}, + {0x0161, 556}, {0x0162, 611}, {0x0163, 333}, {0x0164, 611}, + {0x0165, 479}, {0x0166, 611}, {0x0167, 333}, {0x0168, 722}, + {0x0169, 611}, {0x016A, 722}, {0x016B, 611}, {0x016C, 0}, + {0x016E, 722}, {0x016F, 611}, {0x0170, 722}, {0x0171, 611}, + {0x0172, 722}, {0x0173, 611}, {0x0174, 0}, {0x0178, 667}, + {0x0179, 611}, {0x017A, 500}, {0x017B, 611}, {0x017C, 500}, + {0x017D, 611}, {0x017E, 500}, {0x017F, 0}, {0x0192, 556}, + {0x0193, 0}, {0x0218, 750}, {0x021A, 611}, {0x021B, 333}, + {0x021C, 0}, {0x02C6, 333}, {0x02C8, 0}, {0x02D8, 333}, + {0x02DA, 0}, {0x02DB, 333}, {0x02DE, 0}, {0x2013, 556}, + {0x2014,1000}, {0x2016, 0}, {0x2018, 278}, {0x201B, 0}, + {0x201C, 500}, {0x201F, 0}, {0x2020, 556}, {0x2022, 350}, + {0x2023, 0}, {0x2026,1000}, {0x2027, 0}, {0x2030,1000}, + {0x2031, 0}, {0x2039, 333}, {0x203B, 0}, {0x20AC, 556}, + {0x20AD, 0}, {0x2122,1000}, {0x2123, 0}, {0x2202, 494}, + {0x2203, 0}, {0x2211, 713}, {0x2212, 584}, {0x2213, 0}, + {0x221A, 549}, {0x221B, 0}, {0x2260, 549}, {0x2261, 0}, + {0x2264, 549}, {0x2266, 0}, {0x25CA, 494}, {0x25CB, 0}, + {0xF6C3, 750}, {0xF6C4, 0}, {0xFB01, 611}, {0xFB03, 0}, + {0xFFFF, 0} +}; + + +static const fnt_font_metric fnt_font_metric_06 = +{ + "Helvetica-Bold", + 262176L, + fnt_Type1, + cc_none, + 0, + 0, + -628, + -376, + 2000, + 1010, + -106, + 105, + 718, + 532, + 718, + -207, + 166, + 0, + + FNT_DEFAULT_WIDTH, + 0, + NULL, + 269, + fnt_glyph_width_06, + 0, + NULL, + +}; + +/* -------- Generated from ARIALI.TTF -------- */ + +static fnt_interwidth fnt_glyph_width_07[268] = +{ + {0x0000, 0}, {0x0020, 278}, {0x0022, 355}, {0x0023, 556}, + {0x0025, 889}, {0x0026, 667}, {0x0027, 191}, {0x0028, 333}, + {0x002A, 389}, {0x002B, 584}, {0x002C, 278}, {0x002D, 333}, + {0x002E, 278}, {0x0030, 556}, {0x003A, 278}, {0x003C, 584}, + {0x003F, 556}, {0x0040,1015}, {0x0041, 667}, {0x0043, 722}, + {0x0045, 667}, {0x0046, 611}, {0x0047, 778}, {0x0048, 722}, + {0x0049, 278}, {0x004A, 500}, {0x004B, 667}, {0x004C, 556}, + {0x004D, 833}, {0x004E, 722}, {0x004F, 778}, {0x0050, 667}, + {0x0051, 778}, {0x0052, 722}, {0x0053, 667}, {0x0054, 611}, + {0x0055, 722}, {0x0056, 667}, {0x0057, 944}, {0x0058, 667}, + {0x005A, 611}, {0x005B, 278}, {0x005E, 469}, {0x005F, 556}, + {0x0060, 333}, {0x0061, 556}, {0x0063, 500}, {0x0064, 556}, + {0x0066, 278}, {0x0067, 556}, {0x0069, 222}, {0x006B, 500}, + {0x006C, 222}, {0x006D, 833}, {0x006E, 556}, {0x0072, 333}, + {0x0073, 500}, {0x0074, 278}, {0x0075, 556}, {0x0076, 500}, + {0x0077, 722}, {0x0078, 500}, {0x007B, 334}, {0x007C, 260}, + {0x007D, 334}, {0x007E, 584}, {0x007F, 0}, {0x00A0, 278}, + {0x00A1, 333}, {0x00A2, 556}, {0x00A6, 260}, {0x00A7, 556}, + {0x00A8, 333}, {0x00A9, 737}, {0x00AA, 370}, {0x00AB, 556}, + {0x00AC, 584}, {0x00AD, 333}, {0x00AE, 737}, {0x00AF, 552}, + {0x00B0, 400}, {0x00B1, 549}, {0x00B2, 333}, {0x00B5, 576}, + {0x00B6, 537}, {0x00B7, 278}, {0x00B8, 333}, {0x00BA, 365}, + {0x00BB, 556}, {0x00BC, 834}, {0x00BF, 611}, {0x00C0, 667}, + {0x00C6,1000}, {0x00C7, 722}, {0x00C8, 667}, {0x00CC, 278}, + {0x00D0, 722}, {0x00D2, 778}, {0x00D7, 584}, {0x00D8, 778}, + {0x00D9, 722}, {0x00DD, 667}, {0x00DF, 611}, {0x00E0, 556}, + {0x00E6, 889}, {0x00E7, 500}, {0x00E8, 556}, {0x00EC, 278}, + {0x00F0, 556}, {0x00F7, 549}, {0x00F8, 611}, {0x00F9, 556}, + {0x00FD, 500}, {0x00FE, 556}, {0x00FF, 500}, {0x0100, 667}, + {0x0101, 556}, {0x0102, 667}, {0x0103, 556}, {0x0104, 667}, + {0x0105, 556}, {0x0106, 722}, {0x0107, 500}, {0x0108, 0}, + {0x010C, 722}, {0x010D, 500}, {0x010E, 722}, {0x010F, 625}, + {0x0110, 722}, {0x0111, 556}, {0x0112, 667}, {0x0113, 556}, + {0x0114, 0}, {0x0116, 667}, {0x0117, 556}, {0x0118, 667}, + {0x0119, 556}, {0x011A, 667}, {0x011B, 556}, {0x011C, 0}, + {0x011E, 778}, {0x011F, 556}, {0x0120, 0}, {0x0122, 778}, + {0x0123, 556}, {0x0124, 0}, {0x0128, 278}, {0x012C, 0}, + {0x012E, 278}, {0x012F, 222}, {0x0130, 278}, {0x0132, 0}, + {0x0136, 667}, {0x0137, 500}, {0x0139, 556}, {0x013A, 222}, + {0x013B, 556}, {0x013C, 222}, {0x013D, 556}, {0x013E, 281}, + {0x013F, 0}, {0x0141, 556}, {0x0142, 222}, {0x0143, 722}, + {0x0144, 556}, {0x0145, 722}, {0x0146, 556}, {0x0147, 722}, + {0x0148, 556}, {0x0149, 0}, {0x014A, 723}, {0x014B, 556}, + {0x014C, 778}, {0x014D, 556}, {0x014E, 0}, {0x0150, 778}, + {0x0151, 556}, {0x0152,1000}, {0x0153, 944}, {0x0154, 722}, + {0x0155, 333}, {0x0156, 722}, {0x0157, 333}, {0x0158, 722}, + {0x0159, 333}, {0x015A, 667}, {0x015B, 500}, {0x015C, 0}, + {0x015E, 667}, {0x015F, 500}, {0x0160, 667}, {0x0161, 500}, + {0x0162, 611}, {0x0163, 278}, {0x0164, 611}, {0x0165, 354}, + {0x0166, 611}, {0x0167, 278}, {0x0168, 722}, {0x0169, 556}, + {0x016A, 722}, {0x016B, 556}, {0x016C, 0}, {0x016E, 722}, + {0x016F, 556}, {0x0170, 722}, {0x0171, 556}, {0x0172, 722}, + {0x0173, 556}, {0x0174, 0}, {0x0178, 667}, {0x0179, 611}, + {0x017A, 500}, {0x017B, 611}, {0x017C, 500}, {0x017D, 611}, + {0x017E, 500}, {0x017F, 0}, {0x0192, 556}, {0x0193, 0}, + {0x0218, 750}, {0x021A, 611}, {0x021B, 278}, {0x021C, 0}, + {0x02C6, 333}, {0x02C8, 0}, {0x02D8, 333}, {0x02DA, 0}, + {0x02DB, 333}, {0x02DE, 0}, {0x2013, 556}, {0x2014,1000}, + {0x2016, 0}, {0x2018, 222}, {0x201B, 0}, {0x201C, 333}, + {0x201F, 0}, {0x2020, 556}, {0x2022, 350}, {0x2023, 0}, + {0x2026,1000}, {0x2027, 0}, {0x2030,1000}, {0x2031, 0}, + {0x2039, 333}, {0x203B, 0}, {0x20AC, 556}, {0x20AD, 0}, + {0x2122,1000}, {0x2123, 0}, {0x2202, 494}, {0x2203, 0}, + {0x2211, 713}, {0x2212, 584}, {0x2213, 0}, {0x221A, 549}, + {0x221B, 0}, {0x2260, 549}, {0x2261, 0}, {0x2264, 549}, + {0x2266, 0}, {0x25CA, 494}, {0x25CB, 0}, {0xF6C3, 750}, + {0xF6C4, 0}, {0xFB01, 500}, {0xFB03, 0}, {0xFFFF, 0} +}; + + +static const fnt_font_metric fnt_font_metric_07 = +{ + "Helvetica-Oblique", + 96L, + fnt_Type1, + cc_none, + -12, + 0, + -517, + -325, + 1082, + 998, + -106, + 73, + 718, + 523, + 718, + -207, + 88, + 0, + + FNT_DEFAULT_WIDTH, + 0, + NULL, + 268, + fnt_glyph_width_07, + 0, + NULL, + +}; + +/* -------- Generated from ARIALBI.TTF -------- */ + +static fnt_interwidth fnt_glyph_width_08[269] = +{ + {0x0000, 0}, {0x0020, 278}, {0x0021, 333}, {0x0022, 474}, + {0x0023, 556}, {0x0025, 889}, {0x0026, 722}, {0x0027, 238}, + {0x0028, 333}, {0x002A, 389}, {0x002B, 584}, {0x002C, 278}, + {0x002D, 333}, {0x002E, 278}, {0x0030, 556}, {0x003A, 333}, + {0x003C, 584}, {0x003F, 611}, {0x0040, 975}, {0x0041, 722}, + {0x0045, 667}, {0x0046, 611}, {0x0047, 778}, {0x0048, 722}, + {0x0049, 278}, {0x004A, 556}, {0x004B, 722}, {0x004C, 611}, + {0x004D, 833}, {0x004E, 722}, {0x004F, 778}, {0x0050, 667}, + {0x0051, 778}, {0x0052, 722}, {0x0053, 667}, {0x0054, 611}, + {0x0055, 722}, {0x0056, 667}, {0x0057, 944}, {0x0058, 667}, + {0x005A, 611}, {0x005B, 333}, {0x005C, 278}, {0x005D, 333}, + {0x005E, 584}, {0x005F, 556}, {0x0060, 333}, {0x0061, 556}, + {0x0062, 611}, {0x0063, 556}, {0x0064, 611}, {0x0065, 556}, + {0x0066, 333}, {0x0067, 611}, {0x0069, 278}, {0x006B, 556}, + {0x006C, 278}, {0x006D, 889}, {0x006E, 611}, {0x0072, 389}, + {0x0073, 556}, {0x0074, 333}, {0x0075, 611}, {0x0076, 556}, + {0x0077, 778}, {0x0078, 556}, {0x007A, 500}, {0x007B, 389}, + {0x007C, 280}, {0x007D, 389}, {0x007E, 584}, {0x007F, 0}, + {0x00A0, 278}, {0x00A1, 333}, {0x00A2, 556}, {0x00A6, 280}, + {0x00A7, 556}, {0x00A8, 333}, {0x00A9, 737}, {0x00AA, 370}, + {0x00AB, 556}, {0x00AC, 584}, {0x00AD, 333}, {0x00AE, 737}, + {0x00AF, 552}, {0x00B0, 400}, {0x00B1, 549}, {0x00B2, 333}, + {0x00B5, 576}, {0x00B6, 556}, {0x00B7, 278}, {0x00B8, 333}, + {0x00BA, 365}, {0x00BB, 556}, {0x00BC, 834}, {0x00BF, 611}, + {0x00C0, 722}, {0x00C6,1000}, {0x00C7, 722}, {0x00C8, 667}, + {0x00CC, 278}, {0x00D0, 722}, {0x00D2, 778}, {0x00D7, 584}, + {0x00D8, 778}, {0x00D9, 722}, {0x00DD, 667}, {0x00DF, 611}, + {0x00E0, 556}, {0x00E6, 889}, {0x00E7, 556}, {0x00EC, 278}, + {0x00F0, 611}, {0x00F7, 549}, {0x00F8, 611}, {0x00FD, 556}, + {0x00FE, 611}, {0x00FF, 556}, {0x0100, 722}, {0x0101, 556}, + {0x0102, 722}, {0x0103, 556}, {0x0104, 722}, {0x0105, 556}, + {0x0106, 722}, {0x0107, 556}, {0x0108, 0}, {0x010C, 722}, + {0x010D, 556}, {0x010E, 722}, {0x010F, 740}, {0x0110, 722}, + {0x0111, 611}, {0x0112, 667}, {0x0113, 556}, {0x0114, 0}, + {0x0116, 667}, {0x0117, 556}, {0x0118, 667}, {0x0119, 556}, + {0x011A, 667}, {0x011B, 556}, {0x011C, 0}, {0x011E, 778}, + {0x011F, 611}, {0x0120, 0}, {0x0122, 778}, {0x0123, 611}, + {0x0124, 0}, {0x0128, 278}, {0x012C, 0}, {0x012E, 278}, + {0x0132, 0}, {0x0136, 722}, {0x0137, 556}, {0x0139, 611}, + {0x013A, 278}, {0x013B, 611}, {0x013C, 278}, {0x013D, 611}, + {0x013E, 396}, {0x013F, 0}, {0x0141, 611}, {0x0142, 278}, + {0x0143, 722}, {0x0144, 611}, {0x0145, 722}, {0x0146, 611}, + {0x0147, 722}, {0x0148, 611}, {0x0149, 0}, {0x014A, 723}, + {0x014B, 611}, {0x014C, 778}, {0x014D, 611}, {0x014E, 0}, + {0x0150, 778}, {0x0151, 611}, {0x0152,1000}, {0x0153, 944}, + {0x0154, 722}, {0x0155, 389}, {0x0156, 722}, {0x0157, 389}, + {0x0158, 722}, {0x0159, 389}, {0x015A, 667}, {0x015B, 556}, + {0x015C, 0}, {0x015E, 667}, {0x015F, 556}, {0x0160, 667}, + {0x0161, 556}, {0x0162, 611}, {0x0163, 333}, {0x0164, 611}, + {0x0165, 479}, {0x0166, 611}, {0x0167, 333}, {0x0168, 722}, + {0x0169, 611}, {0x016A, 722}, {0x016B, 611}, {0x016C, 0}, + {0x016E, 722}, {0x016F, 611}, {0x0170, 722}, {0x0171, 611}, + {0x0172, 722}, {0x0173, 611}, {0x0174, 0}, {0x0178, 667}, + {0x0179, 611}, {0x017A, 500}, {0x017B, 611}, {0x017C, 500}, + {0x017D, 611}, {0x017E, 500}, {0x017F, 0}, {0x0192, 556}, + {0x0193, 0}, {0x0218, 750}, {0x021A, 611}, {0x021B, 333}, + {0x021C, 0}, {0x02C6, 333}, {0x02C8, 0}, {0x02D8, 333}, + {0x02DA, 0}, {0x02DB, 333}, {0x02DE, 0}, {0x2013, 556}, + {0x2014,1000}, {0x2016, 0}, {0x2018, 278}, {0x201B, 0}, + {0x201C, 500}, {0x201F, 0}, {0x2020, 556}, {0x2022, 350}, + {0x2023, 0}, {0x2026,1000}, {0x2027, 0}, {0x2030,1000}, + {0x2031, 0}, {0x2039, 333}, {0x203B, 0}, {0x20AC, 556}, + {0x20AD, 0}, {0x2122,1000}, {0x2123, 0}, {0x2202, 494}, + {0x2203, 0}, {0x2211, 713}, {0x2212, 584}, {0x2213, 0}, + {0x221A, 549}, {0x221B, 0}, {0x2260, 549}, {0x2261, 0}, + {0x2264, 549}, {0x2266, 0}, {0x25CA, 494}, {0x25CB, 0}, + {0xF6C3, 750}, {0xF6C4, 0}, {0xFB01, 611}, {0xFB03, 0}, + {0xFFFF, 0} +}; + + +static const fnt_font_metric fnt_font_metric_08 = +{ + "Helvetica-BoldOblique", + 262240L, + fnt_Type1, + cc_none, + -12, + 0, + -560, + -376, + 1157, + 1000, + -106, + 105, + 718, + 532, + 718, + -207, + 166, + 0, + + FNT_DEFAULT_WIDTH, + 0, + NULL, + 269, + fnt_glyph_width_08, + 0, + NULL, + +}; + +/* -------- Generated from Symbol.afm -------- */ + +static fnt_glyphwidth fnt_glyph_width_09[191] = +{ + {0x0020, 32, 250}, {0x0021, 33, 333}, {0x2200, 34, 713}, + {0x0023, 35, 500}, {0x2203, 36, 549}, {0x0025, 37, 833}, + {0x0026, 38, 778}, {0x220b, 39, 439}, {0x0028, 40, 333}, + {0x0029, 41, 333}, {0x2217, 42, 500}, {0x002b, 43, 549}, + {0x002c, 44, 250}, {0x2212, 45, 549}, {0x002e, 46, 250}, + {0x002f, 47, 278}, {0x0030, 48, 500}, {0x0031, 49, 500}, + {0x0032, 50, 500}, {0x0033, 51, 500}, {0x0034, 52, 500}, + {0x0035, 53, 500}, {0x0036, 54, 500}, {0x0037, 55, 500}, + {0x0038, 56, 500}, {0x0039, 57, 500}, {0x003a, 58, 278}, + {0x003b, 59, 278}, {0x003c, 60, 549}, {0x003d, 61, 549}, + {0x003e, 62, 549}, {0x003f, 63, 444}, {0x2245, 64, 549}, + {0x0391, 65, 722}, {0x0392, 66, 667}, {0x03a7, 67, 722}, + {0x0394, 68, 612}, {0x0395, 69, 611}, {0x03a6, 70, 763}, + {0x0393, 71, 603}, {0x0397, 72, 722}, {0x0399, 73, 333}, + {0x03d1, 74, 631}, {0x039a, 75, 722}, {0x039b, 76, 686}, + {0x039c, 77, 889}, {0x039d, 78, 722}, {0x039f, 79, 722}, + {0x03a0, 80, 768}, {0x0398, 81, 741}, {0x03a1, 82, 556}, + {0x03a3, 83, 592}, {0x03a4, 84, 611}, {0x03a5, 85, 690}, + {0x03c2, 86, 439}, {0x03a9, 87, 768}, {0x039e, 88, 645}, + {0x03a8, 89, 795}, {0x0396, 90, 611}, {0x005b, 91, 333}, + {0x2234, 92, 863}, {0x005d, 93, 333}, {0x22a5, 94, 658}, + {0x005f, 95, 500}, {0xf8e5, 96, 500}, {0x03b1, 97, 631}, + {0x03b2, 98, 549}, {0x03c7, 99, 549}, {0x03b4, 100, 494}, + {0x03b5, 101, 439}, {0x03c6, 102, 521}, {0x03b3, 103, 411}, + {0x03b7, 104, 603}, {0x03b9, 105, 329}, {0x03d5, 106, 603}, + {0x03ba, 107, 549}, {0x03bb, 108, 549}, {0x03bc, 109, 576}, + {0x03bd, 110, 521}, {0x03bf, 111, 549}, {0x03c0, 112, 549}, + {0x03b8, 113, 521}, {0x03c1, 114, 549}, {0x03c3, 115, 603}, + {0x03c4, 116, 439}, {0x03c5, 117, 576}, {0x03d6, 118, 713}, + {0x03c9, 119, 686}, {0x03be, 120, 493}, {0x03c8, 121, 686}, + {0x03b6, 122, 494}, {0x007b, 123, 480}, {0x007c, 124, 200}, + {0x007d, 125, 480}, {0x223c, 126, 549}, {0x20ac, 160, 750}, + {0x03d2, 161, 620}, {0x2032, 162, 247}, {0x2264, 163, 549}, + {0x2044, 164, 167}, {0x221e, 165, 713}, {0x0192, 166, 500}, + {0x2663, 167, 753}, {0x2666, 168, 753}, {0x2665, 169, 753}, + {0x2660, 170, 753}, {0x2194, 171, 1042}, {0x2190, 172, 987}, + {0x2191, 173, 603}, {0x2192, 174, 987}, {0x2193, 175, 603}, + {0x00b0, 176, 400}, {0x00b1, 177, 549}, {0x2033, 178, 411}, + {0x2265, 179, 549}, {0x00d7, 180, 549}, {0x221d, 181, 713}, + {0x2202, 182, 494}, {0x2022, 183, 460}, {0x00f7, 184, 549}, + {0x2260, 185, 549}, {0x2261, 186, 549}, {0x2248, 187, 549}, + {0x2026, 188, 1000}, {0xf8e6, 189, 603}, {0xf8e7, 190, 1000}, + {0x21b5, 191, 658}, {0x2135, 192, 823}, {0x2111, 193, 686}, + {0x211c, 194, 795}, {0x2118, 195, 987}, {0x2297, 196, 768}, + {0x2295, 197, 768}, {0x2205, 198, 823}, {0x2229, 199, 768}, + {0x222a, 200, 768}, {0x2283, 201, 713}, {0x2287, 202, 713}, + {0x2284, 203, 713}, {0x2282, 204, 713}, {0x2286, 205, 713}, + {0x2208, 206, 713}, {0x2209, 207, 713}, {0x2220, 208, 768}, + {0x2207, 209, 713}, {0xf6da, 210, 790}, {0xf6d9, 211, 790}, + {0xf6db, 212, 890}, {0x220f, 213, 823}, {0x221a, 214, 549}, + {0x22c5, 215, 250}, {0x00ac, 216, 713}, {0x2227, 217, 603}, + {0x2228, 218, 603}, {0x21d4, 219, 1042}, {0x21d0, 220, 987}, + {0x21d1, 221, 603}, {0x21d2, 222, 987}, {0x21d3, 223, 603}, + {0x25ca, 224, 494}, {0x2329, 225, 329}, {0xf8e8, 226, 790}, + {0xf8e9, 227, 790}, {0xf8ea, 228, 786}, {0x2211, 229, 713}, + {0xf8eb, 230, 384}, {0xf8ec, 231, 384}, {0xf8ed, 232, 384}, + {0xf8ee, 233, 384}, {0xf8ef, 234, 384}, {0xf8f0, 235, 384}, + {0xf8f1, 236, 494}, {0xf8f2, 237, 494}, {0xf8f3, 238, 494}, + {0xf8f4, 239, 494}, {0x232a, 241, 329}, {0x222b, 242, 274}, + {0x2320, 243, 686}, {0xf8f5, 244, 686}, {0x2321, 245, 686}, + {0xf8f6, 246, 384}, {0xf8f7, 247, 384}, {0xf8f8, 248, 384}, + {0xf8f9, 249, 384}, {0xf8fa, 250, 384}, {0xf8fb, 251, 384}, + {0xf8fc, 252, 494}, {0xf8fd, 253, 494}, {0xf8fe, 254, 494}, + {0xf8ff, -1, 790}, {0x0000, -1, 790} +}; + +static const fnt_font_metric fnt_font_metric_09 = +{ + "Symbol", /* FontName */ + 4L, /* flags */ + fnt_Type1, /* font type */ + cc_none, /* Character collection */ + 0.0, /* ItalicAngle */ + 0, /* isFixedPitch */ + -180, /* llx */ + -293, /* lly */ + 1090, /* urx */ + 1010, /* ury */ + -100, /* UnderlinePosition */ + 50, /* UnderlineThickness */ + 700, /* CapHeight */ + 0, /* xHeight */ + 800, /* Ascender */ + -200, /* Descender */ + 85, /* StdVW */ + 0, /* StdHW */ + + FNT_DEFAULT_WIDTH, + 0, + NULL, + 0, + NULL, + 191, + fnt_glyph_width_09, + +}; + +/* -------- Generated from TIMES.TTF -------- */ + +static fnt_interwidth fnt_glyph_width_10[271] = +{ + {0x0000, 0}, {0x0020, 250}, {0x0021, 333}, {0x0022, 408}, + {0x0023, 500}, {0x0025, 833}, {0x0026, 778}, {0x0027, 180}, + {0x0028, 333}, {0x002A, 500}, {0x002B, 564}, {0x002C, 250}, + {0x002D, 333}, {0x002E, 250}, {0x002F, 278}, {0x0030, 500}, + {0x003A, 278}, {0x003C, 564}, {0x003F, 444}, {0x0040, 921}, + {0x0041, 722}, {0x0042, 667}, {0x0044, 722}, {0x0045, 611}, + {0x0046, 556}, {0x0047, 722}, {0x0049, 333}, {0x004A, 389}, + {0x004B, 722}, {0x004C, 611}, {0x004D, 889}, {0x004E, 722}, + {0x0050, 556}, {0x0051, 722}, {0x0052, 667}, {0x0053, 556}, + {0x0054, 611}, {0x0055, 722}, {0x0057, 944}, {0x0058, 722}, + {0x005A, 611}, {0x005B, 333}, {0x005C, 278}, {0x005D, 333}, + {0x005E, 469}, {0x005F, 500}, {0x0060, 333}, {0x0061, 444}, + {0x0062, 500}, {0x0063, 444}, {0x0064, 500}, {0x0065, 444}, + {0x0066, 333}, {0x0067, 500}, {0x0069, 278}, {0x006B, 500}, + {0x006C, 278}, {0x006D, 778}, {0x006E, 500}, {0x0072, 333}, + {0x0073, 389}, {0x0074, 278}, {0x0075, 500}, {0x0077, 722}, + {0x0078, 500}, {0x007A, 444}, {0x007B, 480}, {0x007C, 200}, + {0x007D, 480}, {0x007E, 541}, {0x007F, 0}, {0x00A0, 250}, + {0x00A1, 333}, {0x00A2, 500}, {0x00A6, 200}, {0x00A7, 500}, + {0x00A8, 333}, {0x00A9, 760}, {0x00AA, 276}, {0x00AB, 500}, + {0x00AC, 564}, {0x00AD, 333}, {0x00AE, 760}, {0x00AF, 500}, + {0x00B0, 400}, {0x00B1, 549}, {0x00B2, 300}, {0x00B4, 333}, + {0x00B5, 576}, {0x00B6, 453}, {0x00B7, 250}, {0x00B8, 333}, + {0x00B9, 300}, {0x00BA, 310}, {0x00BB, 500}, {0x00BC, 750}, + {0x00BF, 444}, {0x00C0, 722}, {0x00C6, 889}, {0x00C7, 667}, + {0x00C8, 611}, {0x00CC, 333}, {0x00D0, 722}, {0x00D7, 564}, + {0x00D8, 722}, {0x00DE, 556}, {0x00DF, 500}, {0x00E0, 444}, + {0x00E6, 667}, {0x00E7, 444}, {0x00EC, 278}, {0x00F0, 500}, + {0x00F7, 549}, {0x00F8, 500}, {0x0100, 722}, {0x0101, 444}, + {0x0102, 722}, {0x0103, 444}, {0x0104, 722}, {0x0105, 444}, + {0x0106, 667}, {0x0107, 444}, {0x0108, 0}, {0x010C, 667}, + {0x010D, 444}, {0x010E, 722}, {0x010F, 646}, {0x0110, 722}, + {0x0111, 500}, {0x0112, 611}, {0x0113, 444}, {0x0114, 0}, + {0x0116, 611}, {0x0117, 444}, {0x0118, 611}, {0x0119, 444}, + {0x011A, 611}, {0x011B, 444}, {0x011C, 0}, {0x011E, 722}, + {0x011F, 500}, {0x0120, 0}, {0x0122, 722}, {0x0123, 500}, + {0x0124, 0}, {0x0128, 333}, {0x0129, 278}, {0x012A, 333}, + {0x012B, 278}, {0x012C, 0}, {0x012E, 333}, {0x012F, 278}, + {0x0130, 333}, {0x0131, 278}, {0x0132, 0}, {0x0136, 722}, + {0x0137, 500}, {0x0139, 611}, {0x013A, 278}, {0x013B, 611}, + {0x013C, 278}, {0x013D, 611}, {0x013E, 406}, {0x013F, 0}, + {0x0141, 611}, {0x0142, 278}, {0x0143, 722}, {0x0144, 500}, + {0x0145, 722}, {0x0146, 500}, {0x0147, 722}, {0x0148, 500}, + {0x0149, 0}, {0x014A, 702}, {0x014B, 495}, {0x014C, 722}, + {0x014D, 500}, {0x014E, 0}, {0x0150, 722}, {0x0151, 500}, + {0x0152, 889}, {0x0153, 722}, {0x0154, 667}, {0x0155, 333}, + {0x0156, 667}, {0x0157, 333}, {0x0158, 667}, {0x0159, 333}, + {0x015A, 556}, {0x015B, 389}, {0x015C, 0}, {0x015E, 556}, + {0x015F, 389}, {0x0160, 556}, {0x0161, 389}, {0x0162, 611}, + {0x0163, 278}, {0x0164, 611}, {0x0165, 427}, {0x0166, 611}, + {0x0167, 278}, {0x0168, 722}, {0x0169, 500}, {0x016A, 722}, + {0x016B, 500}, {0x016C, 0}, {0x016E, 722}, {0x016F, 500}, + {0x0170, 722}, {0x0171, 500}, {0x0172, 722}, {0x0173, 500}, + {0x0174, 0}, {0x0178, 722}, {0x0179, 611}, {0x017A, 444}, + {0x017B, 611}, {0x017C, 444}, {0x017D, 611}, {0x017E, 444}, + {0x017F, 0}, {0x0192, 500}, {0x0193, 0}, {0x0218, 778}, + {0x021A, 611}, {0x021B, 278}, {0x021C, 0}, {0x02C6, 333}, + {0x02C8, 0}, {0x02D8, 333}, {0x02DA, 0}, {0x02DB, 333}, + {0x02DE, 0}, {0x2013, 500}, {0x2014,1000}, {0x2016, 0}, + {0x2018, 333}, {0x201B, 0}, {0x201C, 444}, {0x201F, 0}, + {0x2020, 500}, {0x2022, 350}, {0x2023, 0}, {0x2026,1000}, + {0x2027, 0}, {0x2030,1000}, {0x2031, 0}, {0x2039, 333}, + {0x203B, 0}, {0x20AC, 500}, {0x20AD, 0}, {0x2122, 980}, + {0x2123, 0}, {0x2202, 494}, {0x2203, 0}, {0x2211, 713}, + {0x2212, 564}, {0x2213, 0}, {0x221A, 549}, {0x221B, 0}, + {0x2260, 549}, {0x2261, 0}, {0x2264, 549}, {0x2266, 0}, + {0x25CA, 494}, {0x25CB, 0}, {0xF6C3, 778}, {0xF6C4, 0}, + {0xFB01, 556}, {0xFB03, 0}, {0xFFFF, 0} +}; + + +static const fnt_font_metric fnt_font_metric_10 = +{ + "Times-Roman", + 32L, + fnt_Type1, + cc_none, + 0, + 0, + -568, + -307, + 2000, + 1007, + -109, + 49, + 662, + 450, + 683, + -217, + 88, + 0, + + FNT_DEFAULT_WIDTH, + 0, + NULL, + 271, + fnt_glyph_width_10, + 0, + NULL, + +}; + +/* -------- Generated from TIMESBD.TTF -------- */ + +static fnt_interwidth fnt_glyph_width_11[284] = +{ + {0x0000, 0}, {0x0020, 250}, {0x0021, 333}, {0x0022, 555}, + {0x0023, 500}, {0x0025,1000}, {0x0026, 833}, {0x0027, 278}, + {0x0028, 333}, {0x002A, 500}, {0x002B, 570}, {0x002C, 250}, + {0x002D, 333}, {0x002E, 250}, {0x002F, 278}, {0x0030, 500}, + {0x003A, 333}, {0x003C, 570}, {0x003F, 500}, {0x0040, 930}, + {0x0041, 722}, {0x0042, 667}, {0x0043, 722}, {0x0045, 667}, + {0x0046, 611}, {0x0047, 778}, {0x0049, 389}, {0x004A, 500}, + {0x004B, 778}, {0x004C, 667}, {0x004D, 944}, {0x004E, 722}, + {0x004F, 778}, {0x0050, 611}, {0x0051, 778}, {0x0052, 722}, + {0x0053, 556}, {0x0054, 667}, {0x0055, 722}, {0x0057,1000}, + {0x0058, 722}, {0x005A, 667}, {0x005B, 333}, {0x005C, 278}, + {0x005D, 333}, {0x005E, 581}, {0x005F, 500}, {0x0060, 333}, + {0x0061, 500}, {0x0062, 556}, {0x0063, 444}, {0x0064, 556}, + {0x0065, 444}, {0x0066, 333}, {0x0067, 500}, {0x0068, 556}, + {0x0069, 278}, {0x006A, 333}, {0x006B, 556}, {0x006C, 278}, + {0x006D, 833}, {0x006E, 556}, {0x006F, 500}, {0x0070, 556}, + {0x0072, 444}, {0x0073, 389}, {0x0074, 333}, {0x0075, 556}, + {0x0076, 500}, {0x0077, 722}, {0x0078, 500}, {0x007A, 444}, + {0x007B, 394}, {0x007C, 220}, {0x007D, 394}, {0x007E, 520}, + {0x007F, 0}, {0x00A0, 250}, {0x00A1, 333}, {0x00A2, 500}, + {0x00A6, 220}, {0x00A7, 500}, {0x00A8, 333}, {0x00A9, 747}, + {0x00AA, 300}, {0x00AB, 500}, {0x00AC, 570}, {0x00AD, 333}, + {0x00AE, 747}, {0x00AF, 500}, {0x00B0, 400}, {0x00B1, 549}, + {0x00B2, 300}, {0x00B4, 333}, {0x00B5, 576}, {0x00B6, 540}, + {0x00B7, 250}, {0x00B8, 333}, {0x00B9, 300}, {0x00BA, 330}, + {0x00BB, 500}, {0x00BC, 750}, {0x00BF, 500}, {0x00C0, 722}, + {0x00C6,1000}, {0x00C7, 722}, {0x00C8, 667}, {0x00CC, 389}, + {0x00D0, 722}, {0x00D2, 778}, {0x00D7, 570}, {0x00D8, 778}, + {0x00D9, 722}, {0x00DE, 611}, {0x00DF, 556}, {0x00E0, 500}, + {0x00E6, 722}, {0x00E7, 444}, {0x00EC, 278}, {0x00F0, 500}, + {0x00F1, 556}, {0x00F2, 500}, {0x00F7, 549}, {0x00F8, 500}, + {0x00F9, 556}, {0x00FD, 500}, {0x00FE, 556}, {0x00FF, 500}, + {0x0100, 722}, {0x0101, 500}, {0x0102, 722}, {0x0103, 500}, + {0x0104, 722}, {0x0105, 500}, {0x0106, 722}, {0x0107, 444}, + {0x0108, 0}, {0x010C, 722}, {0x010D, 444}, {0x010E, 722}, + {0x010F, 733}, {0x0110, 722}, {0x0111, 556}, {0x0112, 667}, + {0x0113, 444}, {0x0114, 0}, {0x0116, 667}, {0x0117, 444}, + {0x0118, 667}, {0x0119, 444}, {0x011A, 667}, {0x011B, 444}, + {0x011C, 0}, {0x011E, 778}, {0x011F, 500}, {0x0120, 0}, + {0x0122, 778}, {0x0123, 500}, {0x0124, 0}, {0x0128, 389}, + {0x0129, 278}, {0x012A, 389}, {0x012B, 278}, {0x012C, 0}, + {0x012E, 389}, {0x012F, 278}, {0x0130, 389}, {0x0131, 278}, + {0x0132, 0}, {0x0136, 778}, {0x0137, 556}, {0x0139, 667}, + {0x013A, 278}, {0x013B, 667}, {0x013C, 278}, {0x013D, 667}, + {0x013E, 469}, {0x013F, 0}, {0x0141, 667}, {0x0142, 278}, + {0x0143, 722}, {0x0144, 556}, {0x0145, 722}, {0x0146, 556}, + {0x0147, 722}, {0x0148, 556}, {0x0149, 0}, {0x014A, 769}, + {0x014B, 556}, {0x014C, 778}, {0x014D, 500}, {0x014E, 0}, + {0x0150, 778}, {0x0151, 500}, {0x0152,1000}, {0x0153, 722}, + {0x0155, 444}, {0x0156, 722}, {0x0157, 444}, {0x0158, 722}, + {0x0159, 444}, {0x015A, 556}, {0x015B, 389}, {0x015C, 0}, + {0x015E, 556}, {0x015F, 389}, {0x0160, 556}, {0x0161, 389}, + {0x0162, 667}, {0x0163, 333}, {0x0164, 667}, {0x0165, 521}, + {0x0166, 667}, {0x0167, 333}, {0x0168, 722}, {0x0169, 556}, + {0x016A, 722}, {0x016B, 556}, {0x016C, 0}, {0x016E, 722}, + {0x016F, 556}, {0x0170, 722}, {0x0171, 556}, {0x0172, 722}, + {0x0173, 556}, {0x0174, 0}, {0x0178, 722}, {0x0179, 667}, + {0x017A, 444}, {0x017B, 667}, {0x017C, 444}, {0x017D, 667}, + {0x017E, 444}, {0x017F, 0}, {0x0192, 500}, {0x0193, 0}, + {0x0218, 778}, {0x021A, 667}, {0x021B, 333}, {0x021C, 0}, + {0x02C6, 333}, {0x02C8, 0}, {0x02D8, 333}, {0x02DA, 0}, + {0x02DB, 333}, {0x02DE, 0}, {0x2013, 500}, {0x2014,1000}, + {0x2016, 0}, {0x2018, 333}, {0x201B, 0}, {0x201C, 500}, + {0x201F, 0}, {0x2020, 500}, {0x2022, 350}, {0x2023, 0}, + {0x2026,1000}, {0x2027, 0}, {0x2030,1000}, {0x2031, 0}, + {0x2039, 333}, {0x203B, 0}, {0x20AC, 500}, {0x20AD, 0}, + {0x2122,1000}, {0x2123, 0}, {0x2202, 494}, {0x2203, 0}, + {0x2211, 713}, {0x2212, 570}, {0x2213, 0}, {0x221A, 549}, + {0x221B, 0}, {0x2260, 549}, {0x2261, 0}, {0x2264, 549}, + {0x2266, 0}, {0x25CA, 494}, {0x25CB, 0}, {0xF6C3, 778}, + {0xF6C4, 0}, {0xFB01, 556}, {0xFB03, 0}, {0xFFFF, 0} +}; + + +static const fnt_font_metric fnt_font_metric_11 = +{ + "Times-Bold", + 262176L, + fnt_Type1, + cc_none, + 0, + 0, + -558, + -307, + 2000, + 1026, + -109, + 95, + 676, + 461, + 683, + -217, + 166, + 0, + + FNT_DEFAULT_WIDTH, + 0, + NULL, + 284, + fnt_glyph_width_11, + 0, + NULL, + +}; + +/* -------- Generated from TIMESI.TTF -------- */ + +static fnt_interwidth fnt_glyph_width_12[276] = +{ + {0x0000, 0}, {0x0020, 250}, {0x0021, 333}, {0x0022, 420}, + {0x0023, 500}, {0x0025, 833}, {0x0026, 778}, {0x0027, 214}, + {0x0028, 333}, {0x002A, 500}, {0x002B, 675}, {0x002C, 250}, + {0x002D, 333}, {0x002E, 250}, {0x002F, 278}, {0x0030, 500}, + {0x003A, 333}, {0x003C, 675}, {0x003F, 500}, {0x0040, 920}, + {0x0041, 611}, {0x0043, 667}, {0x0044, 722}, {0x0045, 611}, + {0x0047, 722}, {0x0049, 333}, {0x004A, 444}, {0x004B, 667}, + {0x004C, 556}, {0x004D, 833}, {0x004E, 667}, {0x004F, 722}, + {0x0050, 611}, {0x0051, 722}, {0x0052, 611}, {0x0053, 500}, + {0x0054, 556}, {0x0055, 722}, {0x0056, 611}, {0x0057, 833}, + {0x0058, 611}, {0x0059, 556}, {0x005B, 389}, {0x005C, 278}, + {0x005D, 389}, {0x005E, 422}, {0x005F, 500}, {0x0060, 333}, + {0x0061, 500}, {0x0063, 444}, {0x0064, 500}, {0x0065, 444}, + {0x0066, 278}, {0x0067, 500}, {0x0069, 278}, {0x006B, 444}, + {0x006C, 278}, {0x006D, 722}, {0x006E, 500}, {0x0072, 389}, + {0x0074, 278}, {0x0075, 500}, {0x0076, 444}, {0x0077, 667}, + {0x0078, 444}, {0x007A, 389}, {0x007B, 400}, {0x007C, 275}, + {0x007D, 400}, {0x007E, 541}, {0x007F, 0}, {0x00A0, 250}, + {0x00A1, 389}, {0x00A2, 500}, {0x00A6, 275}, {0x00A7, 500}, + {0x00A8, 333}, {0x00A9, 760}, {0x00AA, 276}, {0x00AB, 500}, + {0x00AC, 675}, {0x00AD, 333}, {0x00AE, 760}, {0x00AF, 500}, + {0x00B0, 400}, {0x00B1, 549}, {0x00B2, 300}, {0x00B4, 333}, + {0x00B5, 576}, {0x00B6, 523}, {0x00B7, 250}, {0x00B8, 333}, + {0x00B9, 300}, {0x00BA, 310}, {0x00BB, 500}, {0x00BC, 750}, + {0x00BF, 500}, {0x00C0, 611}, {0x00C6, 889}, {0x00C7, 667}, + {0x00C8, 611}, {0x00CC, 333}, {0x00D0, 722}, {0x00D1, 667}, + {0x00D2, 722}, {0x00D7, 675}, {0x00D8, 722}, {0x00DD, 556}, + {0x00DE, 611}, {0x00DF, 500}, {0x00E6, 667}, {0x00E7, 444}, + {0x00EC, 278}, {0x00F0, 500}, {0x00F7, 549}, {0x00F8, 500}, + {0x00FD, 444}, {0x00FE, 500}, {0x00FF, 444}, {0x0100, 611}, + {0x0101, 500}, {0x0102, 611}, {0x0103, 500}, {0x0104, 611}, + {0x0105, 500}, {0x0106, 667}, {0x0107, 444}, {0x0108, 0}, + {0x010C, 667}, {0x010D, 444}, {0x010E, 722}, {0x010F, 608}, + {0x0110, 722}, {0x0111, 500}, {0x0112, 611}, {0x0113, 444}, + {0x0114, 0}, {0x0116, 611}, {0x0117, 444}, {0x0118, 611}, + {0x0119, 444}, {0x011A, 611}, {0x011B, 444}, {0x011C, 0}, + {0x011E, 722}, {0x011F, 500}, {0x0120, 0}, {0x0122, 722}, + {0x0123, 500}, {0x0124, 0}, {0x0128, 333}, {0x0129, 278}, + {0x012A, 333}, {0x012B, 278}, {0x012C, 0}, {0x012E, 333}, + {0x012F, 278}, {0x0130, 333}, {0x0131, 278}, {0x0132, 0}, + {0x0136, 667}, {0x0137, 444}, {0x0139, 556}, {0x013A, 278}, + {0x013B, 556}, {0x013C, 278}, {0x013D, 556}, {0x013E, 364}, + {0x013F, 0}, {0x0141, 556}, {0x0142, 278}, {0x0143, 667}, + {0x0144, 500}, {0x0145, 667}, {0x0146, 500}, {0x0147, 667}, + {0x0148, 500}, {0x0149, 0}, {0x014A, 696}, {0x014B, 482}, + {0x014C, 722}, {0x014D, 500}, {0x014E, 0}, {0x0150, 722}, + {0x0151, 500}, {0x0152, 944}, {0x0153, 667}, {0x0154, 611}, + {0x0155, 389}, {0x0156, 611}, {0x0157, 389}, {0x0158, 611}, + {0x0159, 389}, {0x015A, 500}, {0x015B, 389}, {0x015C, 0}, + {0x015E, 500}, {0x015F, 389}, {0x0160, 500}, {0x0161, 389}, + {0x0162, 556}, {0x0163, 278}, {0x0164, 556}, {0x0165, 364}, + {0x0166, 556}, {0x0167, 278}, {0x0168, 722}, {0x0169, 500}, + {0x016A, 722}, {0x016B, 500}, {0x016C, 0}, {0x016E, 722}, + {0x016F, 500}, {0x0170, 722}, {0x0171, 500}, {0x0172, 722}, + {0x0173, 500}, {0x0174, 0}, {0x0178, 556}, {0x017A, 389}, + {0x017B, 556}, {0x017C, 389}, {0x017D, 556}, {0x017E, 389}, + {0x017F, 0}, {0x0192, 500}, {0x0193, 0}, {0x0218, 778}, + {0x021A, 556}, {0x021B, 278}, {0x021C, 0}, {0x02C6, 333}, + {0x02C8, 0}, {0x02D8, 333}, {0x02DA, 0}, {0x02DB, 333}, + {0x02DE, 0}, {0x2013, 500}, {0x2014, 889}, {0x2015,1000}, + {0x2016, 0}, {0x2018, 333}, {0x201B, 0}, {0x201C, 556}, + {0x201F, 0}, {0x2020, 500}, {0x2022, 350}, {0x2023, 0}, + {0x2026, 889}, {0x2027, 0}, {0x2030,1000}, {0x2031, 0}, + {0x2039, 333}, {0x203B, 0}, {0x20AC, 500}, {0x20AD, 0}, + {0x2122, 980}, {0x2123, 0}, {0x2202, 494}, {0x2203, 0}, + {0x2211, 713}, {0x2212, 675}, {0x2213, 0}, {0x221A, 549}, + {0x221B, 0}, {0x2260, 549}, {0x2261, 0}, {0x2264, 549}, + {0x2266, 0}, {0x25CA, 494}, {0x25CB, 0}, {0xF6C3, 778}, + {0xF6C4, 0}, {0xFB01, 500}, {0xFB03, 0}, {0xFFFF, 0} +}; + + +static const fnt_font_metric fnt_font_metric_12 = +{ + "Times-Italic", + 96L, + fnt_Type1, + cc_none, + -16.333, + 0, + -498, + -307, + 1120, + 1023, + -109, + 49, + 653, + 441, + 683, + -217, + 88, + 0, + + FNT_DEFAULT_WIDTH, + 0, + NULL, + 276, + fnt_glyph_width_12, + 0, + NULL, + +}; + +/* -------- Generated from TIMESBI.TTF -------- */ + +static fnt_interwidth fnt_glyph_width_13[275] = +{ + {0x0000, 0}, {0x0020, 250}, {0x0021, 389}, {0x0022, 555}, + {0x0023, 500}, {0x0025, 833}, {0x0026, 778}, {0x0027, 278}, + {0x0028, 333}, {0x002A, 500}, {0x002B, 570}, {0x002C, 250}, + {0x002D, 333}, {0x002E, 250}, {0x002F, 278}, {0x0030, 500}, + {0x003A, 333}, {0x003C, 570}, {0x003F, 500}, {0x0040, 832}, + {0x0041, 667}, {0x0044, 722}, {0x0045, 667}, {0x0047, 722}, + {0x0048, 778}, {0x0049, 389}, {0x004A, 500}, {0x004B, 667}, + {0x004C, 611}, {0x004D, 889}, {0x004E, 722}, {0x0050, 611}, + {0x0051, 722}, {0x0052, 667}, {0x0053, 556}, {0x0054, 611}, + {0x0055, 722}, {0x0056, 667}, {0x0057, 889}, {0x0058, 667}, + {0x0059, 611}, {0x005B, 333}, {0x005C, 278}, {0x005D, 333}, + {0x005E, 570}, {0x005F, 500}, {0x0060, 333}, {0x0061, 500}, + {0x0063, 444}, {0x0064, 500}, {0x0065, 444}, {0x0066, 333}, + {0x0067, 500}, {0x0068, 556}, {0x0069, 278}, {0x006B, 500}, + {0x006C, 278}, {0x006D, 778}, {0x006E, 556}, {0x006F, 500}, + {0x0072, 389}, {0x0074, 278}, {0x0075, 556}, {0x0076, 444}, + {0x0077, 667}, {0x0078, 500}, {0x0079, 444}, {0x007A, 389}, + {0x007B, 348}, {0x007C, 220}, {0x007D, 348}, {0x007E, 570}, + {0x007F, 0}, {0x00A0, 250}, {0x00A1, 389}, {0x00A2, 500}, + {0x00A6, 220}, {0x00A7, 500}, {0x00A8, 333}, {0x00A9, 747}, + {0x00AA, 266}, {0x00AB, 500}, {0x00AC, 606}, {0x00AD, 333}, + {0x00AE, 747}, {0x00AF, 500}, {0x00B0, 400}, {0x00B1, 549}, + {0x00B2, 300}, {0x00B4, 333}, {0x00B5, 576}, {0x00B6, 500}, + {0x00B7, 250}, {0x00B8, 333}, {0x00B9, 300}, {0x00BB, 500}, + {0x00BC, 750}, {0x00BF, 500}, {0x00C0, 667}, {0x00C6, 944}, + {0x00C7, 667}, {0x00CC, 389}, {0x00D0, 722}, {0x00D7, 570}, + {0x00D8, 722}, {0x00DD, 611}, {0x00DF, 500}, {0x00E6, 722}, + {0x00E7, 444}, {0x00EC, 278}, {0x00F0, 500}, {0x00F1, 556}, + {0x00F2, 500}, {0x00F7, 549}, {0x00F8, 500}, {0x00F9, 556}, + {0x00FD, 444}, {0x00FE, 500}, {0x00FF, 444}, {0x0100, 667}, + {0x0101, 500}, {0x0102, 667}, {0x0103, 500}, {0x0104, 667}, + {0x0105, 500}, {0x0106, 667}, {0x0107, 444}, {0x0108, 0}, + {0x010C, 667}, {0x010D, 444}, {0x010E, 722}, {0x010F, 749}, + {0x0110, 722}, {0x0111, 500}, {0x0112, 667}, {0x0113, 444}, + {0x0114, 0}, {0x0116, 667}, {0x0117, 444}, {0x0118, 667}, + {0x0119, 444}, {0x011A, 667}, {0x011B, 444}, {0x011C, 0}, + {0x011E, 722}, {0x011F, 500}, {0x0120, 0}, {0x0122, 722}, + {0x0123, 500}, {0x0124, 0}, {0x0128, 389}, {0x0129, 278}, + {0x012A, 389}, {0x012B, 278}, {0x012C, 0}, {0x012E, 389}, + {0x012F, 278}, {0x0130, 389}, {0x0131, 278}, {0x0132, 0}, + {0x0136, 667}, {0x0137, 500}, {0x0139, 611}, {0x013A, 278}, + {0x013B, 611}, {0x013C, 278}, {0x013D, 611}, {0x013E, 521}, + {0x013F, 0}, {0x0141, 611}, {0x0142, 278}, {0x0143, 722}, + {0x0144, 556}, {0x0145, 722}, {0x0146, 556}, {0x0147, 722}, + {0x0148, 556}, {0x0149, 0}, {0x014A, 784}, {0x014B, 541}, + {0x014C, 722}, {0x014D, 500}, {0x014E, 0}, {0x0150, 722}, + {0x0151, 500}, {0x0152, 944}, {0x0153, 722}, {0x0154, 667}, + {0x0155, 389}, {0x0156, 667}, {0x0157, 389}, {0x0158, 667}, + {0x0159, 389}, {0x015A, 556}, {0x015B, 389}, {0x015C, 0}, + {0x015E, 556}, {0x015F, 389}, {0x0160, 556}, {0x0161, 389}, + {0x0162, 611}, {0x0163, 278}, {0x0164, 611}, {0x0165, 531}, + {0x0166, 611}, {0x0167, 278}, {0x0168, 722}, {0x0169, 556}, + {0x016A, 722}, {0x016B, 556}, {0x016C, 0}, {0x016E, 722}, + {0x016F, 556}, {0x0170, 722}, {0x0171, 556}, {0x0172, 722}, + {0x0173, 556}, {0x0174, 0}, {0x0178, 611}, {0x017A, 389}, + {0x017B, 611}, {0x017C, 389}, {0x017D, 611}, {0x017E, 389}, + {0x017F, 0}, {0x0192, 500}, {0x0193, 0}, {0x0218, 778}, + {0x021A, 611}, {0x021B, 278}, {0x021C, 0}, {0x02C6, 333}, + {0x02C8, 0}, {0x02D8, 333}, {0x02DA, 0}, {0x02DB, 333}, + {0x02DE, 0}, {0x2013, 500}, {0x2014,1000}, {0x2016, 0}, + {0x2018, 333}, {0x201B, 0}, {0x201C, 500}, {0x201F, 0}, + {0x2020, 500}, {0x2022, 350}, {0x2023, 0}, {0x2026,1000}, + {0x2027, 0}, {0x2030,1000}, {0x2031, 0}, {0x2039, 333}, + {0x203B, 0}, {0x20AC, 500}, {0x20AD, 0}, {0x2122,1000}, + {0x2123, 0}, {0x2202, 494}, {0x2203, 0}, {0x2211, 713}, + {0x2212, 606}, {0x2213, 0}, {0x221A, 549}, {0x221B, 0}, + {0x2260, 549}, {0x2261, 0}, {0x2264, 549}, {0x2266, 0}, + {0x25CA, 494}, {0x25CB, 0}, {0xF6C3, 778}, {0xF6C4, 0}, + {0xFB01, 556}, {0xFB03, 0}, {0xFFFF, 0} +}; + + +static const fnt_font_metric fnt_font_metric_13 = +{ + "Times-BoldItalic", + 262240L, + fnt_Type1, + cc_none, + -16.333, + 0, + -547, + -307, + 1206, + 1032, + -109, + 95, + 669, + 462, + 683, + -217, + 166, + 0, + + FNT_DEFAULT_WIDTH, + 0, + NULL, + 275, + fnt_glyph_width_13, + 0, + NULL, + +}; + +/* -------- Generated from ZapfDingbats.afm -------- */ + +static fnt_glyphwidth fnt_glyph_width_14[202] = +{ + {0x0020, 32, 278}, {0x2701, 33, 974}, {0x2702, 34, 961}, + {0x2703, 35, 974}, {0x2704, 36, 980}, {0x260e, 37, 719}, + {0x2706, 38, 789}, {0x2707, 39, 790}, {0x2708, 40, 791}, + {0x2709, 41, 690}, {0x261b, 42, 960}, {0x261e, 43, 939}, + {0x270c, 44, 549}, {0x270d, 45, 855}, {0x270e, 46, 911}, + {0x270f, 47, 933}, {0x2710, 48, 911}, {0x2711, 49, 945}, + {0x2712, 50, 974}, {0x2713, 51, 755}, {0x2714, 52, 846}, + {0x2715, 53, 762}, {0x2716, 54, 761}, {0x2717, 55, 571}, + {0x2718, 56, 677}, {0x2719, 57, 763}, {0x271a, 58, 760}, + {0x271b, 59, 759}, {0x271c, 60, 754}, {0x271d, 61, 494}, + {0x271e, 62, 552}, {0x271f, 63, 537}, {0x2720, 64, 577}, + {0x2721, 65, 692}, {0x2722, 66, 786}, {0x2723, 67, 788}, + {0x2724, 68, 788}, {0x2725, 69, 790}, {0x2726, 70, 793}, + {0x2727, 71, 794}, {0x2605, 72, 816}, {0x2729, 73, 823}, + {0x272a, 74, 789}, {0x272b, 75, 841}, {0x272c, 76, 823}, + {0x272d, 77, 833}, {0x272e, 78, 816}, {0x272f, 79, 831}, + {0x2730, 80, 923}, {0x2731, 81, 744}, {0x2732, 82, 723}, + {0x2733, 83, 749}, {0x2734, 84, 790}, {0x2735, 85, 792}, + {0x2736, 86, 695}, {0x2737, 87, 776}, {0x2738, 88, 768}, + {0x2739, 89, 792}, {0x273a, 90, 759}, {0x273b, 91, 707}, + {0x273c, 92, 708}, {0x273d, 93, 682}, {0x273e, 94, 701}, + {0x273f, 95, 826}, {0x2740, 96, 815}, {0x2741, 97, 789}, + {0x2742, 98, 789}, {0x2743, 99, 707}, {0x2744, 100, 687}, + {0x2745, 101, 696}, {0x2746, 102, 689}, {0x2747, 103, 786}, + {0x2748, 104, 787}, {0x2749, 105, 713}, {0x274a, 106, 791}, + {0x274b, 107, 785}, {0x25cf, 108, 791}, {0x274d, 109, 873}, + {0x25a0, 110, 761}, {0x274f, 111, 762}, {0x2750, 112, 762}, + {0x2751, 113, 759}, {0x2752, 114, 759}, {0x25b2, 115, 892}, + {0x25bc, 116, 892}, {0x25c6, 117, 788}, {0x2756, 118, 784}, + {0x25d7, 119, 438}, {0x2758, 120, 138}, {0x2759, 121, 277}, + {0x275a, 122, 415}, {0x275b, 123, 392}, {0x275c, 124, 392}, + {0x275d, 125, 668}, {0x275e, 126, 668}, {0x2768, 128, 390}, + {0x2769, 129, 390}, {0x276a, 130, 317}, {0x276b, 131, 317}, + {0x276c, 132, 276}, {0x276d, 133, 276}, {0x276e, 134, 509}, + {0x276f, 135, 509}, {0x2770, 136, 410}, {0x2771, 137, 410}, + {0x2772, 138, 234}, {0x2773, 139, 234}, {0x2774, 140, 334}, + {0x2775, 141, 334}, {0x2761, 161, 732}, {0x2762, 162, 544}, + {0x2763, 163, 544}, {0x2764, 164, 910}, {0x2765, 165, 667}, + {0x2766, 166, 760}, {0x2767, 167, 760}, {0x2663, 168, 776}, + {0x2666, 169, 595}, {0x2665, 170, 694}, {0x2660, 171, 626}, + {0x2460, 172, 788}, {0x2461, 173, 788}, {0x2462, 174, 788}, + {0x2463, 175, 788}, {0x2464, 176, 788}, {0x2465, 177, 788}, + {0x2466, 178, 788}, {0x2467, 179, 788}, {0x2468, 180, 788}, + {0x2469, 181, 788}, {0x2776, 182, 788}, {0x2777, 183, 788}, + {0x2778, 184, 788}, {0x2779, 185, 788}, {0x277a, 186, 788}, + {0x277b, 187, 788}, {0x277c, 188, 788}, {0x277d, 189, 788}, + {0x277e, 190, 788}, {0x277f, 191, 788}, {0x2780, 192, 788}, + {0x2781, 193, 788}, {0x2782, 194, 788}, {0x2783, 195, 788}, + {0x2784, 196, 788}, {0x2785, 197, 788}, {0x2786, 198, 788}, + {0x2787, 199, 788}, {0x2788, 200, 788}, {0x2789, 201, 788}, + {0x278a, 202, 788}, {0x278b, 203, 788}, {0x278c, 204, 788}, + {0x278d, 205, 788}, {0x278e, 206, 788}, {0x278f, 207, 788}, + {0x2790, 208, 788}, {0x2791, 209, 788}, {0x2792, 210, 788}, + {0x2793, 211, 788}, {0x2794, 212, 894}, {0x2192, 213, 838}, + {0x2194, 214, 1016}, {0x2195, 215, 458}, {0x2798, 216, 748}, + {0x2799, 217, 924}, {0x279a, 218, 748}, {0x279b, 219, 918}, + {0x279c, 220, 927}, {0x279d, 221, 928}, {0x279e, 222, 928}, + {0x279f, 223, 834}, {0x27a0, 224, 873}, {0x27a1, 225, 828}, + {0x27a2, 226, 924}, {0x27a3, 227, 924}, {0x27a4, 228, 917}, + {0x27a5, 229, 930}, {0x27a6, 230, 931}, {0x27a7, 231, 463}, + {0x27a8, 232, 883}, {0x27a9, 233, 836}, {0x27aa, 234, 836}, + {0x27ab, 235, 867}, {0x27ac, 236, 867}, {0x27ad, 237, 696}, + {0x27ae, 238, 696}, {0x27af, 239, 874}, {0x27b1, 241, 874}, + {0x27b2, 242, 760}, {0x27b3, 243, 946}, {0x27b4, 244, 771}, + {0x27b5, 245, 865}, {0x27b6, 246, 771}, {0x27b7, 247, 888}, + {0x27b8, 248, 967}, {0x27b9, 249, 888}, {0x27ba, 250, 831}, + {0x27bb, 251, 873}, {0x27bc, 252, 927}, {0x27bd, 253, 970}, + {0x27be, 254, 918}, + +}; + +static const fnt_font_metric fnt_font_metric_14 = +{ + "ZapfDingbats", /* FontName */ + 4L, /* flags */ + fnt_Type1, /* font type */ + cc_none, /* Character collection */ + 0.0, /* ItalicAngle */ + 0, /* isFixedPitch */ + -1, /* llx */ + -143, /* lly */ + 981, /* urx */ + 820, /* ury */ + -100, /* UnderlinePosition */ + 50, /* UnderlineThickness */ + 700, /* CapHeight */ + 0, /* xHeight */ + 800, /* Ascender */ + -200, /* Descender */ + 90, /* StdVW */ + 0, /* StdHW */ + + FNT_DEFAULT_WIDTH, + 0, + NULL, + 0, + NULL, + 202, + fnt_glyph_width_14, + +}; + +#endif /* PDF_BUILTINMETRIC_SUPPORTED */ + + +/* --------------------- Pre-installed CID fonts ---------------------- */ + +/* Font descriptors for the pre-installed CID fonts */ + +static const fnt_font_metric fnt_cid_metrics[] = +{ + + /* Acrobat 4 standard fonts */ + /* ---------------------------------------------------------- */ + { + "HeiseiKakuGo-W5", /* FontName */ + 4L, /* Font flags */ + fnt_CIDFontType0, /* font type */ + -1 * (int) cc_japanese, /* Character collection */ + 0.0, /* ItalicAngle */ + pdc_true, /* isFixedPitch */ + -92, /* llx */ + -250, /* lly */ + 1010, /* urx */ + 922, /* ury */ + -100, /* UnderlinePosition */ + 50, /* UnderlineThickness */ + 737, /* CapHeight */ + 553, /* xHeight */ + 752, /* Ascender */ + -221, /* Descender */ + 114, /* StdVW */ + 0, /* StdHW */ + + FNT_DEFAULT_CIDWIDTH, + 0, + NULL, + + 0, + NULL, + + 0, + (fnt_glyphwidth *) NULL, + + }, + + /* ---------------------------------------------------------- */ + { + "HeiseiMin-W3", /* FontName */ + 6L, /* Font flags */ + fnt_CIDFontType0, /* font type */ + -1 * (int) cc_japanese, /* Character collection */ + 0.0, /* ItalicAngle */ + pdc_true, /* isFixedPitch */ + -123, /* llx */ + -257, /* lly */ + 1001, /* urx */ + 910, /* ury */ + -100, /* UnderlinePosition */ + 50, /* UnderlineThickness */ + 709, /* CapHeight */ + 450, /* xHeight */ + 723, /* Ascender */ + -241, /* Descender */ + 69, /* StdVW */ + 0, /* StdHW */ + + FNT_DEFAULT_CIDWIDTH, + 0, + NULL, + + 0, + NULL, + + 0, + (fnt_glyphwidth *) NULL, + + }, + + /* ---------------------------------------------------------- */ + { + "HYGoThic-Medium", /* FontName */ + 6L, /* Font flags */ + fnt_CIDFontType0, /* font type */ + (int) cc_korean, /* Character collection */ + 0.0, /* ItalicAngle */ + pdc_true, /* isFixedPitch */ + -6, /* llx */ + -145, /* lly */ + 1003, /* urx */ + 880, /* ury */ + -100, /* UnderlinePosition */ + 50, /* UnderlineThickness */ + 737, /* CapHeight */ + 553, /* xHeight */ + 752, /* Ascender */ + -271, /* Descender */ + 58, /* StdVW */ + 0, /* StdHW */ + + FNT_DEFAULT_CIDWIDTH, + 0, + NULL, + + 0, + NULL, + + 0, + (fnt_glyphwidth *) NULL, + + }, + + /* ---------------------------------------------------------- */ + { + "HYSMyeongJo-Medium", /* FontName */ + 6L, /* Font flags */ + fnt_CIDFontType0, /* font type */ + (int) cc_korean, /* Character collection */ + 0.0, /* ItalicAngle */ + pdc_true, /* isFixedPitch */ + -0, /* llx */ + -148, /* lly */ + 1001, /* urx */ + 880, /* ury */ + -100, /* UnderlinePosition */ + 50, /* UnderlineThickness */ + 737, /* CapHeight */ + 553, /* xHeight */ + 752, /* Ascender */ + -271, /* Descender */ + 58, /* StdVW */ + 0, /* StdHW */ + + FNT_DEFAULT_CIDWIDTH, + 0, + NULL, + + 0, + NULL, + + 0, + (fnt_glyphwidth *) NULL, + + }, + + /* ---------------------------------------------------------- */ + { + "MHei-Medium", /* FontName */ + 6L, /* Font flags */ + fnt_CIDFontType0, /* font type */ + (int) cc_traditional_chinese, /* Character collection */ + 0.0, /* ItalicAngle */ + pdc_true, /* isFixedPitch */ + -45, /* llx */ + -250, /* lly */ + 1015, /* urx */ + 887, /* ury */ + -100, /* UnderlinePosition */ + 50, /* UnderlineThickness */ + 737, /* CapHeight */ + 553, /* xHeight */ + 752, /* Ascender */ + -271, /* Descender */ + 58, /* StdVW */ + 0, /* StdHW */ + + FNT_DEFAULT_CIDWIDTH, + 0, + NULL, + + 0, + NULL, + + 0, + (fnt_glyphwidth *) NULL, + + }, + + /* ---------------------------------------------------------- */ + { + "MSung-Light", /* FontName */ + 6L, /* Font flags */ + fnt_CIDFontType0, /* font type */ + (int) cc_traditional_chinese, /* Character collection */ + 0.0, /* ItalicAngle */ + pdc_true, /* isFixedPitch */ + -160, /* llx */ + -259, /* lly */ + 1015, /* urx */ + 888, /* ury */ + -100, /* UnderlinePosition */ + 50, /* UnderlineThickness */ + 737, /* CapHeight */ + 553, /* xHeight */ + 752, /* Ascender */ + -271, /* Descender */ + 58, /* StdVW */ + 0, /* StdHW */ + + FNT_DEFAULT_CIDWIDTH, + 0, + NULL, + + 0, + NULL, + + 0, + (fnt_glyphwidth *) NULL, + + }, + + /* ---------------------------------------------------------- */ + { + "STSong-Light", /* FontName */ + 4L, /* Font flags */ + fnt_CIDFontType0, /* font type */ + (int) cc_simplified_chinese, /* Character collection */ + 0.0, /* ItalicAngle */ + pdc_true, /* isFixedPitch */ + -250, /* llx */ + -143, /* lly */ + 600, /* urx */ + 857, /* ury */ + -100, /* UnderlinePosition */ + 50, /* UnderlineThickness */ + 857, /* CapHeight */ + 599, /* xHeight */ + 857, /* Ascender */ + -143, /* Descender */ + 91, /* StdVW */ + 91, /* StdHW */ + + FNT_DEFAULT_CIDWIDTH, + 0, + NULL, + + 0, + NULL, + + 0, + (fnt_glyphwidth *) NULL, + + }, + + /* Acrobat 5 standard fonts */ + /* ---------------------------------------------------------- */ + { + "HYSMyeongJoStd-Medium-Acro", /* FontName */ + 6L, /* Font flags */ + fnt_CIDFontType0, /* font type */ + (int) cc_korean, /* Character collection */ + 0.0, /* ItalicAngle */ + pdc_true, /* isFixedPitch */ + -28, /* llx */ + -148, /* lly */ + 1001, /* urx */ + 880, /* ury */ + -100, /* UnderlinePosition */ + 50, /* UnderlineThickness */ + 737, /* CapHeight */ + 553, /* xHeight */ + 752, /* Ascender */ + -271, /* Descender */ + 58, /* StdVW */ + 0, /* StdHW */ + + FNT_DEFAULT_CIDWIDTH, + 0, + NULL, + + 0, + NULL, + + 0, + (fnt_glyphwidth *) NULL, + + }, + + /* ---------------------------------------------------------- */ + { + "KozMinPro-Regular-Acro", /* FontName */ + 6L, /* Font flags */ + fnt_CIDFontType0, /* font type */ + (int) cc_japanese, /* Character collection */ + 0.0, /* ItalicAngle */ + pdc_true, /* isFixedPitch */ + -195, /* llx */ + -272, /* lly */ + 1110, /* urx */ + 1075, /* ury */ + -100, /* UnderlinePosition */ + 50, /* UnderlineThickness */ + 737, /* CapHeight */ + 553, /* xHeight */ + 752, /* Ascender */ + -271, /* Descender */ + 58, /* StdVW */ + 0, /* StdHW */ + + FNT_DEFAULT_CIDWIDTH, + 0, + NULL, + + 0, + NULL, + + 0, + (fnt_glyphwidth *) NULL, + + }, + + /* ---------------------------------------------------------- */ + { + "MSungStd-Light-Acro", /* FontName */ + 6L, /* Font flags */ + fnt_CIDFontType0, /* font type */ + (int) cc_traditional_chinese, /* Character collection */ + 0.0, /* ItalicAngle */ + pdc_true, /* isFixedPitch */ + -160, /* llx */ + -249, /* lly */ + 1015, /* urx */ + 1071, /* ury */ + -100, /* UnderlinePosition */ + 50, /* UnderlineThickness */ + 737, /* CapHeight */ + 553, /* xHeight */ + 752, /* Ascender */ + -271, /* Descender */ + 58, /* StdVW */ + 0, /* StdHW */ + + FNT_DEFAULT_CIDWIDTH, + 0, + NULL, + + 0, + NULL, + + 0, + (fnt_glyphwidth *) NULL, + + }, + + /* ---------------------------------------------------------- */ + { + "STSongStd-Light-Acro", /* FontName */ + 6L, /* Font flags */ + fnt_CIDFontType0, /* font type */ + (int) cc_simplified_chinese, /* Character collection */ + 0.0, /* ItalicAngle */ + pdc_true, /* isFixedPitch */ + -134, /* llx */ + -254, /* lly */ + 1001, /* urx */ + 905, /* ury */ + -100, /* UnderlinePosition */ + 50, /* UnderlineThickness */ + 737, /* CapHeight */ + 535, /* xHeight */ + 752, /* Ascender */ + -271, /* Descender */ + 58, /* StdVW */ + 0, /* StdHW */ + + FNT_DEFAULT_CIDWIDTH, + 0, + NULL, + + 0, + NULL, + + 0, + (fnt_glyphwidth *) NULL, + + }, + + /* Acrobat 6 standard fonts */ + /* ---------------------------------------------------------- */ + { + "AdobeMingStd-Light-Acro", /* FontName */ + 6L, /* Font flags */ + fnt_CIDFontType0, /* font type */ + (int) cc_traditional_chinese, /* Character collection */ + 0.0, /* ItalicAngle */ + pdc_true, /* isFixedPitch */ + -38, /* llx */ + -121, /* lly */ + 1002, /* urx */ + 1002, /* ury */ + -75, /* UnderlinePosition */ + 50, /* UnderlineThickness */ + 731, /* CapHeight */ + 466, /* xHeight */ + 880, /* Ascender */ + -120, /* Descender */ + 71, /* StdVW */ + 0, /* StdHW */ + + FNT_DEFAULT_CIDWIDTH, + 0, + NULL, + + 0, + NULL, + + 0, + (fnt_glyphwidth *) NULL, + + }, + + /* ---------------------------------------------------------- */ + { + "AdobeMyungjoStd-Medium-Acro", /* FontName */ + 6L, /* Font flags */ + fnt_CIDFontType0, /* font type */ + (int) cc_korean, /* Character collection */ + 0.0, /* ItalicAngle */ + pdc_true, /* isFixedPitch */ + -28, /* llx */ + -148, /* lly */ + 1001, /* urx */ + 1001, /* ury */ + -75, /* UnderlinePosition */ + 50, /* UnderlineThickness */ + 719, /* CapHeight */ + 478, /* xHeight */ + 880, /* Ascender */ + -120, /* Descender */ + 109, /* StdVW */ + 0, /* StdHW */ + + FNT_DEFAULT_CIDWIDTH, + 0, + NULL, + + 0, + NULL, + + 0, + (fnt_glyphwidth *) NULL, + + }, + + /* ---------------------------------------------------------- */ + { + "AdobeSongStd-Light-Acro", /* FontName */ + 6L, /* Font flags */ + fnt_CIDFontType0, /* font type */ + (int) cc_simplified_chinese, /* Character collection */ + 0.0, /* ItalicAngle */ + pdc_true, /* isFixedPitch */ + -134, /* llx */ + -254, /* lly */ + 1001, /* urx */ + 1001, /* ury */ + -75, /* UnderlinePosition */ + 50, /* UnderlineThickness */ + 626, /* CapHeight */ + 416, /* xHeight */ + 880, /* Ascender */ + -120, /* Descender */ + 71, /* StdVW */ + 0, /* StdHW */ + + FNT_DEFAULT_CIDWIDTH, + 0, + NULL, + + 0, + NULL, + + 0, + (fnt_glyphwidth *) NULL, + + }, + + /* ---------------------------------------------------------- */ + { + "KozGoPro-Medium-Acro", /* FontName */ + 6L, /* Font flags */ + fnt_CIDFontType0, /* font type */ + (int) cc_japanese, /* Character collection */ + 0.0, /* ItalicAngle */ + pdc_true, /* isFixedPitch */ + -149, /* llx */ + -374, /* lly */ + 1254, /* urx */ + 1008, /* ury */ + -75, /* UnderlinePosition */ + 50, /* UnderlineThickness */ + 763, /* CapHeight */ + 549, /* xHeight */ + 880, /* Ascender */ + -120, /* Descender */ + 109, /* StdVW */ + 0, /* StdHW */ + + FNT_DEFAULT_CIDWIDTH, + 0, + NULL, + + 0, + NULL, + + 0, + (fnt_glyphwidth *) NULL, + + }, + + /* Acrobat 7 standard fonts */ + /* ---------------------------------------------------------- */ + { + "KozGoPro-Medium", /* FontName */ + 6L, /* Font flags */ + fnt_CIDFontType0, /* font type */ + (int) cc_japanese, /* Character collection */ + 0.0, /* ItalicAngle */ + pdc_true, /* isFixedPitch */ + -149, /* llx */ + -374, /* lly */ + 1254, /* urx */ + 1008, /* ury */ + -75, /* UnderlinePosition */ + 50, /* UnderlineThickness */ + 763, /* CapHeight */ + 549, /* xHeight */ + 880, /* Ascender */ + -120, /* Descender */ + 109, /* StdVW */ + 0, /* StdHW */ + + FNT_DEFAULT_CIDWIDTH, + 0, + NULL, + + 0, + NULL, + + 0, + (fnt_glyphwidth *) NULL, + + }, + + /* ---------------------------------------------------------- */ + { + "KozMinProVI-Regular", /* FontName */ + 6L, /* Font flags */ + fnt_CIDFontType0, /* font type */ + (int) cc_japanese, /* Character collection */ + 0.0, /* ItalicAngle */ + pdc_true, /* isFixedPitch */ + -437, /* llx */ + -340, /* lly */ + 1144, /* urx */ + 1317, /* ury */ + -75, /* UnderlinePosition */ + 50, /* UnderlineThickness */ + 742, /* CapHeight */ + 503, /* xHeight */ + 880, /* Ascender */ + -120, /* Descender */ + 87, /* StdVW */ + 0, /* StdHW */ + + FNT_DEFAULT_CIDWIDTH, + 0, + NULL, + + 0, + NULL, + + 0, + (fnt_glyphwidth *) NULL, + + }, + + /* ---------------------------------------------------------- */ + { + "AdobeMyungjoStd-Medium", /* FontName */ + 6L, /* Font flags */ + fnt_CIDFontType0, /* font type */ + (int) cc_korean, /* Character collection */ + 0.0, /* ItalicAngle */ + pdc_true, /* isFixedPitch */ + -28, /* llx */ + -148, /* lly */ + 1001, /* urx */ + 880, /* ury */ + -100, /* UnderlinePosition */ + 50, /* UnderlineThickness */ + 719, /* CapHeight */ + 478, /* xHeight */ + 880, /* Ascender */ + -120, /* Descender */ + 109, /* StdVW */ + 0, /* StdHW */ + + FNT_DEFAULT_CIDWIDTH, + 0, + NULL, + + 0, + NULL, + + 0, + (fnt_glyphwidth *) NULL, + + }, + + /* ---------------------------------------------------------- */ + { + "AdobeSongStd-Light", /* FontName */ + 6L, /* Font flags */ + fnt_CIDFontType0, /* font type */ + (int) cc_simplified_chinese, /* Character collection */ + 0.0, /* ItalicAngle */ + pdc_true, /* isFixedPitch */ + -134, /* llx */ + -254, /* lly */ + 1001, /* urx */ + 905, /* ury */ + -100, /* UnderlinePosition */ + 50, /* UnderlineThickness */ + 626, /* CapHeight */ + 416, /* xHeight */ + 880, /* Ascender */ + -120, /* Descender */ + 71, /* StdVW */ + 0, /* StdHW */ + + FNT_DEFAULT_CIDWIDTH, + 0, + NULL, + + 0, + NULL, + + 0, + (fnt_glyphwidth *) NULL, + + }, + + /* ---------------------------------------------------------- */ + { + "AdobeMingStd-Light", /* FontName */ + 6L, /* Font flags */ + fnt_CIDFontType0, /* font type */ + (int) cc_traditional_chinese, /* Character collection */ + 0.0, /* ItalicAngle */ + pdc_true, /* isFixedPitch */ + -38, /* llx */ + -121, /* lly */ + 1002, /* urx */ + 918, /* ury */ + -75, /* UnderlinePosition */ + 50, /* UnderlineThickness */ + 731, /* CapHeight */ + 466, /* xHeight */ + 880, /* Ascender */ + -120, /* Descender */ + 71, /* StdVW */ + 0, /* StdHW */ + + FNT_DEFAULT_CIDWIDTH, + 0, + NULL, + + 0, + NULL, + + 0, + (fnt_glyphwidth *) NULL, + + } +}; + +#define FNT_NUM_OF_CIDFONTS \ + ((int) (sizeof(fnt_cid_metrics)/sizeof(fnt_font_metric))) + + +#ifdef PDF_CJKFONTWIDTHS_SUPPORTED + +/* + * PDF width arrays for glyph widths indexed by CID + * of Acrobat CJK standard fonts (see above). + * + * Format: + * + * 1 font name string, + * 4 strings for widths + * --- + * 5 (see define FNT_CIDMETRIC_INCR in ft_cid.h) + * + * Because of compiler warnings each width block must + * be divided at least into 4 parts. + * + */ + +static const char *fnt_cid_width_arrays[] = +{ + /*------------------------------------------------------------------------*/ + "HeiseiKakuGo-W5", + + "1[278 278 355 556 556 889 667 191 333 333 389 584 278 333 278\n" + "278 556 556 556 556 556 556 556 556 556 556 278 278 584 584 584\n" + "556 1015 667 667 722 722 667 611 778 722 278 500 667 556 833 722\n" + "778 667 778 722 667 611 722 667 944 667 667 611 278 556 278 469\n" + "556 333 556 556 500 556 556 278 556 556 222 222 500 222 833 556\n", + + "556 556 556 333 500 278 556 500 722 500 500 500 334 260 334 333\n" + "1000 278 1000 260 1000 333 556 556 167 1000 1000 556 1000 556 333 333\n" + "500 500 556 1000 1000 278 1000 350 222 333 1000 556 1000 1000 611]\n" + "127 137 333\n" + "140[370 556 778 1000\n", + + "365 889 278 222 611 944 611 584 737 584 737 1000 1000 333 333 556\n" + "333 834 834 834 667 667 667 667 667 667 722 667 667 667 667 278\n" + "278 278 278 722 722 778 778 778 778 778 1000 722 722 722 722 667\n" + "667 556 556 556 556 556 556 500 556 556 556 556 278 278 278 278\n", + + "556 556 556 556 556 556 556 1000 556 556 556 556 500 556 500 667\n" + "667 611 556 500 1000 500 556]\n" + "231 632 500\n" + "8718 8719 500", + + + /*------------------------------------------------------------------------*/ + "HeiseiMin-W3", + + "1[250 333 408 500 500 833 778 180 333 333 500 564 250 333 250\n" + "278 500 500 500 500 500 500 500 500 500 500 278 278 564 564 564\n" + "444 921 722 667 667 722 611 556 722 722 333 389 722 611 889 722\n" + "722 556 722 667 556 611 722 722 944 722 722 611 333 500 333 469\n" + "500 333 444 500 444 500 444 333 500 500 278 278 500 278 778 500\n", + + "500 500 500 333 389 278 500 500 722 500 500 444 480 200 480 333\n" + "1000 278 1000 200 1000 333 500 500 167 1000 1000 500 1000 500 333 333\n" + "556 556 500 1000 1000 250 1000 350 333 444 1000 500 1000 1000 444]\n" + "127 137 333\n", + + "139[889 276 611 722 889\n" + "310 667 278 278 500 722 500 564 760 564 760 1000 1000 300 300 500\n" + "300 750 750 750 722 722 722 722 722 722 667 611 611 611 611 333\n" + "333 333 333 722 722 722 722 722 722 722 1000 722 722 722 722 722\n" + "556 444 444 444 444 444 444 444 444 444 444 444 278 278 278 278\n", + + "500 500 500 500 500 500 500 1000 500 500 500 500 500 500 500 556\n" + "722 611 500 389 980 444]\n" + "230 632 500\n" + "8718 8719 500", + + + /*------------------------------------------------------------------------*/ + "HYGoThic-Medium", + + "1[333 416 416 833 666 916 750 250 416 416 583 833 375 833 375\n" + "375 583 583 583 583 583 583 583 583 583 583 416 416 833 833 833\n", + + "583 1000 666 708 750 750 666 625 833 750 291 541 708 583 875 750\n" + "791 666 791 708 666 583 750 625 916 625 625 625 416 375 416 500\n", + + "500 500 583 625 583 625 583 375 625 583 250 250 541 250 916 625\n", + + "625 625 625 333 541 333 583 500 750 500 500 500 500 500 500 750]", + + + /*------------------------------------------------------------------------*/ + "HYSMyeongJo-Medium", + + "1[278 278 355 556 556 889 667 222 333 333 389 584 278 333 278\n" + "278 556 556 556 556 556 556 556 556 556 556 278 278 584 584 584\n", + + "556 1015 667 667 722 722 667 611 778 722 278 500 667 556 833 722\n" + "778 667 778 722 667 611 722 667 944 667 667 611 278 278 278 469\n", + + "556 222 556 556 500 556 556 278 556 556 222 222 500 222 833 556\n", + + "556 556 556 333 500 278 556 500 722 500 500 500 334 260 334 584]", + + + /*------------------------------------------------------------------------*/ + "MHei-Medium", /* identical with HYSMyeongJo-Medium */ + + "1[278 278 355 556 556 889 667 222 333 333 389 584 278 333 278\n" + "278 556 556 556 556 556 556 556 556 556 556 278 278 584 584 584\n", + + "556 1015 667 667 722 722 667 611 778 722 278 500 667 556 833 722\n" + "778 667 778 722 667 611 722 667 944 667 667 611 278 278 278 469\n", + + "556 222 556 556 500 556 556 278 556 556 222 222 500 222 833 556\n", + + "556 556 556 333 500 278 556 500 722 500 500 500 334 260 334 584]", + + + /*------------------------------------------------------------------------*/ + "MSung-Light", + + "1[250 250 408 668 490 875 698 250 240 240 417 667 250 313 250\n" + "520 500 500 500 500 500 500 500 500 500 500 250 250 667 667 667\n", + + "396 921 677 615 719 760 625 552 771 802 354 354 781 604 927 750\n" + "823 563 823 729 542 698 771 729 948 771 677 635 344 520 344 469\n", + + "500 250 469 521 427 521 438 271 469 531 250 250 458 240 802 531\n", + + "500 521 521 365 333 292 521 458 677 479 458 427 480 496 480 667]", + + + /*------------------------------------------------------------------------*/ + "STSong-Light", + + "1[207 270 342 467 462 797 710 239 374 374 423 605 238 375 238\n" + "334 462 462 462 462 462 462 462 462 462 462 238 238 605 605 605\n", + + "344 748 684 560 695 739 563 511 729 793 318 312 666 526 896 758\n" + "772 544 772 628 465 607 753 711 972 647 620 607 374 333 374 606\n", + + "500 239 417 503 427 529 415 264 444 518 241 230 495 228 793 527\n", + + "524 524 504 338 336 277 517 450 652 466 452 407 370 258 370 605]", + + + /*------------------------------------------------------------------------*/ + "HYSMyeongJoStd-Medium-Acro", + + "1[333 416 416 833 625 916 833 250 500 500 500 833 291 833 291\n" + "375 625 625 625 625 625 625 625 625 625 625 333 333 833 833 916\n", + + "500 1000 791 708 708 750 708 666 750 791 375 500 791 666 916 791\n" + "750 666 750 708 666 791 791 750 1000 708 708 666 500 375 500 500\n", + + "500 333 541 583 541 583 583 375 583 583 291 333 583 291 875 583\n", + + "583 583 583 458 541 375 583 583 833 625 625 500 583 583 583 750]", + + + /*------------------------------------------------------------------------*/ + "KozMinPro-Regular-Acro", + + "1[278 299 353 614 614 721 735 216 323 323 449 529 219 306 219\n" + "453 614 614 614 614 614 614 614 614 614 614 219 219 529 529 529\n" + "486 744 646 604 617 681 567 537 647 738 320 433 637 566 904 710\n" + "716 605 716 623 517 601 690 668 990 681 634 578 316 614 316 529\n" + "500 387 509 566 478 565 503 337 549 580 275 266 544 276 854 579\n" + "550 578 566 410 444 340 575 512 760 503 529 453 326 380 326 387\n" + "1000 453 1000 380 1000 299 614 614 265 1000 1000 614 1000 451 291 291\n", + + "588 589 500 1000 1000 219 1000 452 216 353 1000 451 1000 1000 486 387]\n" + "128 135 387\n" + "136[387 387 1000 880 448 566 716 903\n" + "460 805 275 276 550 886 582 529 738 529 738 1000 1000 406 406 575\n" + "406 934 934 934 646 646 646 646 646 646 617 567 567 567 567 320\n" + "320 320 320 681 710 716 716 716 716 716 1000 690 690 690 690 634\n" + "605 509 509 509 509 509 509 478 503 503 503 503 275 275 275 275\n", + + "550 579 550 550 550 550 550 1000 575 575 575 575 529 578 529 517\n" + "634 578 445 444 842 453 1000 500]\n" + "323[500 1000 500 1000 500]\n" + "328 383 500\n" + "384[500 500 500 500 500 500]\n" + "9354[614 684 1000 1000 648 899\n", + + "903 509 275 575 503 550 646 320 690 567 716 934 934 934 934 934\n" + "934 426 426 426 426 426 426 426 426 425 425 425 439 426 426 426\n" + "426 426 646 567 1000 567 320 1000 320 716 1000 690 690 690 509 503\n" + "1000 503 275 1000 275 550 1000 575 575 575 513 1000 1000 805 1000 478\n" + "1000 1000 503 1000 1000 735 1000 1000 426 1000 1000 1000 578 553 512\n" + "1000 1000 640 594 284]", + + + /*------------------------------------------------------------------------*/ + "MSungStd-Light-Acro", + + "1[250 250 408 668 490 875 698 250 240 240 417 667 250 313 250\n" + "520 500 500 500 500 500 500 500 500 500 500 250 250 667 667 667\n", + + "396 921 677 615 719 760 625 552 771 802 354 354 781 604 927 750\n" + "823 563 823 729 542 698 771 729 948 771 677 635 344 520 344 469\n", + + "500 250 469 521 427 521 438 271 469 531 250 250 458 240 802 531\n", + + "500 521 521 365 333 292 521 458 677 479 458 427 480 496 480 667]\n" + "17601 17601 500", + + + /*------------------------------------------------------------------------*/ + "STSongStd-Light-Acro", + + "1[207 270 342 467 462 797 710 239 374 374 423 605 238 375 238\n" + "334 462 462 462 462 462 462 462 462 462 462 238 238 605 605 605\n", + + "344 748 684 560 695 739 563 511 729 793 318 312 666 526 896 758\n" + "772 544 772 628 465 607 753 711 972 647 620 607 374 333 374 606\n", + + "500 239 417 503 427 529 415 264 444 518 241 230 495 228 793 527\n", + + "524 524 504 338 336 277 517 450 652 466 452 407 370 258 370 605]\n" + "22353[462 462 1000 1000 500]", + + + /*------------------------------------------------------------------------*/ + "AdobeMingStd-Light-Acro", + + "0[1000 251 347 405 739 504 758 825 281 293 294 494 620 251 373 252\n" + "309 503 503 503 503 504 503 502 503 503 504 251 251 621 621 621\n", + + "405 1042 749 673 679 679 685 671 738 736 333 494 729 696 901 720\n" + "750 674 746 672 627 769 707 777 887 709 716 616 279 309 277 352\n", + + "575 294 500 511 502 549 494 356 516 550 321 321 510 317 738 533\n" + "535 545 533 376 443 361 529 526 742 534 576 439 447 262 446 472]\n", + + "96 17600 1000\n" + "17601[639]\n" + "17602 18964 1000", + + + /*------------------------------------------------------------------------*/ + "AdobeMyungjoStd-Medium-Acro", + + "0[1000 333 416 416 833 625 916 833 250 500 500 500 833 291\n" + "833 291 375]\n", + + "17 26 625\n" + "27[333 333 833 833 916 500 1000 791 708 708 750 708 666 750 791 375\n", + + "500 791 666 916 791 750 666 750 708 666 791 791 750 1000 708 708\n" + "666 500 375 500 500 500 333 541 583 541 583 583 375 583 583 291\n", + + "333 583 291 875 583 583 583 583 458 541 375 583 583 833 625 625\n" + "500 583 583 583 750 1000 500]\n" + "98 18351 1000", + + + /*------------------------------------------------------------------------*/ + "AdobeSongStd-Light-Acro", + + "0[1000 207 270 342 467 462 797 710 239 374 374 423 605 238 375\n" + "238 334]\n" + "17 26 462\n", + + "27[238 238 605 605 605 344 748 684 560 695 739 563 511 729 793 318\n" + "312 666 526 896 758 772 544 772 628 465 607 753 711 972 647 620\n" + "607 374 333 374 606 500 239 417 503 427 529 415 264 444 518 241\n", + + + "230 495 228 793 527 524 524 504 338 336 277 517 450 652 466 452\n" + "407 370 258 370 605]\n" + "96 22352 1000\n", + + "22353[462 462 1000 1000 500]\n" + "22358 29063 1000", + + + /*------------------------------------------------------------------------*/ + "KozGoPro-Medium-Acro", + + "0[1000 224 266 392 551 562 883 677 213 322 322 470 677 247 343\n" + "245 370]\n" + "17 26 562\n" + "27[245 247 677 677 677 447 808 661 602 610 708 535 528 689 703 275\n" + "404 602 514 871 708 727 585 727 595 539 541 696 619 922 612 591\n" + "584 322 562 322 677 568 340 532 612 475 608 543 332 603 601 265\n" + "276 524 264 901 601 590 612 607 367 433 369 597 527 800 511 518\n" + "468 321 273 321 341 1000 362 1000 273 1000 266 562 562 456 1000 1000\n", + + "562 1000 472 283 283 587 588 568 1000 1000 247 1000 330 239 418 1000\n" + "472 1000 1000 447 340 340 340 340 340 340 455 340 340 340 340 1136\n" + "857 384 519 727 952 398 834 264 275 590 918 605 677 769 677 473\n" + "1000 1000 347 340 599 284 845 845 845 661 661 661 661 661 661 610\n" + "535 535 535 535 275 275 275 275 715 708 727 727 727 727 727 1000\n" + "696 696 696 696 591 584 532 532 532 532 532 532 475 543 543 543\n", + + "543 264 264 264 264 584 601 590 590 590 590 590 1000 597 597 597\n" + "597 518 612 518 539 591 584 446 433 683 468 1000 500]\n" + "232 322 1000\n" + "323[500 1000 500 1000]\n" + "327 389 500\n" + "390 9353 1000\n" + "9354[562 753 1000 1000 650 909 909 532 264 597 543 590 661 275 696 535\n", + + "727 845 845 845 845 845 845 375 387 345 369 328 366 364 375 284\n" + "347 340 387 345 369 328 366 364 661 535 1000 535 275 1000 275 727\n" + "1000 696 696 696 532 543 1000 543 264 1000 264 590 1000 597 597 597\n" + "596 1000 1000 834 1000 475 1000 1000 543 1000 1000 759 1000 1000 478\n" + "1000 1000 1000 602 579 527 1000 1000 509 465 280]\n" + "9444 15443 1000", + + + /*------------------------------------------------------------------------*/ + "KozGoPro-Medium", + + "1[224 266 392 551 562 883 677 213 322 322 470 677 247 343 245 370]\n" + "17 26 562\n" + "27[245 247 677 677 677 447 808 661 602 610 708 535 528 689 703\n" + "275 404 602 514 871 708 727 585 727 595 539 541 696 619 922 612\n" + "591 584 322 562 322 677 568 340 532 612 475 608 543 332 603 601\n" + "265 276 524 264 901 601 590 612 607 367 433 369 597 527 800 511\n" + "518 468 321 273 321 341 241 362 241 273 677 266 562 562 456 562\n" + "571 562 416 472 283 283 587 588 568 545 545 247 561 330 239 418\n" + "416 472 1136 1288 447 340 340 340 340 340 340 455 340 340 340 340\n" + "1136 857 384 519 727 952 398 834 264 275 590 918 605 677 769 677\n" + "473 361 677 347 340 599 284 845 845 845 661 661 661 661 661 661\n" + "610 535 535 535 535 275 275 275 275 715 708 727 727 727 727 727\n", + + "677 696 696 696 696 591 584 532 532 532 532 532 532 475 543 543\n" + "543 543 264 264 264 264 584 601 590 590 590 590 590 677 597 597\n" + "597 597 518 612 518 539 591 584 446 433 683 468 562]\n" + "231 632 500\n" + "8718[500 500]\n" + "9354[562 753 245 436 650 909 909 532 264 597 543 590 661 275 696\n" + "535 727 845 845 845 845 845 845 375 387 345 369 328 366 364 375\n" + "284 347 340 387 345 369 328 366 364 661 535 535 535 275 275 275\n" + "727 727 696 696 696 532 543 543 543 264 264 264 590 590 597 597\n" + "597 596 596 596 834 834 475 475 475 543 543 543 759 759 759 478\n" + "478 478 276 602 579 527 527 527 509 465 280 197 270 359 545 546\n" + "869 664 188 322 322 469 676 249 343 249 359 545]\n", + + "9461 9469 546\n" + "9470[249 249 676 676 676 429 791 620 573 581 688 511 504 665 681\n" + "269 395 572 477 844 677 709 555 709 573 509 515 663 593 898 565\n" + "562 557 322 546 322 676 567 427 566 571 447 570 498 320 567 577\n" + "258 254 507 257 870 577 564 572 568 359 409 343 572 500 767 486\n" + "487 448 322 245 322 427 228 363 228 245 676 269 546 546 442 546\n" + "559 546 404 465 275 275 562 562 568 533 534 249 550 326 228 404\n" + "404 464 1136 1250 429 427 427 427 427 427 427 423 427 427 427 427\n" + "1136 835 396 492 709 923 388 781 258 270 567 858 592 677 765 677\n" + "443 361 677 358 354 573 343 840 840 840 620 620 620 620 620 620\n" + "581 511 511 511 511 269 269 269 269 700 677 709 709 709 709 709\n", + + "677 663 663 663 663 562 555 566 566 566 566 566 566 447 498 498\n" + "498 498 258 258 258 258 562 577 564 564 564 564 564 677 572 572\n" + "572 572 487 573 487 509 562 557 446 409 735 448 546 546 726 241\n" + "432 629 868 868 566 258 572 498 564 620 269 663 511 709 840 840\n" + "840 840 840 840 362 361 355 361 354 363 360 362 343 358 354 361\n" + "355 362 354 363 360 620 511 511 511 269 269 269 709 709 663 663\n" + "663 566 498 498 498 258 258 258 564 564 572 572 572]\n" + "9738 9757 250\n" + "9758 9778 333\n" + "12063 12087 500\n", + + + /*------------------------------------------------------------------------*/ + "KozMinProVI-Regular", + + "1[278 299 353 614 614 721 735 216 323 323 449 529 219 306 219\n" + "453]\n" + "17 26 614\n" + "27[219 219 529 529 529 486 744 646 604 617 681 567 537 647 738\n" + "320 433 637 566 904 710 716 605 716 623 517 601 690 668 990 681\n" + "634 578 316 614 316 529 500 387 509 566 478 565 503 337 549 580\n" + "275 266 544 276 854 579 550 578 566 410 444 340 575 512 760 503\n" + "529 453 326 380 326 387 216 453 216 380 529 299 614 614 265 614\n" + "475 614 353 451 291 291 588 589 500 476 476 219 494 452 216 353\n" + "353 451]\n" + "125[1075 486]\n" + "127 137 387\n" + "139[880 448 566 716 903 460 805 275 276 550 886 582 529 738 529\n" + "738 357 529 406 406 575 406 934 934 934 646 646 646 646 646 646\n" + "617 567 567 567 567 320 320 320 320 681 710 716 716 716 716 716\n" + "529 690 690 690 690 634 605 509 509 509 509 509 509 478 503 503\n" + "503 503 275 275 275 275 550 579 550 550 550 550 550 529 575 575\n" + "575 575 529 578 529 517 634 578 445 444 842 453 614]\n" + "231 632 500\n" + "8718[500 500]\n" + "9354[614 684 216 353 648 899 903 509 275 575 503 550 646 320 690\n" + "567 716 934 934 934 934 934 934]\n" + "9377 9384 426\n" + "9385[425 425 425 439 426 426 426 426 426 646 567 567 567 320 320\n" + "320 716 716 690 690 690 509 503 503 503 275 275 275 550 550 575\n" + "575 575 542 542 542 816 816 486 486 486 517 517 517 758 758 758\n" + "426 426 426 286 597 568 522 522 522 640 611 312 257 281 288 546\n" + "546 703 705 160 312 305 389 545 200 309 200 438]\n" + "9460 9469 546\n", + + "9470[200 200 545 545 545 471 744 607 572 563 650 550 516 622 696\n" + "312 314 603 524 848 665 644 561 645 583 491 566 643 581 872 616\n" + "537 516 312 546 312 472 464 400 548 530 447 558 460 301 486 564\n" + "283 258 509 265 834 578 521 554 551 390 410 335 565 476 717 525\n" + "464 456 312 339 312 400 179 422 177 339 545 281 546 546 248 546\n" + "491 570 310 440 278 279 556 563 586 403 403 207 500 440 170 307\n" + "310 440 786 1009 471 367 400 400 400 400 400 400 364 400 365 400\n" + "1012 849 394 544 644 889 377 744 283 285 521 808 545 504 703 545\n" + "703 324 504 397 397 557 397 859 859 859 607 607 607 607 607 607\n" + "562 550 550 550 550 312 312 312 312 662 665 644 644 644 644 644\n" + "497 643 643 643 643 537 576 548 548 548 548 548 548 446 460 460\n" + "460 460 283 283 283 283 522 578 521 521 521 521 521 545 565 565\n" + "565 565 464 540 464 491 537 516 418 410 842 456 546 563 627 196\n" + "289 560 828 835 548 283 565 460 521 607 312 643 550 644 859 859\n" + "859 859 859 859]\n" + "9697 9713 397\n" + "9714[607 550 550 550 312 312 312 644 644 643 643 643 548 460 460\n" + "460 283 283 283 521 521 565 565 565]\n" + "9738 9757 250\n" + "9758 9778 333\n" + "12063 12087 500\n" + "15449[670 810 640 760]\n" + "15455[980 529 529 529 619 529 891]\n" + "15464[529 529 529 529 534 534 566 566 530 529 529 529 529 581 529\n" + "529 533 533 738 853 676 533 882 882 882 716 716 600 529 589 688\n" + "529 529 559 559 594 619 522 529 468 721 529 529 529 525 529 529\n" + "661 529 660 564 684 500 790 940 870]\n" + "15521[630 740 740 900 840 980]\n" + "15529[900 940 710 870 970]\n" + "15535[820 930 840 940 850 850 960 960]\n" + "15545[960 980 940 970 910 950 870 980 980 910 930 820 850 980 950]\n" + "15562[970 980 980 980]\n" + "15575[980 990 990 880]\n" + "15581[960 850 860]\n", + + "15585[840 950 740 870 830 760 890 990 900 870 990 970 980 950 960]\n" + "15601[850 830 950 930 810 980 910 780 890 760 880 790 870 830 980\n" + "830 900 900 950 940 950 820 910 930 960 880 930 960 980 920 940\n" + "920 950 970 980 890 930 860 930 960 990 820 920 960 930 970 760\n" + "780 920 970 830 950 830 990 990 990 840 890 890 900 940 940 980\n" + "980 980 970 970 970 960 800 950 820 960 810 950 810 990 730 850\n" + "880 760 990 910 920 770 870 970 980 840 920 950 810 800 940 950\n" + "900 960 910 960 960 750 740 860 850 640 690 900 750 740 840 770\n" + "800 790 730 640 860 760 790]\n" + "15723[770 780 529 529 934 841 904 854 710 579 575 575 575 575 646\n" + "387 566 517 517 601 578 578 509 387 313 444 387 444 340 453 387\n" + "453 623 646 566 617 617 567 681 710 710 716 623 690 601 410 509\n" + "276 478 478 503 605 565 579 579 550 410 575 340 387 617 647 738\n" + "433 517 690 478 549 580 266 444 575 869 537 421 364 593 429 310\n" + "573 594 432 452 462 403 275 286 597 285 526 576 876 575 598 384\n" + "384 598 725 421 579 578 300 580 664 293 593 517 426 524 530 876\n" + "564 565 556 775 594 384 384 500 517 414 597 0 238 238 288 558\n" + "391]\n", + + "15851 15857 421\n" + "15858 15866 0\n" + "15867[393]\n" + "15868 15879 0\n" + "15880[468 624 624 541 484 367 580 738 635 555 505 546 598 500 447\n" + "290 474 310 331 220 466 632 976 529 529 882 882 882 446 526 544\n" + "431 627 500 859 848 834 665 578 565 565 565 565 607 524 491 491\n" + "566 516 516 548 265 410 410 335 456 456 583 607 524 563 563 550\n" + "650 665 665 644 583 643 566 390 548 265 447 447 460 558 558 578\n" + "578 521 390 565 335 563 622 696 314 491 643 447 486 564 258 410\n" + "565]\n" + "20317[386 386 458 446 807 677 734 739 563 692 598 514 538 302 575\n" + "337 616 564 645 645 645 314 314 630 563 563 709 618 689 689 689\n" + "689 689 990 633 476 499 546 546 546 270 538 272 272 575 405 570\n" + "757 526 903 669 723 589 589 589 400 400 373 390 732 657 691 613\n" + "521 628 563 534 505 272 574 331 560 546 619 619 619 306 306 597\n" + "521 521 662 576 641 641 641 641 641 867 531 445 457 483 483 483\n" + "279 505 262 262 574 385 561 714 460 1010 601 743 545 545 643]\n", + + + /*------------------------------------------------------------------------*/ + "AdobeMyungjoStd-Medium", + + "1[333 416 416 833 625 916 833 250 500 500 500 833 291 833 291\n" + "375]\n" + "17 26 625\n", + + "27[333 333 833 833 916 500]\n" + "34[791 708 708 750 708 666 750 791 375 500 791 666 916 791 750\n", + + "666 750 708 666 791 791 750]\n" + "57[708 708 666 500 375 500 500 500 333 541 583 541 583 583 375\n", + + "583 583 291 333 583 291 875 583 583 583 583 458 541 375 583 583\n" + "833 625 625 500 583 583 583 750]\n" + "97[500]\n" + "8094 8190 500\n", + + + /*------------------------------------------------------------------------*/ + "AdobeSongStd-Light", + + "1[207 270 342 467 462 797 710 239 374 374 423 605 238 375 238\n" + "334]\n" + "17 26 462\n", + + "27[238 238 605 605 605 344 748 684 560 695 739 563 511 729 793 \n" + "318 312 666 526 896 758 772 544 772 628 465 607 753 711 972 647\n", + + "620 607 374 333 374 606 500 239 417 503 427 529 415 264 444 518\n" + "241 230 495 228 793 527 524 524 504 338 336 277 517 450 652 466\n", + + "452 407 370 258 370 605]\n" + "814 939 500\n" + "7712[517 684 723]\n" + "7716[500]\n" + "22353[462 462 500 500 500]\n", + + + /*------------------------------------------------------------------------*/ + "AdobeMingStd-Light", + + "1[251 347 405 739 504 758 825 281 293 294 494 620 251 373 252\n" + "309 503 503 503 503 504 503 502 503 503 504 251 251 621 621 621\n", + + "405 1042 749 673 679 679 685 671 738 736 333 494 729 696 901 720\n" + "750 674 746 672 627 769 707 777 887 709 716 616 279 309 277 352\n", + + "575 294 500 511 502 549 494 356 516 550 321 321 510 317 738 533\n" + "535 545 533 376 443 361 529 526 742 534 576 439 447 262 446 472]\n", + + "13648 13742 500\n" + "17601[639]\n" + "17603[500]\n" +}; + +#endif /* PDF_CJKFONTWIDTHS_SUPPORTED */ + +#endif /* FT_COREMETR_H */ diff --git a/src/pdflib/font/ft_font.c b/src/pdflib/font/ft_font.c new file mode 100644 index 0000000..53a39a9 --- /dev/null +++ b/src/pdflib/font/ft_font.c @@ -0,0 +1,532 @@ +/*---------------------------------------------------------------------------* + | PDFlib - A library for generating PDF on the fly | + +---------------------------------------------------------------------------+ + | Copyright (c) 1997-2006 Thomas Merz and PDFlib GmbH. All rights reserved. | + +---------------------------------------------------------------------------+ + | | + | This software is subject to the PDFlib license. It is NOT in the | + | public domain. Extended versions and commercial licenses are | + | available, please check http://www.pdflib.com. | + | | + *---------------------------------------------------------------------------*/ + +/* $Id: ft_font.c,v 1.1 2008/10/17 06:10:43 scuri Exp $ + * + * FONT basic font functions + * + */ + +#define FT_FONT_C + +#include "ft_font.h" + + +static pdc_error_info fnt_errors[] = +{ +#define fnt_genInfo 1 +#include "ft_generr.h" +}; + +#define N_FNT_ERRORS (sizeof fnt_errors / sizeof (pdc_error_info)) + +void +fnt_register_errtab(pdc_core *pdc) +{ + pdc_register_errtab(pdc, PDC_ET_FONT, fnt_errors, N_FNT_ERRORS); +} + +static void +fnt_init_font_metric(fnt_font_metric *metric) +{ + metric->name = NULL; + metric->flags = 0L; + metric->type = fnt_unknownType; + metric->charcoll = (int) cc_none; + + /* + * Fill in some reasonable default values in global font info in + * case they're missing from the metrics data. + */ + metric->italicAngle = 0; + metric->isFixedPitch = pdc_false; + metric->llx = FNT_MISSING_FONTVAL; + metric->lly = FNT_MISSING_FONTVAL; + metric->urx = FNT_MISSING_FONTVAL; + metric->ury = FNT_MISSING_FONTVAL; + metric->underlinePosition = -100; + metric->underlineThickness = FNT_DEFAULT_UNDERLINEWIDTH; + metric->ascender = FNT_MISSING_FONTVAL; + metric->descender = FNT_MISSING_FONTVAL; + metric->capHeight = FNT_MISSING_FONTVAL; + metric->xHeight = FNT_MISSING_FONTVAL; + metric->StdHW = 0; + metric->StdVW = 0; + + metric->defwidth = FNT_DEFAULT_WIDTH; + metric->numwidths = 0; + metric->widths = NULL; + metric->numinters = 0; + metric->ciw = NULL; + metric->numglwidths = 0; + metric->glw = NULL; + +} + +void +fnt_init_font(fnt_font *font) +{ + fnt_init_font_metric(&font->m); + + font->name = NULL; + font->utf8name = NULL; + font->filename = NULL; + font->isstdfont = pdc_false; + font->ishostfont = pdc_false; + font->issymbfont = pdc_true; + font->hasdescr = pdc_false; + font->vertical = pdc_false; + font->spacechar = 0; + font->spacewidth = 0; + font->linegap = FNT_MISSING_FONTVAL; + font->weight = 0; + font->vertical = pdc_false; + pdc_identity_matrix(&font->matrix); + font->bbox.llx = 0; + font->bbox.lly = 0; + font->bbox.urx = 0; + font->bbox.ury = 0; + font->fsscale = 1.0; + font->enc = pdc_invalidenc; + font->numglyphs = 0; + font->numcodes = 0; + font->gid2code = NULL; + font->code2gid = NULL; + font->embedded = pdc_false; + font->cmapname = NULL; + font->imgname = NULL; + font->filelen = 0; + font->img = NULL; +} + +static void +fnt_cleanup_font_metric(pdc_core *pdc, fnt_font_metric *metric) +{ + if (metric->name != NULL) + { + pdc_free(pdc, metric->name); + metric->name = NULL; + } + + if (metric->widths != NULL) + { + pdc_free(pdc, metric->widths); + metric->widths = NULL; + } + + if (metric->ciw != NULL) + { + pdc_free(pdc, metric->ciw); + metric->ciw = NULL; + } + + if (metric->glw != NULL) + { + pdc_free(pdc, metric->glw); + metric->glw = NULL; + } + + +} + +void +fnt_cleanup_fontimg(pdc_core *pdc, fnt_font *font) +{ + if (font->img != NULL && font->imgname == NULL) + { + pdc_free(pdc, font->img); + font->img = NULL; + } + + if (font->imgname != NULL) + { + pdc_free(pdc, font->imgname); + font->imgname = NULL; + } +} + +void +fnt_cleanup_font(pdc_core *pdc, fnt_font *font) +{ + int i = 0; + + (void) i; + + fnt_cleanup_font_metric(pdc, &font->m); + + if (font->name != NULL) + { + pdc_free(pdc, font->name); + font->name = NULL; + } + + if (font->utf8name != NULL) + { + pdc_free(pdc, font->utf8name); + font->utf8name = NULL; + } + + if (font->filename != NULL) + { + pdc_free(pdc, font->filename); + font->filename = NULL; + } + + /* delete font specific encoding vector */ + if (font->enc >= pdc_firstvarenc) + { + pdc_encodingvector *ev = pdc_get_encoding_vector(pdc, font->enc); + + if (ev != NULL && ev->flags & PDC_ENC_FONT) + pdc_remove_encoding_vector(pdc, (int) font->enc); + } + + if (font->gid2code != NULL) + { + pdc_free(pdc, font->gid2code); + font->gid2code = NULL; + } + + if (font->code2gid != NULL) + { + pdc_free(pdc, font->code2gid); + font->code2gid = NULL; + } + + + + if (font->cmapname != NULL) + { + pdc_free(pdc, font->cmapname); + font->cmapname = NULL; + } + + + fnt_cleanup_fontimg(pdc, font); +} + +/* + * we assume: + * code!=0 --> gid=0 --> gid=-1 or code=0 <--> gid=0 + * + */ +int +fnt_get_glyphid(int code, fnt_font *font) +{ + if (code >= 0 && code < font->numcodes) + { + if (font->code2gid != NULL) + { + int gid = font->code2gid[code]; + + if (gid) + return gid; + } + else + { + /* this is temporary. for Type1 fonts there is no information + * about glyphs at present. we assume identity code = glyph id. + */ + return code; + } + } + + if (!code) + return 0; + + return -1; +} + +/* + * we assume: + * gid!=0 --> code=0 --> code=-1 or gid=0 <--> code=0 + * + */ +int +fnt_get_code(int gid, fnt_font *font) +{ + if (gid >= 0 && gid < font->numglyphs) + { + if (font->gid2code != NULL) + { + int code = font->gid2code[gid]; + + if (code) + return code; + } + } + + if (!gid) + return 0; + + return -1; +} + +int +fnt_get_glyphwidth(int code, fnt_font *font) +{ + int i; + + if (font->m.widths != NULL) + { + if (code < font->m.numwidths) + return font->m.widths[code]; + } + else if (font->m.ciw != NULL) + { + fnt_interwidth *wd = font->m.ciw; + int lo = 0; + int hi = font->m.numinters - 1; + + while (lo < hi) + { + i = (lo + hi) / 2; + + if (code >= wd[i].startcode && code < wd[i+1].startcode) + return (int) wd[i].width; + + if (code < wd[i].startcode) + hi = i; + else + lo = i + 1; + } + } + else if (font->m.glw != NULL) + { + for (i = 0; i < font->m.numglwidths; i++) + { + if (font->m.glw[i].unicode == (pdc_ushort) code) + { + return font->m.glw[i].width; + } + } + } + + return FNT_MISSING_WIDTH; +} + +void +fnt_font_logg_widths(pdc_core *pdc, fnt_font *font) +{ + if (font != NULL && + pdc_logg_is_enabled(pdc, 2, trc_font)) + { + int code, width; + + for (code = 0; code < PDC_NUM_UNIVAL; code++) + { + width = fnt_get_glyphwidth(code, font); + if (width == FNT_MISSING_WIDTH) + break; + pdc_logg(pdc, + "\t\tWidth[%d]: %d\n", code, width); + } + } +} + +static const pdc_keyconn pdf_fonttype_pdfkeylist[] = +{ + {"Type0", fnt_Type0}, + {"Type1", fnt_Type1}, + {"MMType1", fnt_MMType1}, + {"TrueType", fnt_TrueType}, + {"CIDFontType2", fnt_CIDFontType2}, + {"Type1C", fnt_Type1C}, + {"CIDFontType0", fnt_CIDFontType0}, + {"CIDFontType0C", fnt_CIDFontType0C}, + {"OpenType", fnt_OpenType}, + {"OpenType", fnt_OpenTypeC}, + {"Type3", fnt_Type3}, + {"(unknown)", fnt_unknownType}, + {NULL, 0} +}; + +int +fnt_get_pdf_fonttype_code(const char *typenam) +{ + int type = pdc_get_keycode(typenam, pdf_fonttype_pdfkeylist); + return (type != PDC_KEY_NOTFOUND) ? type : fnt_unknownType; +} + +const char * +fnt_get_pdf_fonttype_name(int typecode) +{ + const char *name = pdc_get_keyword(typecode, pdf_fonttype_pdfkeylist); + return name ? name : ""; +} + +static const pdc_keyconn pdf_fonttype_descrkeylist[] = +{ + /* Acrobat 7 names for comparison */ + {"Composite", fnt_Type0}, /* - */ + {"Type 1", fnt_Type1}, /* Type 1 */ + {"Multiple Master", fnt_MMType1}, /* MM */ + {"TrueType", fnt_TrueType}, /* TrueType */ + {"TrueType (CID)", fnt_CIDFontType2}, /* TrueType (CID) */ + {"Type 1 CFF", fnt_Type1C}, /* Type 1 */ + {"Type 1 (CID)", fnt_CIDFontType0}, /* Type 1 (CID) */ + {"Type 1 CFF (CID)",fnt_CIDFontType0C}, /* Type 1 (CID) */ + {"OpenType", fnt_OpenType}, /* OpenType */ + {"OpenType", fnt_OpenTypeC}, + {"Type 3", fnt_Type3}, /* Type 3 */ + {"(unknown)", fnt_unknownType}, + {NULL, 0} +}; + +const char * +fnt_get_pdf_fonttype_desc(int typecode) +{ + const char *name = pdc_get_keyword(typecode, pdf_fonttype_descrkeylist); + return name ? name : ""; +} + +pdc_encodingvector * +fnt_create_font_ev(pdc_core *pdc, fnt_font *font) +{ + pdc_encodingvector *ev = NULL; + char encname[128]; + + pdc->uniqueno++; + sprintf(encname, "encoding_%s_%d", font->name, pdc->uniqueno); + ev = pdc_new_encoding(pdc, encname); + pdc_insert_encoding_vector(pdc, ev); + font->enc = pdc_find_encoding(pdc, encname); + ev->flags |= PDC_ENC_FONT; + + return ev; +} + +int +fnt_check_weight(int weight) +{ + if (weight == PDC_KEY_NOTFOUND) + weight = FNT_FW_NORMAL; + + if (weight > 1000) + weight = 1000; + + if (weight <= 10) + weight *= 100; + else + weight = 100 * (weight / 100); + + return weight; +} + +static const pdc_keyconn fnt_fontweight_keylist[] = +{ + {"none", FNT_FW_DONTCARE}, + {"thin", FNT_FW_THIN}, + {"extralight", FNT_FW_EXTRALIGHT}, + {"ultralight", FNT_FW_ULTRALIGHT}, + {"light", FNT_FW_LIGHT}, + {"normal", FNT_FW_NORMAL}, + {"regular", FNT_FW_REGULAR}, + {"", FNT_FW_REGULAR}, + {"medium", FNT_FW_MEDIUM}, + {"semibold", FNT_FW_SEMIBOLD}, + {"semi", FNT_FW_SEMIBOLD}, + {"demibold", FNT_FW_DEMIBOLD}, + {"bold", FNT_FW_BOLD}, + {"extrabold", FNT_FW_EXTRABOLD}, + {"extra", FNT_FW_EXTRABOLD}, + {"ultrabold", FNT_FW_ULTRABOLD}, + {"heavy", FNT_FW_HEAVY}, + {"black", FNT_FW_BLACK}, + {NULL, 0} +}; + +int +fnt_weightname2weight(const char *weightname) +{ + return pdc_get_keycode_ci(weightname, fnt_fontweight_keylist); +} + +const char * +fnt_weight2weightname(int weight) +{ + return pdc_get_keyword(weight, fnt_fontweight_keylist); +} + +int +fnt_macfontstyle2weight(int macfontstyle) +{ + return (macfontstyle & (1<<0)) ? FNT_FW_BOLD : FNT_FW_NORMAL; +} + +#define FNT_STEMV_WEIGHT 65.0 + +int +fnt_weight2stemv(int weight) +{ + double w = weight / FNT_STEMV_WEIGHT; + return (int) (FNT_STEMV_MIN + w * w + 0.5); +} + +int +fnt_stemv2weight(int stemv) +{ + double w; + int weight = 0; + + w = (double) (stemv - FNT_STEMV_MIN); + if (w > 0) + weight = (int) (FNT_STEMV_WEIGHT * sqrt(w) + 0.5); + + return weight; +} + +void +fnt_font_logg_protocol(pdc_core *pdc, fnt_font *font) +{ + if (font != NULL && + pdc_logg_is_enabled(pdc, 2, trc_font)) + { + const char *wname = fnt_weight2weightname(font->weight); + char dwname[16]; + + dwname[0] = 0; + if (wname && *wname) + sprintf(dwname, " (%s)", wname); + + pdc_logg(pdc, + "\n" + "\t\tFont type: %s\n" + "\t\tFlags: %d\n" + "\t\tFontBBox: %g,%g %g,%g\n" + "\t\titalicAngle: %g\n" + "\t\tisFixedPitch: %d\n" + "\t\tunderlinePosition: %d\n" + "\t\tunderlineThickness: %d\n" + "\t\tcapHeight: %d\n" + "\t\txHeight: %d\n" + "\t\tascender: %d\n" + "\t\tdescender: %d\n" + "\t\tlinegap: %d\n" + "\t\tweight: %d%s\n" + "\t\tStdVW: %d\n" + "\t\tStdHW: %d\n" + "\t\tdefWidth: %d\n", + fnt_get_pdf_fonttype_name(font->m.type), + font->m.flags, + font->m.llx, font->m.lly, font->m.urx, font->m.ury, + font->m.italicAngle, font->m.isFixedPitch, + font->m.underlinePosition, font->m.underlineThickness, + font->m.capHeight, font->m.xHeight, font->m.ascender, + font->m.descender, font->linegap, font->weight, + dwname, + font->m.StdVW, font->m.StdHW, + font->m.defwidth); + } +} + + diff --git a/src/pdflib/font/ft_font.h b/src/pdflib/font/ft_font.h new file mode 100644 index 0000000..34f2a0b --- /dev/null +++ b/src/pdflib/font/ft_font.h @@ -0,0 +1,267 @@ +/*---------------------------------------------------------------------------* + | PDFlib - A library for generating PDF on the fly | + +---------------------------------------------------------------------------+ + | Copyright (c) 1997-2006 Thomas Merz and PDFlib GmbH. All rights reserved. | + +---------------------------------------------------------------------------+ + | | + | This software is subject to the PDFlib license. It is NOT in the | + | public domain. Extended versions and commercial licenses are | + | available, please check http://www.pdflib.com. | + | | + *---------------------------------------------------------------------------*/ + +/* $Id: ft_font.h,v 1.1 2008/10/17 06:10:43 scuri Exp $ + * + * Header file for font handling + * + */ + +#ifndef FT_FONT_H +#define FT_FONT_H + +#include "pc_util.h" +#include "pc_geom.h" +#include "pc_file.h" +#include "ft_cid.h" + +#define FNT_DEFAULT_WIDTH 250 /* some reasonable default */ +#define FNT_DEFAULT_CIDWIDTH 1000 /* for CID fonts */ +#define FNT_MISSING_WIDTH -1234567890 /* missing width value */ + +#define FNT_DEFAULT_UNDERLINEWIDTH 50 /* default value of underlineThickness*/ + +#define FNT_MAX_METRICS 2048.0 /* maximal font metrics value */ + +/* + * these are the font weight values of Microsoft + * see LOGFONT structure member lfWeight + */ +#define FNT_FW_DONTCARE 0 +#define FNT_FW_THIN 100 +#define FNT_FW_EXTRALIGHT 200 +#define FNT_FW_ULTRALIGHT 200 +#define FNT_FW_LIGHT 300 +#define FNT_FW_NORMAL 400 +#define FNT_FW_REGULAR 400 +#define FNT_FW_MEDIUM 500 +#define FNT_FW_SEMIBOLD 600 +#define FNT_FW_DEMIBOLD 600 +#define FNT_FW_BOLD 700 +#define FNT_FW_EXTRABOLD 800 +#define FNT_FW_ULTRABOLD 800 +#define FNT_FW_HEAVY 900 +#define FNT_FW_BLACK 900 + +/* + * these defaults are used when the stem value + * must be derived from the name (unused) + */ +#define FNT_STEMV_MIN 50 /* minimum StemV value */ +#define FNT_STEMV_LIGHT 71 /* light StemV value */ +#define FNT_STEMV_NORMAL 109 /* normal StemV value */ +#define FNT_STEMV_MEDIUM 125 /* mediumbold StemV value */ +#define FNT_STEMV_SEMIBOLD 135 /* semibold StemV value */ +#define FNT_STEMV_BOLD 165 /* bold StemV value */ +#define FNT_STEMV_EXTRABOLD 201 /* extrabold StemV value */ +#define FNT_STEMV_BLACK 241 /* black StemV value */ + +/* + * Bit positions for the font descriptor flag + */ +#define FNT_FIXEDWIDTH (long) (1L<<0) +#define FNT_SERIF (long) (1L<<1) +#define FNT_SYMBOL (long) (1L<<2) +#define FNT_SCRIPT (long) (1L<<3) +#define FNT_ADOBESTANDARD (long) (1L<<5) +#define FNT_ITALIC (long) (1L<<6) +#define FNT_SMALLCAPS (long) (1L<<17) +#define FNT_FORCEBOLD (long) (1L<<18) + +#define FNT_DEF_ITALICANGLE -12 /* default italic angle */ +#define FNT_MISSING_FONTVAL PDC_SHRT_MIN /* missing font value */ + +/* start sequence of PFA files */ +#define FNT_PFA_STARTSEQU "%!PS" + +/* Font types */ +typedef enum +{ + fnt_Type0, /* Type0 fonts */ + fnt_Type1, /* Type1 fonts */ + fnt_MMType1, /* Multiple master fonts */ + fnt_TrueType, /* TrueType fonts for 1-byte encoding */ + fnt_CIDFontType2, /* TrueType fonts for 2-byte encoding */ + fnt_Type1C, /* CFF PostScript fonts for 1-byte encoding */ + fnt_CIDFontType0, /* OpenType fonts with CFF_ table for 2-byte encoding */ + fnt_CIDFontType0C, /* CFF PostScript fonts for 2-byte encoding */ + fnt_OpenType, /* OpenType fonts for 1-byte encoding */ + fnt_OpenTypeC, /* OpenType fonts for 2-byte encoding */ + fnt_Type3, /* Type3 fonts */ + fnt_unknownType /* for initialization only */ +} +fnt_fonttype; + +/* Font styles */ +typedef enum +{ + fnt_Normal, + fnt_Bold, + fnt_Italic, + fnt_BoldItalic +} +fnt_fontstyle; + +typedef struct fnt_interwidth_s fnt_interwidth; +typedef struct fnt_interwidth4_s fnt_interwidth4; +typedef struct fnt_glyphwidth_s fnt_glyphwidth; +typedef struct fnt_font_metric_s fnt_font_metric; +typedef struct fnt_font_s fnt_font; + +/* Code interval for glyph width */ +struct fnt_interwidth_s +{ + pdc_ushort startcode; /* start code of interval */ + pdc_short width; /* width of glyphs in the code interval */ +}; + +struct fnt_interwidth4_s +{ + int startcode; /* start UTF-32 Unicode of interval */ + pdc_short width; /* width of glyphs in the code interval */ +}; + +/* Code and Unicode for glyph width */ +struct fnt_glyphwidth_s +{ + pdc_ushort unicode; /* UTF-16 Unicode of glyph */ + pdc_short code; /* builtin 8-bit code */ + pdc_short width; /* glyph width */ +}; + + +/* Font metric exchange structure */ +struct fnt_font_metric_s +{ + char *name; /* font name (/FontName) */ + pdc_ulong flags; /* font flags of font descriptor */ + fnt_fonttype type; /* type of font */ + int charcoll; /* supported CID character collection */ + /* < 0: Halfwidth Latin-1 character */ + /* font metric */ + pdc_scalar italicAngle; /* AFM key: ItalicAngle */ + int isFixedPitch; /* AFM key: IsFixedPitch */ + pdc_scalar llx; /* AFM key: FontBBox */ + pdc_scalar lly; /* AFM key: FontBBox */ + pdc_scalar urx; /* AFM key: FontBBox */ + pdc_scalar ury; /* AFM key: FontBBox */ + int underlinePosition; /* AFM key: UnderlinePosition */ + int underlineThickness; /* AFM key: UnderlineThickness */ + int capHeight; /* AFM key: CapHeight */ + int xHeight; /* AFM key: XHeight */ + int ascender; /* AFM key: Ascender */ + int descender; /* AFM key: Descender */ + int StdVW; /* AFM key: StdVW */ + int StdHW; /* AFM key: StdHW */ + + /* glyph widths */ + int defwidth; /* default width */ + int numwidths; /* number of entries in widths */ + int *widths; /* ptr to glyph widths (enumerated by codes) */ + int numinters; /* number of entries in ciw */ + fnt_interwidth *ciw; /* ptr to code intervals for widths array */ + int numglwidths; /* number of entries in glw */ + fnt_glyphwidth *glw; /* ptr to glyph widths array */ + + +}; + +/* Font exchange structure */ +struct fnt_font_s +{ + char *name; /* font name (/BaseFont or /Name or 'font_#') */ + char *utf8name; /* UTF-8 encoded font name (maybe with BOM) */ + char *filename; /* font file name */ + + fnt_font_metric m; /* name, type, flags, charcoll and metric */ + pdc_bool isstdfont; /* is an incore font + * or standard CJK font in pdflib */ + pdc_bool ishostfont; /* is an host font */ + pdc_bool hasdescr; /* has font descriptor */ + pdc_bool vertical; /* vertical writing mode */ + + pdc_ushort spacechar; /* code of space character depending on enc */ + int spacewidth; /* width of space character */ + int linegap; /* OpenType lineGap */ + int weight; /* font weight value 0-1000 */ + + pdc_matrix matrix; /* Type3 font matrix */ + pdc_rectangle bbox; /* Type3 font bounding box */ + pdc_scalar fsscale; /* Type3 fontsize scaling */ + + pdc_bool issymbfont; /* is a symbol font */ + pdc_encoding enc; /* font encoding shortcut */ + + int numglyphs; /* number of glyphs */ + int numcodes; /* number of codes */ + + pdc_ushort *gid2code; /* mapping glyph ID -> [Uni]code or NULL */ + pdc_ushort *code2gid; /* mapping [Uni]code -> glyph ID or NULL */ + char *cmapname; /* CID CMap name */ + + + /* font in memory */ + pdc_bool embedded; /* embedded font */ + char *imgname; /* name of virtual file containing *img */ + size_t filelen; /* length of (uncompressed) font data */ + pdc_byte *img; /* font (or CFF table) data */ + +}; + +/* font error numbers. +*/ +enum +{ +#define fnt_genNames 1 +#include "ft_generr.h" + + FNT_E_dummy +}; + +/* ft_font.c */ +void fnt_register_errtab(pdc_core *pdc); +void fnt_init_font(fnt_font *font); +void fnt_cleanup_font(pdc_core *pdc, fnt_font *font); +void fnt_cleanup_fontimg(pdc_core *pdc, fnt_font *font); +int fnt_get_glyphid(int code, fnt_font *font); +int fnt_get_code(int gid, fnt_font *font); +int fnt_get_glyphwidth(int code, fnt_font *font); +int fnt_get_pdf_fonttype_code(const char *typenam); +const char *fnt_get_pdf_fonttype_name(int typecode); +const char *fnt_get_pdf_fonttype_desc(int typecode); +pdc_encodingvector *fnt_create_font_ev(pdc_core *pdc, fnt_font *font); +int fnt_check_weight(int weight); +int fnt_weightname2weight(const char *weightname); +int fnt_stemv2weight(int stemv); +const char *fnt_weight2weightname(int weight); +int fnt_macfontstyle2weight(int macfontstyle); +int fnt_weight2stemv(int weight); +void fnt_font_logg_widths(pdc_core *pdc, fnt_font *font); +void fnt_font_logg_protocol(pdc_core *pdc, fnt_font *font); + +/* ft_corefont.c */ +pdc_bool fnt_is_standard_font(const char *fontname); +const char *fnt_get_abb_std_fontname(const char *fontname); +void fnt_fill_font_metric(pdc_core *pdc, fnt_font *font, pdc_bool kerning, + const fnt_font_metric *metric); +const fnt_font_metric *fnt_get_core_metric(const char *fontname); +const char *fnt_get_abb_cjk_fontname(const char *fontname); +int fnt_get_preinstalled_cidfont(const char *fontname, + const fnt_font_metric **fontmetric); +const char **fnt_get_cid_widths_array(pdc_core *pdc, fnt_font *font); + + +/* ft_type1.c */ +pdc_bool fnt_test_type1_font(pdc_core *pdc, const pdc_byte *img); +pdc_bool fnt_get_type1_encoding(pdc_core *pdc, fnt_font *font, int glyphflags); + +#endif /* FT_FONT_H */ diff --git a/src/pdflib/font/ft_generr.h b/src/pdflib/font/ft_generr.h new file mode 100644 index 0000000..909596b --- /dev/null +++ b/src/pdflib/font/ft_generr.h @@ -0,0 +1,109 @@ +/*---------------------------------------------------------------------------* + | PDFlib - A library for generating PDF on the fly | + +---------------------------------------------------------------------------+ + | Copyright (c) 1997-2006 Thomas Merz and PDFlib GmbH. All rights reserved. | + +---------------------------------------------------------------------------+ + | | + | This software is subject to the PDFlib license. It is NOT in the | + | public domain. Extended versions and commercial licenses are | + | available, please check http://www.pdflib.com. | + | | + *---------------------------------------------------------------------------*/ + +/* $Id: ft_generr.h,v 1.1 2008/10/17 06:10:43 scuri Exp $ + * + * FONT error messages + * + */ + +#define FT_GENERR_H + +#if fnt_genNames +#define gen(n, num, nam, msg) FNT_E_##nam = num, +#elif fnt_genInfo +#define gen(n, num, nam, msg) { n, num, msg, (const char *) 0 }, + +#else +#error invalid inclusion of generator file +#endif + + +/* -------------------------------------------------------------------- */ +/* Font (70xx) */ +/* -------------------------------------------------------------------- */ + +gen(1, 7000, FONT_ILLFONTSTYLE, "Illegal fontstyle '$1' in font name") + +gen(1, 7001, FONT_PREFIX, "Font '$1': ") + +gen(0, 7002, FONT_HOSTNOTFOUND, "Host font not found") + +gen(1, 7004, FONT_UNSUPP_FORMAT, "Font format '$1' not supported") + +gen(0, 7006, FONT_TTHOSTNOTFOUND, "TrueType host font not found") + +gen(1, 7007, FONT_NAMETOOLONG, + "Font name too long (max. $1 characters)") + +gen(0, 7060, TT_BITMAP, "TrueType bitmap font not supported") + +gen(1, 7062, TT_NOFONT, "Font file '%s' is not a TrueType or OpenType font") + +gen(0, 7064, TT_BADCMAP, "Font contains unknown encodings (cmaps) only") + +gen(0, 7066, TT_SYMBOLOS2, "Symbol font does not contain OS/2 table") + +gen(0, 7068, TT_EMBED, + "Font cannot be embedded due to licensing restrictions in the font file") + +gen(0, 7070, TT_ASSERT1, "TrueType parser error") + +gen(0, 7071, TT_CORRUPT1, "Corrupt TrueType font") + +gen(1, 7072, TT_ASSERT2, "TrueType parser error in font file '$1'") + +gen(1, 7073, TT_CORRUPT2, "Corrupt TrueType font file '$1'") + +gen(1, 7074, TTC_NOTFOUND, + "Font not found in TrueType Collection file '$1'") + +gen(0, 7076, TT_NOGLYFDESC, + "TrueType font does not contain any character outlines") + +gen(1, 7077, TT_GLYPHIDNOTFOUND, + "Couldn't find glyph id for Unicode value U+$1") + +gen(0, 7078, TT_NONAME, + "TrueType font contains only unsupported records in 'name' table") + +gen(1, 7079, TT_BADPOST, + "TrueType 'post' table has unknown reserved character index $1") + +gen(1, 7080, OT_CHARSET, + "OpenType font with predefined charset '$1' in CFF table not supported") + +gen(0, 7081, OT_MULTIFONT, + "OpenType font with multiple font entries not supported") + +gen(0, 7082, OT_CHARSTRINGS, + "OpenType font has no CharStrings data in CFF table") + +gen(0, 7083, OT_TOPDICT, + "OpenType CID font has no Top DICT INDEX in CFF table") + +gen(0, 7085, OT_NO_ORDERING, + "OpenType CID font has no ordering string in CFF table") + +gen(1, 7086, OT_ILL_CHARCOLL, + "OpenType CID font has unknown character collection '$1'") + + + + + + + +#undef gen +#undef fnt_genNames +#undef fnt_genInfo + diff --git a/src/pdflib/font/ft_hostfont.c b/src/pdflib/font/ft_hostfont.c new file mode 100644 index 0000000..ec9411d --- /dev/null +++ b/src/pdflib/font/ft_hostfont.c @@ -0,0 +1,24 @@ +/*---------------------------------------------------------------------------* + | PDFlib - A library for generating PDF on the fly | + +---------------------------------------------------------------------------+ + | Copyright (c) 1997-2006 Thomas Merz and PDFlib GmbH. All rights reserved. | + +---------------------------------------------------------------------------+ + | | + | This software is subject to the PDFlib license. It is NOT in the | + | public domain. Extended versions and commercial licenses are | + | available, please check http://www.pdflib.com. | + | | + *---------------------------------------------------------------------------*/ + +/* $Id: ft_hostfont.c,v 1.1 2008/10/17 06:10:43 scuri Exp $ + * + * FONT host font handling routines for Windows and Mac + * + */ + +#include "pc_ctype.h" + +#include "ft_font.h" +#include "ft_truetype.h" + + diff --git a/src/pdflib/font/ft_pdffont.c b/src/pdflib/font/ft_pdffont.c new file mode 100644 index 0000000..0767d74 --- /dev/null +++ b/src/pdflib/font/ft_pdffont.c @@ -0,0 +1,18 @@ +/*---------------------------------------------------------------------------* + | PDFlib - A library for generating PDF on the fly | + +---------------------------------------------------------------------------+ + | Copyright (c) 2002-2006 PDFlib GmbH. All rights reserved. | + +---------------------------------------------------------------------------+ + | Proprietary source code -- do not redistribute! | + *---------------------------------------------------------------------------*/ + +/* $Id: ft_pdffont.c,v 1.1 2008/10/17 06:10:43 scuri Exp $ + * + * Routine for parsing font dictionaries in PDF files by pCOS + * + */ + +#include "ft_pdffont.h" +#include "ft_truetype.h" + + diff --git a/src/pdflib/font/ft_pdffont.h b/src/pdflib/font/ft_pdffont.h new file mode 100644 index 0000000..bb40cbc --- /dev/null +++ b/src/pdflib/font/ft_pdffont.h @@ -0,0 +1,26 @@ +/*---------------------------------------------------------------------------* + | PDFlib - A library for generating PDF on the fly | + +---------------------------------------------------------------------------+ + | Copyright (c) 1997-2006 Thomas Merz and PDFlib GmbH. All rights reserved. | + +---------------------------------------------------------------------------+ + | | + | This software is subject to the PDFlib license. It is NOT in the | + | public domain. Extended versions and commercial licenses are | + | available, please check http://www.pdflib.com. | + | | + *---------------------------------------------------------------------------*/ + +/* $Id: ft_pdffont.h,v 1.1 2008/10/17 06:10:43 scuri Exp $ + * + * Header file for parsing font dictionaries in PDF files + * + */ + +#ifndef FT_PDFFONT_H +#define FT_PDFFONT_H + +#include "ft_font.h" + + + +#endif /* FT_PDFFONT_H */ diff --git a/src/pdflib/font/ft_truetype.c b/src/pdflib/font/ft_truetype.c new file mode 100644 index 0000000..b4e33a6 --- /dev/null +++ b/src/pdflib/font/ft_truetype.c @@ -0,0 +1,2310 @@ +/*---------------------------------------------------------------------------* + | PDFlib - A library for generating PDF on the fly | + +---------------------------------------------------------------------------+ + | Copyright (c) 1997-2006 Thomas Merz and PDFlib GmbH. All rights reserved. | + +---------------------------------------------------------------------------+ + | | + | This software is subject to the PDFlib license. It is NOT in the | + | public domain. Extended versions and commercial licenses are | + | available, please check http://www.pdflib.com. | + | | + *---------------------------------------------------------------------------*/ + +/* $Id: ft_truetype.c,v 1.1 2008/10/17 06:10:43 scuri Exp $ + * + * FONT TrueType handling routines + * + */ + +#include "ft_font.h" +#include "ft_truetype.h" + +#ifdef PDF_TRUETYPE_SUPPORTED + +void +tt_assert(tt_file *ttf) +{ + pdc_core *pdc = ttf->pdc; + + if (ttf->filename) + pdc_error(pdc, FNT_E_TT_ASSERT2, ttf->filename, 0, 0, 0); + else + pdc_error(pdc, FNT_E_TT_ASSERT1, 0, 0, 0, 0); +} /* tt_assert */ + +void +tt_error(tt_file *ttf) +{ + pdc_core *pdc = ttf->pdc; + + if (ttf->filename) + pdc_error(pdc, FNT_E_TT_CORRUPT2, ttf->filename, 0, 0, 0); + else + pdc_error(pdc, FNT_E_TT_CORRUPT1, 0, 0, 0, 0); +} /* tt_error */ + +void +tt_seek(tt_file *ttf, long offset) +{ + if (ttf->incore) + { + TT_IOCHECK(ttf, ttf->img + (tt_ulong) offset <= ttf->end); + ttf->pos = ttf->img + (tt_ulong) offset; + } + else + TT_IOCHECK(ttf, pdc_fseek(ttf->fp, offset, SEEK_SET) == 0); +} + +void +tt_read(tt_file *ttf, void *buf, unsigned int nbytes) +{ + if (ttf->incore) + { + TT_IOCHECK(ttf, ttf->pos + (tt_ulong) nbytes <= ttf->end); + memcpy(buf, ttf->pos, (size_t) nbytes); + ttf->pos += (tt_ulong) nbytes; + } + else + TT_IOCHECK(ttf, PDC_OK_FREAD(ttf->fp, buf, nbytes)); +} + +long +tt_tell(tt_file *ttf) +{ + if (ttf->incore) + return (long) (ttf->pos - ttf->img); + else + return (long) pdc_ftell(ttf->fp); +} + +tt_ushort +tt_get_ushort(tt_file *ttf) +{ + tt_byte *pos, buf[2]; + + if (ttf->incore) + { + pos = ttf->pos; + TT_IOCHECK(ttf, (ttf->pos += 2) <= ttf->end); + } + else + { + pos = buf; + TT_IOCHECK(ttf, PDC_OK_FREAD(ttf->fp, buf, 2)); + } + + return pdc_get_be_ushort(pos); +} + +tt_short +tt_get_short(tt_file *ttf) +{ + tt_byte *pos, buf[2]; + + if (ttf->incore) + { + pos = ttf->pos; + TT_IOCHECK(ttf, (ttf->pos += 2) <= ttf->end); + } + else + { + pos = buf; + TT_IOCHECK(ttf, PDC_OK_FREAD(ttf->fp, buf, 2)); + } + + return pdc_get_be_short(pos); +} + +tt_ulong +tt_get_ulong3(tt_file *ttf) +{ + tt_byte *pos, buf[3]; + + if (ttf->incore) + { + pos = ttf->pos; + TT_IOCHECK(ttf, (ttf->pos += 3) <= ttf->end); + } + else + { + pos = buf; + TT_IOCHECK(ttf, PDC_OK_FREAD(ttf->fp, buf, 3)); + } + + return pdc_get_be_ulong3(pos); +} + +tt_ulong +tt_get_ulong(tt_file *ttf) +{ + tt_byte *pos, buf[4]; + + if (ttf->incore) + { + pos = ttf->pos; + TT_IOCHECK(ttf, (ttf->pos += 4) <= ttf->end); + } + else + { + pos = buf; + TT_IOCHECK(ttf, PDC_OK_FREAD(ttf->fp, buf, 4)); + } + + return pdc_get_be_ulong(pos); +} + +tt_long +tt_get_long(tt_file *ttf) +{ + tt_byte *pos, buf[4]; + + if (ttf->incore) + { + pos = ttf->pos; + TT_IOCHECK(ttf, (ttf->pos += 4) <= ttf->end); + } + else + { + pos = buf; + TT_IOCHECK(ttf, PDC_OK_FREAD(ttf->fp, buf, 4)); + } + + return pdc_get_be_long(pos); +} + +tt_ulong +tt_get_offset(tt_file *ttf, tt_byte offsize) +{ + tt_byte buf; + + switch (offsize) + { + case 1: + tt_read(ttf, &buf, 1); + return (tt_ulong) buf; + + case 2: + return (tt_ulong) tt_get_ushort(ttf); + + case 3: + return (tt_ulong) tt_get_ulong3(ttf); + + case 4: + return (tt_ulong) tt_get_ulong(ttf); + } + return 0; +} + +static void +tt_get_dirent(tt_dirent *dirent, tt_file *ttf) +{ + tt_read(ttf, dirent->tag, 4); + dirent->tag[4] = 0; + dirent->checksum = tt_get_ulong(ttf); + dirent->offset = tt_get_ulong(ttf); + dirent->length = tt_get_ulong(ttf); +} /* tt_get_dirent */ + + +int +tt_tag2idx(tt_file *ttf, char *tag) +{ + int i; + + for (i = 0; i < ttf->n_tables; ++i) + if (strcmp(ttf->dir[i].tag, tag) == 0) + return i; + + return -1; +} /* tt_tag2idx */ + +void * +tt_get_tab(tt_file *ttf, char *tag, size_t nbytes, pdc_bool tterror, + tt_ulong *offset) +{ + static const char *fn = "tt_get_tab"; + pdc_core *pdc = ttf->pdc; + int idx = tt_tag2idx(ttf, tag); + + if (idx == -1) + { + if (tterror) + tt_error(ttf); + return NULL; + } + + tt_seek(ttf, (long) ttf->dir[idx].offset); + + if (offset) + *offset = ttf->dir[idx].offset; + + return pdc_malloc(pdc, nbytes, fn); +} + +static void +tt_get_cmap0(tt_file *ttf, tt_cmap0_6 *cm0_6) +{ + static const char *fn = "tt_get_cmap0"; + pdc_core *pdc = ttf->pdc; + tt_ushort c; + tt_byte buf[256]; + + cm0_6->glyphIdArray = (tt_ushort *) 0; + + cm0_6->length = tt_get_ushort(ttf); + cm0_6->language = tt_get_ushort(ttf); + + /* These are not used in format 0 */ + cm0_6->firstCode = 0; + cm0_6->entryCount = 256; + + cm0_6->glyphIdArray = (tt_ushort *) + pdc_malloc(pdc, (size_t) (sizeof (tt_ushort) * 256), fn); + + tt_read(ttf, buf, 256); + + for (c = 0; c < 256; c++) + cm0_6->glyphIdArray[c] = (tt_ushort) buf[c]; + +} /* tt_get_cmap0 */ + +static void +tt_get_cmap6(tt_file *ttf, tt_cmap0_6 *cm0_6) +{ + static const char *fn = "tt_get_cmap6"; + pdc_core *pdc = ttf->pdc; + tt_ushort c, last, cmax; + + cm0_6->glyphIdArray = (tt_ushort *) 0; + + cm0_6->length = tt_get_ushort(ttf); + cm0_6->language = tt_get_ushort(ttf); + cm0_6->firstCode = tt_get_ushort(ttf); + cm0_6->entryCount = tt_get_ushort(ttf); + + last = (tt_ushort) (cm0_6->firstCode + cm0_6->entryCount); + cmax = MAX(last, 256); + + cm0_6->glyphIdArray = (tt_ushort *) + pdc_malloc(pdc, (size_t) (sizeof (tt_ushort) * cmax), fn); + + /* default for codes outside the range specified in this table */ + for (c = 0; c < cmax; c++) + cm0_6->glyphIdArray[c] = (tt_ushort) 0; + + for (c = cm0_6->firstCode; c < last; c++) + cm0_6->glyphIdArray[c] = tt_get_ushort(ttf); + +} /* tt_get_cmap6 */ + +static void +tt_get_cmap4(tt_file *ttf, tt_cmap4 *cm4) +{ + static const char *fn = "tt_get_cmap4"; + pdc_core *pdc = ttf->pdc; + int i, segs; + + /* the instruction order is critical for cleanup after exceptions! + */ + cm4->endCount = (tt_ushort *) 0; + cm4->startCount = (tt_ushort *) 0; + cm4->idDelta = (tt_short *) 0; + cm4->idRangeOffs = (tt_ushort *) 0; + cm4->glyphIdArray = (tt_ushort *) 0; + + cm4->length = tt_get_ushort(ttf); + cm4->version = tt_get_ushort(ttf); + cm4->segCountX2 = tt_get_ushort(ttf); + cm4->searchRange = tt_get_ushort(ttf); + cm4->entrySelector = tt_get_ushort(ttf); + cm4->rangeShift = tt_get_ushort(ttf); + + segs = cm4->segCountX2 / 2; + + cm4->numGlyphIds = (tt_ushort)( + ((cm4->length - ( 16L + 8L * segs )) & 0xFFFFU) / 2); + + TT_IOCHECK(ttf, 0 <= cm4->numGlyphIds); + + cm4->endCount = + (tt_ushort *) + pdc_malloc(pdc, (size_t) (sizeof (tt_ushort) * segs), fn); + cm4->startCount = + (tt_ushort *) + pdc_malloc(pdc, (size_t) (sizeof (tt_ushort) * segs), fn); + cm4->idDelta = + (tt_short *) + pdc_malloc(pdc, (size_t) (sizeof (tt_ushort) * segs), fn); + cm4->idRangeOffs = + (tt_ushort *) + pdc_malloc(pdc, (size_t) (sizeof (tt_ushort) * segs), fn); + + if (cm4->numGlyphIds) + { + cm4->glyphIdArray = (tt_ushort *) + pdc_malloc(pdc, + (size_t) (sizeof (tt_ushort) * cm4->numGlyphIds), fn); + } + + for (i = 0; i < segs; ++i) + cm4->endCount[i] = tt_get_ushort(ttf); + + TT_IOCHECK(ttf, cm4->endCount[segs - 1] == 0xFFFF); + + (void) tt_get_ushort(ttf); /* padding */ + for (i = 0; i < segs; ++i) cm4->startCount[i] = tt_get_ushort(ttf); + for (i = 0; i < segs; ++i) cm4->idDelta[i] = tt_get_short(ttf); + for (i = 0; i < segs; ++i) cm4->idRangeOffs[i] = tt_get_ushort(ttf); + + for (i = 0; i < cm4->numGlyphIds; ++i) + cm4->glyphIdArray[i] = tt_get_ushort(ttf); + + /* empty cmap */ + if (segs == 1 && cm4->endCount[0] == cm4->startCount[0]) + { + cm4->segCountX2 = 0; + pdc_free(pdc, cm4->endCount); + cm4->endCount = (tt_ushort *) 0; + pdc_free(pdc, cm4->startCount); + cm4->startCount = (tt_ushort *) 0; + pdc_free(pdc, cm4->idDelta); + cm4->idDelta = (tt_short *) 0; + pdc_free(pdc, cm4->idRangeOffs); + cm4->idRangeOffs = (tt_ushort *) 0; + if (cm4->numGlyphIds) + { + pdc_free(pdc, cm4->glyphIdArray); + cm4->glyphIdArray = (tt_ushort *) 0; + } + } + +} /* tt_get_cmap4 */ + + +void +tt_get_tab_cmap(tt_file *ttf) +{ + static const char *fn = "tt_get_tab_cmap"; + pdc_core *pdc = ttf->pdc; + tt_tab_cmap *tp = NULL; + tt_ulong offset; + tt_ushort numEncTabs; + tt_ushort platformID = 0; + tt_ushort encodingID = 0; + tt_ushort tableFormat = 0; + tt_ulong offsetEncTab = 0; + tt_ulong offset_mac = 0; + tt_ulong offset_win = 0; + tt_ulong offset_ucs4 = 0; + tt_long pos = 0; + int i; + + tp = (tt_tab_cmap *) tt_get_tab(ttf, fnt_str_cmap, sizeof (tt_tab_cmap), + !ttf->fortet, &offset); + if (tp == NULL) + return; + ttf->tab_cmap = tp; + + tp->win = (tt_cmap4 *) 0; + tp->mac = (tt_cmap0_6 *) 0; + tp->ucs4 = (tt_cmap12 *) 0; + + tp->platform = 0; + tp->encoding = 0; + tp->format = 0; + tp->offset = 0; + tp->length = 0; + + (void) tt_get_ushort(ttf); /* version */ + numEncTabs = tt_get_ushort(ttf); + + pdc_logg_cond(pdc, 2, trc_font, + "\tSearching for cmap table entries:\n"); + for (i = 0; i < numEncTabs; ++i) + { + platformID = tt_get_ushort(ttf); + encodingID = tt_get_ushort(ttf); + offsetEncTab = tt_get_ulong(ttf); + pos = tt_tell(ttf); + + tt_seek(ttf, (long) (offset + offsetEncTab)); + tableFormat = tt_get_ushort(ttf); + + pdc_logg_cond(pdc, 2, trc_font, + "\t\tplatformID: %d, encodingID: %2d, " + "tableFormat: %2d, offsetEncTab: 0x%04X\n", + platformID, encodingID, tableFormat, offsetEncTab); + + /* + * platformID: 0 encodingID: 0 tableFormat: 0 + * platformID: 1 encodingID: 0 tableFormat: 0/6 + */ + if (((platformID == tt_pfid_uni && tableFormat == 0) || + platformID == tt_pfid_mac) && encodingID == tt_wenc_symbol) + { + /* we currently do not support cmaps + ** other than format 0 and 6 for Macintosh cmaps. + */ + + if (tableFormat == 0 && tp->mac == (tt_cmap0_6 *) 0) + { + tp->mac = (tt_cmap0_6 *) + pdc_malloc(pdc, sizeof (tt_cmap0_6), fn); + tp->mac->format = 0; + tt_get_cmap0(ttf, tp->mac); + } + else if (tableFormat == 6 && tp->mac == (tt_cmap0_6 *) 0) + { + tp->mac = (tt_cmap0_6 *) + pdc_malloc(pdc, sizeof (tt_cmap0_6), fn); + tp->mac->format = 6; + tt_get_cmap6(ttf, tp->mac); + } + offset_mac = offsetEncTab; + } + + /* + * platformID: 0 encodingID: 3 tableFormat: 4 (old mac) + * platformID: 3 encodingID: 0/1 tableFormat: 4 + */ + else if ((tp->win == (tt_cmap4 *) 0 && tableFormat == 4) && + ((platformID == tt_pfid_win && + (encodingID == tt_wenc_symbol || + encodingID == tt_wenc_text)) || + (platformID == tt_pfid_uni && + encodingID == tt_wenc_mtext))) + { + tp->win = (tt_cmap4 *) pdc_malloc(pdc, sizeof (tt_cmap4), fn); + tp->win->format = tableFormat; + + /* we suppose a windows platform (see old mac hostfont Times) */ + if (encodingID == tt_wenc_mtext) + { + encodingID = tt_wenc_text; + } + + tt_get_cmap4(ttf, tp->win); + + if (tp->win->segCountX2) + { + tp->win->encodingID = encodingID; + } + else + { + pdc_free(pdc, tp->win); + tp->win = (tt_cmap4 *) 0; + } + offset_win = offsetEncTab; + } + + + tt_seek(ttf, pos); + } /* for */ + + /* is symbol font */ + ttf->issymbol = (tp->win && tp->win->encodingID == tt_wenc_symbol) ? + pdc_true : pdc_false; + + /* has Unicode cmap */ + ttf->haswinuni = (!ttf->issymbol && (tp->win || tp->ucs4)) ? + pdc_true : pdc_false; + + /* has only Mac cmap */ + ttf->hasonlymac = (tp->mac && !tp->win && !tp->ucs4) ? + pdc_true : pdc_false; + + if (ttf->hasonlymac) + { + tp->platform = tt_pfid_mac; + tp->encoding = tt_wenc_symbol; + tp->format = tp->mac->format; + tp->offset = offset_mac; + tp->length = tp->mac->length; + } + else if (tp->win || tp->ucs4) + { + tp->platform = tt_pfid_win; + if (ttf->issymbol) + { + tp->encoding = tt_wenc_symbol; + tp->format = tp->win->format; + tp->offset = offset_win; + tp->length = tp->win->length; + } + else if (tp->ucs4) + { + tp->encoding = tt_wenc_utext; + tp->format = tp->ucs4->format; + tp->offset = offset_ucs4; + tp->length = tp->ucs4->length; + } + else + { + tp->encoding = tt_wenc_text; + tp->format = tp->win->format; + tp->offset = offset_win; + tp->length = tp->win->length; + } + } + + pdc_logg_cond(ttf->pdc, 1, trc_font, + "\tUsed cmap table entry:\n" + "\t\tplatformID: %d, encodingID: %2d, tableFormat: %2d (%s font)\n", + tp->platform, tp->encoding, tp->format, + ttf->issymbol ? "symbol" : "text"); + + /* for subsetting and symbolic font: + * tp->platform = tt_pfid_mac according PDF specification + * otherwise GS will emit an error message + */ + if (ttf->issymbol && offset_mac > 0) + { + tp->platform = tt_pfid_mac; + tp->encoding = tt_wenc_symbol; + tp->format = tp->mac->format; + tp->offset = offset_mac; + tp->length = tp->mac->length; + } + +} /* tt_get_tab_cmap */ + +void +tt_get_tab_head(tt_file *ttf) +{ + tt_tab_head *tp = NULL; + + tp = (tt_tab_head *) tt_get_tab(ttf, fnt_str_head, sizeof (tt_tab_head), + !ttf->fortet, NULL); + if (tp == NULL) + return; + ttf->tab_head = tp; + + tp->version = tt_get_fixed(ttf); + tp->fontRevision = tt_get_fixed(ttf); + tp->checkSumAdjustment = tt_get_ulong(ttf); + tp->magicNumber = tt_get_ulong(ttf); + tp->flags = tt_get_ushort(ttf); + tp->unitsPerEm = tt_get_ushort(ttf); + tp->created[1] = tt_get_ulong(ttf); + tp->created[0] = tt_get_ulong(ttf); + tp->modified[1] = tt_get_ulong(ttf); + tp->modified[0] = tt_get_ulong(ttf); + tp->xMin = tt_get_fword(ttf); + tp->yMin = tt_get_fword(ttf); + tp->xMax = tt_get_fword(ttf); + tp->yMax = tt_get_fword(ttf); + tp->macStyle = tt_get_ushort(ttf); + tp->lowestRecPPEM = tt_get_ushort(ttf); + tp->fontDirectionHint = tt_get_short(ttf); + tp->indexToLocFormat = tt_get_short(ttf); + tp->glyphDataFormat = tt_get_short(ttf); +} /* tt_get_tab_head */ + +static void +tt_get_tab_hhea(tt_file *ttf) +{ + tt_tab_hhea *tp = NULL; + + tp = (tt_tab_hhea *) tt_get_tab(ttf, fnt_str_hhea, sizeof (tt_tab_hhea), + !ttf->fortet, NULL); + if (tp == NULL) + return; + ttf->tab_hhea = tp; + + tp->version = tt_get_fixed(ttf); + tp->ascender = tt_get_fword(ttf); + tp->descender = tt_get_fword(ttf); + tp->lineGap = tt_get_fword(ttf); + tp->advanceWidthMax = tt_get_fword(ttf); + tp->minLeftSideBearing = tt_get_fword(ttf); + tp->minRightSideBearing = tt_get_fword(ttf); + tp->xMaxExtent = tt_get_fword(ttf); + tp->caretSlopeRise = tt_get_short(ttf); + tp->caretSlopeRun = tt_get_short(ttf); + tp->res1 = tt_get_short(ttf); + tp->res2 = tt_get_short(ttf); + tp->res3 = tt_get_short(ttf); + tp->res4 = tt_get_short(ttf); + tp->res5 = tt_get_short(ttf); + tp->metricDataFormat = tt_get_short(ttf); + tp->numberOfHMetrics = tt_get_ushort(ttf); +} /* tt_get_tab_hhea */ + +static void +tt_get_tab_hmtx(tt_file *ttf) +{ + static const char *fn = "tt_get_tab_hmtx"; + pdc_core *pdc = ttf->pdc; + tt_tab_hmtx *tp = NULL; + int n_metrics; + int n_lsbs; + int i; + + tp = (tt_tab_hmtx *) tt_get_tab(ttf, fnt_str_hmtx, sizeof (tt_tab_hmtx), + !ttf->fortet, NULL); + if (tp == NULL) + return; + ttf->tab_hmtx = tp; + + TT_ASSERT(ttf, ttf->tab_hhea != 0); + TT_ASSERT(ttf, ttf->tab_maxp != 0); + + tp->metrics = 0; + tp->lsbs = 0; + + n_metrics = ttf->tab_hhea->numberOfHMetrics; + n_lsbs = ttf->numGlyphs - n_metrics; + + TT_IOCHECK(ttf, n_metrics != 0); + TT_IOCHECK(ttf, n_lsbs >= 0); + tp->metrics = (tt_metric *) + pdc_malloc(pdc, n_metrics * sizeof (tt_metric), fn); + + for (i = 0; i < n_metrics; ++i) + { + tp->metrics[i].advanceWidth = tt_get_fword(ttf); + tp->metrics[i].lsb = tt_get_fword(ttf); + } + + if (n_lsbs == 0) + tp->lsbs = (tt_fword *) 0; + else + { + tp->lsbs = (tt_fword *) + pdc_malloc(pdc, n_lsbs * sizeof (tt_fword), fn); + for (i = 0; i < n_lsbs; ++i) + tp->lsbs[i] = tt_get_fword(ttf); + } +} /* tt_get_tab_hmtx */ + + + +pdc_bool +tt_get_tab_CFF_(tt_file *ttf) +{ + static const char *fn = "tt_get_tab_CFF_"; + pdc_core *pdc = ttf->pdc; + int idx = tt_tag2idx(ttf, fnt_str_CFF_); + + if (idx != -1) + { + /* CFF table found */ + ttf->tab_CFF_ = (tt_tab_CFF_ *) + pdc_malloc(pdc, sizeof (tt_tab_CFF_), fn); + ttf->tab_CFF_->offset = ttf->dir[idx].offset; + ttf->tab_CFF_->length = ttf->dir[idx].length; + } + else if (!ttf->fortet) + { + idx = tt_tag2idx(ttf, fnt_str_glyf); + if (idx == -1 || !ttf->dir[idx].length) + { + pdc_set_errmsg(pdc, FNT_E_TT_NOGLYFDESC, 0, 0, 0, 0); + return pdc_false; + } + idx = -1; + } + + + return pdc_true; + +} /* tt_get_tab_CFF_ */ + +void +tt_get_tab_maxp(tt_file *ttf) +{ + tt_tab_maxp *tp = NULL; + + tp = (tt_tab_maxp *) tt_get_tab(ttf, fnt_str_maxp, sizeof (tt_tab_maxp), + !ttf->fortet, NULL); + if (tp == NULL) + return; + ttf->tab_maxp = tp; + + tp->version = tt_get_fixed(ttf); + tp->numGlyphs = tt_get_ushort(ttf); + tp->maxPoints = tt_get_ushort(ttf); + tp->maxContours = tt_get_ushort(ttf); + tp->maxCompositePoints = tt_get_ushort(ttf); + tp->maxCompositeContours = tt_get_ushort(ttf); + tp->maxZones = tt_get_ushort(ttf); + tp->maxTwilightPoints = tt_get_ushort(ttf); + tp->maxStorage = tt_get_ushort(ttf); + tp->maxFunctionDefs = tt_get_ushort(ttf); + tp->maxInstructionDefs = tt_get_ushort(ttf); + tp->maxStackElements = tt_get_ushort(ttf); + tp->maxSizeOfInstructions = tt_get_ushort(ttf); + tp->maxComponentElements = tt_get_ushort(ttf); + tp->maxComponentDepth = tt_get_ushort(ttf); + + ttf->numGlyphs = tp->numGlyphs; + +} /* tt_get_tab_maxp */ + +pdc_bool +tt_get_tab_name(tt_file *ttf) +{ + static const char *fn = "tt_get_tab_name"; + pdc_core *pdc = ttf->pdc; + pdc_bool logg5 = pdc_logg_is_enabled(pdc, 5, trc_font); + tt_tab_name *tp = NULL; + int i, j, k, namid, irec, irec4 = -1, irec6 = -1; + size_t len; + tt_nameref *namerec = NULL, lastnamerec; + char *localname = NULL; + tt_ulong offset, offs; + + tp = (tt_tab_name *) tt_get_tab(ttf, fnt_str_name, sizeof (tt_tab_name ), + pdc_false, &offset); + if (tp == NULL) + return pdc_false; + ttf->tab_name = tp; + + tp->namerecords = NULL; + tp->englishname4 = NULL; + tp->englishname6 = NULL; + tp->producer = NULL; + + tp->format = tt_get_ushort(ttf); + + /* Format 0 is the only document one, but some Apple fonts use 65535. + * This is very consequent since it follows Microsoft's lead in + * disregarding one's own published specifications. + */ + TT_IOCHECK(ttf, (tp->format == 0 || tp->format == 65535)); + + tp->numNameRecords = (tt_ushort) + tt_get_offset(ttf, sizeof(tt_ushort)); + tp->offsetStrings = tt_get_ushort(ttf); + offs = offset + tp->offsetStrings; + + pdc_logg_cond(pdc, 1, trc_font, + "\tRecords in name table of format %d: %d:\n", + tp->format, tp->numNameRecords); + + /* this was observed. we ignore it in TET */ + if (ttf->fortet && tp->numNameRecords == 0) + return pdc_true; + + TT_IOCHECK(ttf, (tp->numNameRecords > 0)); + + len = tp->numNameRecords * sizeof (tt_nameref); + tp->namerecords = (tt_nameref *) pdc_malloc(pdc, len, fn); + + for (i = 0; i < tp->numNameRecords; ++i) + { + tt_ushort platformID = tt_get_ushort(ttf); + tt_ushort encodingID = tt_get_ushort(ttf); + tt_ushort languageID = tt_get_ushort(ttf); + tt_ushort nameID = tt_get_ushort(ttf); + tt_ushort stringLength = tt_get_ushort(ttf); + tt_ushort stringOffset = tt_get_ushort(ttf); + + namerec = &tp->namerecords[i]; + namerec->platform = platformID; + namerec->encoding = encodingID; + namerec->language = languageID; + namerec->namid = nameID; + namerec->length = stringLength; + namerec->offset = stringOffset; + } + + namid = 4; + for (k = 0; k < 2; k++) + { + lastnamerec.platform = 0; + lastnamerec.language = 0; + lastnamerec.namid = 0; + lastnamerec.length = 0; + lastnamerec.offset = 0; + + for (i = 0; i < tp->numNameRecords; ++i) + { + localname = NULL; + namerec = &tp->namerecords[i]; + + if (logg5 && !k) + { + pdc_logg(pdc, "\t\t\t%2d. platformID: %d\n" + "\t\t\t encodingID: %d\n" + "\t\t\t languageID: %d\n" + "\t\t\t nameID: %d\n" + "\t\t\t length: %d\n" + "\t\t\t offset: %d\n", + i, + namerec->platform, namerec->encoding, + namerec->language, namerec->namid, + namerec->length, namerec->offset); + + /* read font name */ + if (namerec->length) + { + localname = + (char *) pdc_calloc(pdc, (size_t) namerec->length, fn); + tt_seek(ttf, (long) (offs + namerec->offset)); + tt_read(ttf, localname, (unsigned int) namerec->length); + + pdc_logg_hexdump(pdc, "data", "\t\t\t ", + localname, namerec->length); + } + pdc_logg(pdc, "\n"); + } + + if (tp->producer == NULL && + namerec->platform == tt_pfid_mac && + namerec->encoding == tt_wenc_symbol && + namerec->language == 0 && + namerec->namid == 0) + { + tp->producer = (char *) pdc_calloc(pdc, + (size_t) namerec->length + 1, fn); + tt_seek(ttf, (long) (offs + namerec->offset)); + tt_read(ttf, tp->producer, (unsigned int) namerec->length); + } + + if (namerec->length && namerec->namid == namid) + { + /* TTC font search */ + if (ttf->utf16fontname) + { + /* read font name */ + if (localname == NULL) + { + localname = (char *) pdc_calloc(pdc, + (size_t) namerec->length, fn); + tt_seek(ttf, (long) (offs + namerec->offset)); + tt_read(ttf, localname, (unsigned int) namerec->length); + } + + if (namerec->platform == tt_pfid_win) + { + pdc_logg_cond(pdc, 1, trc_font, + "\tUnicode fontname: \"%T\"\n", + localname, namerec->length); + + if (namerec->length == ttf->fnamelen && + !memcmp(localname, ttf->utf16fontname, + (size_t) ttf->fnamelen)) + { + /* font found */ + pdc_free(pdc, localname); + return pdc_true; + } + } + } + + /* search for the records with english names */ + else + { + /* we take the names from platformID 3 (Microsoft) or + * 1 (Macintosh). We favor Macintosh and then Microsoft + * with American English (LanguageID = 0x0409 = 1033) + */ + if ((lastnamerec.language != 0x0409 || + lastnamerec.platform != tt_pfid_win) && + (namerec->platform == tt_pfid_win || + (namerec->platform == tt_pfid_mac && + namerec->language == 0))) + { + lastnamerec = *namerec; + + /* We simulate always English */ + if (namerec->platform == tt_pfid_mac) + lastnamerec.language = 0x0409; + + if (namid == 4) irec4 = i; + if (namid == 6) irec6 = i; + } + } + } + + if (localname != NULL) + pdc_free(pdc, localname); + } + namid = 6; + } + + /* TTC font not found */ + if (ttf->utf16fontname) + return pdc_false; + + /* English font names */ + namid = 4; + irec = irec4; + for (k = 0; k < 2; k++) + { + if (irec == -1) + continue; + namerec = &tp->namerecords[irec]; + + /* read font name */ + len = (size_t) (namerec->length + 1); + localname = (char *) pdc_calloc(pdc, (size_t) len, fn); + tt_seek(ttf, (long) (offs + namerec->offset)); + tt_read(ttf, localname, (unsigned int) namerec->length); + + /* low byte picking */ + if (namerec->platform == tt_pfid_win) + { + for (j = 0; j < namerec->length / 2; j++) + { + /* We don't support wide character names */ + if (localname[2*j] != 0) + { + pdc_free(pdc, localname); + localname = NULL; + break; + } + localname[j] = localname[2*j + 1]; + } + if (localname) + localname[j] = 0; + } + + /* We observed this in EUDC fonts */ + if (localname && !strcmp(localname, "\060\060")) + { + pdc_free(pdc, localname); + localname = NULL; + } + + if (namid == 4 && localname) + tp->englishname4 = localname; + else if (namid == 6 && localname) + tp->englishname6 = localname; + + namid = 6; + irec = irec6; + } + + /* font name 4 (full font name) is required */ + if (tp->englishname6 == NULL && tp->englishname4 == NULL) + { + if (!ttf->fortet) + { + pdc_set_errmsg(pdc, FNT_E_TT_NONAME, 0, 0, 0, 0); + return pdc_false; + } + } + else + { + if (tp->englishname4 == NULL) + tp->englishname4 = pdc_strdup(pdc, tp->englishname6); + if (tp->englishname6 == NULL) + tp->englishname6 = pdc_strdup(pdc, tp->englishname4); + } + + return pdc_true; +} /* tt_get_tab_name */ + +static int tt_cpflag2cp[64] = +{ + 1252, 1250, 1251, 1253, 1254, 1255, 1256, 1257, + 1258, 0, 0, 0, 0, 0, 0, 0, + 874, 932, 936, 949, 950, 1361, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 869, 866, 865, 864, 863, 862, 861, 860, + 857, 855, 852, 775, 737, 708, 850, 437 +}; + +static int tt_cpflag2charcoll[4] = +{ + cc_japanese, cc_simplified_chinese, cc_korean, cc_traditional_chinese +}; + +void +tt_get_tab_OS_2(tt_file *ttf) +{ + pdc_bool logg3 = pdc_logg_is_enabled(ttf->pdc, 3, trc_font); + int i, j; + + tt_tab_OS_2 *tp = NULL; + + tp = (tt_tab_OS_2 *) tt_get_tab(ttf, fnt_str_OS_2, sizeof (tt_tab_OS_2), + pdc_false, NULL); + if (tp == NULL) + return; + ttf->tab_OS_2 = tp; + + tp->version = tt_get_ushort(ttf); + tp->xAvgCharWidth = tt_get_short(ttf); + tp->usWeightClass = tt_get_ushort(ttf); + tp->usWidthClass = tt_get_ushort(ttf); + tp->fsType = tt_get_ushort(ttf); + tp->ySubscriptXSize = tt_get_short(ttf); + tp->ySubscriptYSize = tt_get_short(ttf); + tp->ySubscriptXOffset = tt_get_short(ttf); + tp->ySubscriptYOffset = tt_get_short(ttf); + tp->ySuperscriptXSize = tt_get_short(ttf); + tp->ySuperscriptYSize = tt_get_short(ttf); + tp->ySuperscriptXOffset = tt_get_short(ttf); + tp->ySuperscriptYOffset = tt_get_short(ttf); + tp->yStrikeoutSize = tt_get_short(ttf); + tp->yStrikeoutPosition = tt_get_short(ttf); + tp->sFamilyClass = tt_get_ushort(ttf); + + tt_read(ttf, tp->panose, 10); + + tp->ulUnicodeRange1 = tt_get_ulong(ttf); + tp->ulUnicodeRange2 = tt_get_ulong(ttf); + tp->ulUnicodeRange3 = tt_get_ulong(ttf); + tp->ulUnicodeRange4 = tt_get_ulong(ttf); + + tt_read(ttf, tp->achVendID, 4); + + tp->fsSelection = tt_get_ushort(ttf); + tp->usFirstCharIndex = tt_get_ushort(ttf); + tp->usLastCharIndex = tt_get_ushort(ttf); + tp->sTypoAscender = tt_get_short(ttf); + tp->sTypoDescender = tt_get_short(ttf); + tp->sTypoLineGap = tt_get_short(ttf); + tp->usWinAscent = tt_get_ushort(ttf); + tp->usWinDescent = tt_get_ushort(ttf); + + if (tp->version >= 1) + { + tp->ulCodePageRange1 = tt_get_ulong(ttf); + tp->ulCodePageRange2 = tt_get_ulong(ttf); + } + else + { + tp->ulCodePageRange1 = 0; + tp->ulCodePageRange2 = 0; + } + + for (i = 0; i < PDC_NUMCHARCOLL; i++) + { + j = i + 17; + if (tp->ulCodePageRange1 & (1<charcolls[i] = tt_cpflag2charcoll[i]; + else + tp->charcolls[i] = cc_none; + } + + if (tp->version >= 2) + { + tp->sxHeight = tt_get_short(ttf); + tp->sCapHeight = tt_get_short(ttf); + tp->usDefaultChar = tt_get_ushort(ttf); + tp->usBreakChar = tt_get_ushort(ttf); + tp->usMaxContext = tt_get_ushort(ttf); + } + else + { + tp->sxHeight = FNT_MISSING_FONTVAL; + tp->sCapHeight = FNT_MISSING_FONTVAL; + tp->usDefaultChar = 0; + tp->usBreakChar = 0; + tp->usMaxContext = 0; + } + + /* there are fonts with inconsistent usFirstCharIndex */ + if (ttf->tab_cmap && ttf->tab_cmap->win && + tp->usFirstCharIndex != ttf->tab_cmap->win->startCount[0]) + ttf->tab_OS_2->usFirstCharIndex = ttf->tab_cmap->win->startCount[0]; + + if (logg3) + { + int nbit = 8 * sizeof(tt_ulong); + + pdc_logg_bitarr(ttf->pdc, "\t\tulUnicodeRange1 ", + (char *) &tp->ulUnicodeRange1, nbit); + pdc_logg_bitarr(ttf->pdc, "\t\tulUnicodeRange2 ", + (char *) &tp->ulUnicodeRange2, nbit); + pdc_logg_bitarr(ttf->pdc, "\t\tulUnicodeRange3 ", + (char *) &tp->ulUnicodeRange3, nbit); + pdc_logg_bitarr(ttf->pdc, "\t\tulUnicodeRange4 ", + (char *) &tp->ulUnicodeRange4, nbit); + + if (tp->version >= 1) + { + int n = 0; + + pdc_logg_bitarr(ttf->pdc, "\t\tulCodePageRange1", + (char *) &tp->ulCodePageRange1, nbit); + pdc_logg_bitarr(ttf->pdc, "\t\tulCodePageRange2", + (char *) &tp->ulCodePageRange2, nbit); + + for (i = 0; i < 32; i++) + { + if ((tp->ulCodePageRange1 & (1<pdc, "%s%d", + (n ? ", " : "\t\tsupported code pages: "), + tt_cpflag2cp[i]); + n++; + } + } + for (i = 0; i < 32; i++) + { + j = i + 32; + if ((tp->ulCodePageRange1 & (1<pdc, "%s%d", + (n ? ", " : "\t\tsupported code pages: "), + tt_cpflag2cp[j]); + n++; + } + } + + if (n) + pdc_logg(ttf->pdc, "\n"); + + n = 0; + for (i = 0; i < PDC_NUMCHARCOLL; i++) + { + if (tp->charcolls[i]) + { + pdc_logg(ttf->pdc, "%s%s", + (n ? ", " : "\t\tsupported character collections: "), + fnt_get_ordering_cid(tp->charcolls[i])); + n++; + } + } + if (n) + pdc_logg(ttf->pdc, "\n"); + } + } +} /* tt_get_tab_OS_2 */ + + +static void +tt_get_tab_post(tt_file *ttf) +{ + tt_tab_post *tp = NULL; + + + tp = (tt_tab_post *) tt_get_tab(ttf, fnt_str_post, sizeof (tt_tab_post), + !ttf->fortet, NULL); + if (tp == NULL) + return; + ttf->tab_post = tp; + + tp->formatType = tt_get_fixed(ttf); + tp->italicAngle = (tt_get_fixed(ttf) / 65536.0); + tp->underlinePosition = tt_get_fword(ttf); + tp->underlineThickness = tt_get_fword(ttf); + tp->isFixedPitch = tt_get_ulong(ttf); + tp->minMemType42 = tt_get_ulong(ttf); + tp->maxMemType42 = tt_get_ulong(ttf); + tp->minMemType1 = tt_get_ulong(ttf); + tp->maxMemType1 = tt_get_ulong(ttf); + + +} /* tt_get_tab_post */ + + + +/*--------------------------- general functions ------------------------------*/ + +#define FNT_O ((char) 0x4f) /* ASCII 'O' */ +#define FNT_T ((char) 0x54) /* ASCII 'T' */ + +#define FNT_t ((char) 0x74) /* ASCII 't' */ +#define FNT_r ((char) 0x72) /* ASCII 'r' */ +#define FNT_u ((char) 0x75) /* ASCII 'u' */ +#define FNT_e ((char) 0x65) /* ASCII 'e' */ + +#define FNT_c ((char) 0x63) /* ASCII 'c' */ +#define FNT_f ((char) 0x66) /* ASCII 'f' */ + +static const char *fnt_filetypes[4] = +{ + "TrueType", "OpenType", "Apple TrueType", "TrueType Collection" +}; + +pdc_bool +fnt_test_tt_font(pdc_core *pdc, tt_byte *img, tt_ulong *n_fonts, + pdc_bool requested) +{ + tt_ushort n_tables; + int ift = 0; + pdc_bool retval = requested ? pdc_false : pdc_undef; + + /* The TrueType (including OpenType/TT) "version" is always 0x00010000 */ + if (!(img[0] == 0x00 && img[1] == 0x01 && + img[2] == 0x00 && img[3] == 0x00)) + { + ift++; + + /* The OpenType/CFF version is always 'OTTO' */ + if (!(img[0] == FNT_O && img[1] == FNT_T && + img[2] == FNT_T && img[3] == FNT_O)) + { + ift++; + + /* Old Apple fonts have 'true' */ + if (!(img[0] == FNT_t && img[1] == FNT_r && + img[2] == FNT_u && img[3] == FNT_e)) + { + ift++; + + /* TrueType Collection */ + if (n_fonts == NULL || + !(img[0] == FNT_t && img[1] == FNT_t && + img[2] == FNT_c && img[3] == FNT_f)) + return retval; + + /* Version is always 0x00010000 or 0x00020000 */ + if (!(img[4] == 0x00 && (img[5] == 0x01 || img[5] == 0x02) && + img[6] == 0x00 && img[7] == 0x00)) + return retval; + + /* Number of fonts */ + *n_fonts = pdc_get_be_ulong(&img[8]); + + pdc_logg_cond(pdc, 1, trc_font, + "\t%s font with %d single fonts detected\n", + fnt_filetypes[ift], *n_fonts); + + return pdc_true; + } + } + } + + /* Number of tables */ + n_tables = pdc_get_be_ushort(&img[4]); + if (n_tables < 8 && n_tables > 64) /* max. 32 tables ? */ + return retval; + + /* Further check of the next 6 bytes not implemented */ + + if (n_fonts == NULL) + pdc_logg_cond(pdc, 1, trc_font, + "\t%s font with %d tables detected\n", + fnt_filetypes[ift], n_tables); + + return pdc_true; +} + +pdc_bool +fnt_is_opentype_font(tt_file *ttf) +{ + return (ttf->img[0] == FNT_O && + ttf->img[1] == FNT_T && + ttf->img[2] == FNT_T && + ttf->img[3] == FNT_O) ? pdc_true : pdc_false; +} + +pdc_bool +fnt_read_offset_tab(tt_file *ttf) +{ + static const char *fn = "fnt_get_tab_offset"; + pdc_core *pdc = ttf->pdc; + tt_byte img[TT_OFFSETTAB_SIZE]; + int i; + + /* Check */ + tt_read(ttf, img, TT_OFFSETTAB_SIZE); + if (fnt_test_tt_font(pdc, img, NULL, pdc_true) == pdc_false) + { + pdc_set_errmsg(pdc, FNT_E_TT_NOFONT, ttf->filename, 0, 0, 0); + return pdc_false; + } + + /* number of table directories */ + ttf->n_tables = pdc_get_be_ushort(&img[4]); + + /* set up table directory */ + ttf->dir = (tt_dirent *) pdc_malloc(pdc, + (size_t) (ttf->n_tables * sizeof (tt_dirent)), fn); + + tt_seek(ttf, (long) (ttf->offset + TT_OFFSETTAB_SIZE)); + + for (i = 0; i < ttf->n_tables; ++i) + { + tt_get_dirent(ttf->dir + i, ttf); + } + + /* make sure this isn't a bitmap-only Mac font */ + if (tt_tag2idx(ttf, fnt_str_bhed) != -1) + { + pdc_set_errmsg(pdc, FNT_E_TT_BITMAP, 0, 0, 0, 0); + return pdc_false; + } + + return pdc_true; + +} /* fnt_read_offset_tab */ + +pdc_bool +fnt_read_tt(tt_file *ttf) +{ + pdc_core *pdc = ttf->pdc; + + PDC_TRY(pdc) + { + if (fnt_read_offset_tab(ttf) == pdc_false) + { + PDC_EXIT_TRY(pdc); + return pdc_false; + } + + /* These are all required TrueType tables; + * optional tables are not read. + */ + tt_get_tab_cmap(ttf); + tt_get_tab_head(ttf); + tt_get_tab_hhea(ttf); + tt_get_tab_maxp(ttf); + if (!ttf->fortet) + tt_get_tab_hmtx(ttf); /* MUST be read AFTER hhea & maxp! */ + if (tt_get_tab_name(ttf) == pdc_false && !ttf->fortet) + { + PDC_EXIT_TRY(pdc); + return pdc_false; + } + tt_get_tab_post(ttf); + tt_get_tab_OS_2(ttf); /* may be missing from some Apple fonts */ + + /* this is an optional table, present only in OpenType fonts */ + if (tt_get_tab_CFF_(ttf) == pdc_false && !ttf->fortet) + { + PDC_EXIT_TRY(pdc); + return pdc_false; + } + + + PDC_EXIT_TRY(pdc); + return pdc_true; + } + PDC_CATCH(pdc) + { + } + + return pdc_false; +} /* fnt_read_tt */ + + + +/* convert Unicode scalar to glyph ID using cmap12 or cmap4. + */ +int +tt_unicode2gidx(tt_file *ttf, int usv, pdc_bool logg) +{ + pdc_core *pdc = ttf->pdc; + tt_cmap4 *cm4 = ttf->tab_cmap->win; + pdc_ushort uv; + int segs; + int gidx = 0; + int i; + + uv = (pdc_ushort) usv; + if (logg) pdc_logg(pdc, "\t\t\tU+%04X: ", uv); + segs = cm4->segCountX2 / 2; + + for (i = 0; i < segs; ++i) + if (uv <= cm4->endCount[i]) + break; + + if (logg) pdc_logg(pdc, "i=%d start=U+%04X ", i, cm4->startCount[i]); + + TT_IOCHECK(ttf, i != segs); + if (uv < cm4->startCount[i] || uv == 0xFFFF) + { + if (logg) pdc_logg(pdc, "==> gidx=0\n"); + return 0; + } + + if (logg) pdc_logg(pdc, "offs=%d ", cm4->idRangeOffs[i]); + + if (cm4->idRangeOffs[i] == 0) + { + if (logg) pdc_logg(pdc, "delta=%d ", cm4->idDelta[i]); + gidx = (int)((uv + cm4->idDelta[i]) & 0xFFFF); + } + else + { + int idx = (int) cm4->idRangeOffs[i] / 2 + + (int) (uv - cm4->startCount[i]) - (segs - i); + + if (idx < 0 || idx >= cm4->numGlyphIds) + { + pdc_warning(pdc, FNT_E_TT_GLYPHIDNOTFOUND, + pdc_errprintf(pdc, "%04X", uv), + 0, 0, 0); + return 0; + } + + if (logg) pdc_logg(pdc, "array[%d]=%d ", idx, gidx); + if (cm4->glyphIdArray[idx] == 0) + { + if (logg) pdc_logg(pdc, "==> gidx=0\n"); + return 0; + } + else + { + if (logg) pdc_logg(pdc, "delta=%d ", cm4->idDelta[i]); + gidx = (int)((cm4->glyphIdArray[idx] + cm4->idDelta[i]) & 0xFFFF); + } + } + + if (logg) pdc_logg(pdc, "gidx=%d ", gidx); + + /* this is necessary because of some Mac fonts (e.g. Hiragino) */ + if (gidx >= ttf->numGlyphs) + { + gidx = 0; + if (logg) pdc_logg(pdc, "==> gidx=0\n"); + } + else if (logg) + pdc_logg(pdc, "\n"); + + return gidx; +} + +int +tt_gidx2width(tt_file *ttf, int gidx) +{ + TT_ASSERT(ttf, ttf->tab_hmtx != (tt_tab_hmtx *) 0); + TT_ASSERT(ttf, ttf->tab_hhea != (tt_tab_hhea *) 0); + + { + int n_metrics = ttf->tab_hhea->numberOfHMetrics; + + if (gidx >= n_metrics) + gidx = n_metrics - 1; + if (ttf->monospace) + return ttf->monospace; + else + { + return FNT_TT2PDF(ttf->tab_hmtx->metrics[gidx].advanceWidth); + } + } +} /* tt_gidx2width */ + +void +fnt_set_tt_fontvalues(tt_file *ttf) +{ + fnt_font *font = ttf->font; + fnt_font_metric *ftm = &font->m; + + if (ttf->onlyCFF) + return; + + if (ttf->tab_head) + { + ftm->llx = FNT_TT2PDF(ttf->tab_head->xMin); + ftm->lly = FNT_TT2PDF(ttf->tab_head->yMin); + ftm->urx = FNT_TT2PDF(ttf->tab_head->xMax); + ftm->ury = FNT_TT2PDF(ttf->tab_head->yMax); + } + + if (ttf->tab_post) + { + ftm->italicAngle = ttf->tab_post->italicAngle; + ftm->isFixedPitch = (pdc_bool) ttf->tab_post->isFixedPitch; + ftm->underlinePosition = FNT_TT2PDF(ttf->tab_post->underlinePosition); + ftm->underlineThickness =FNT_TT2PDF(ttf->tab_post->underlineThickness); + } + + if (ttf->tab_OS_2) + { + + font->weight = fnt_check_weight(ttf->tab_OS_2->usWeightClass); + ftm->ascender = FNT_TT2PDF(ttf->tab_OS_2->sTypoAscender); + ftm->descender = FNT_TT2PDF(ttf->tab_OS_2->sTypoDescender); + + if (ttf->tab_OS_2->sCapHeight != FNT_MISSING_FONTVAL) + ftm->capHeight = FNT_TT2PDF(ttf->tab_OS_2->sCapHeight); + if (ttf->tab_OS_2->sxHeight != FNT_MISSING_FONTVAL) + ftm->xHeight = FNT_TT2PDF(ttf->tab_OS_2->sxHeight); + font->linegap = FNT_TT2PDF(ttf->tab_OS_2->sTypoLineGap); + } + + /* some fonts have no OS/2 table and + * some Apple fonts have zero values in the OS/2 table . + */ + if (ttf->tab_OS_2 == NULL || + (ttf->tab_OS_2->usWeightClass == 0 && + ttf->tab_OS_2->sTypoAscender == 0 && + ttf->tab_OS_2->sTypoDescender == 0 && + ttf->tab_OS_2->sTypoLineGap == 0)) + { + font->weight = fnt_macfontstyle2weight(ttf->tab_head->macStyle); + ftm->ascender = FNT_TT2PDF(ttf->tab_hhea->ascender); + ftm->descender = FNT_TT2PDF(ttf->tab_hhea->descender); + font->linegap = FNT_TT2PDF(ttf->tab_hhea->lineGap); + } + + /* default width */ + if (!ttf->fortet) + { + ftm->defwidth = tt_gidx2width(ttf, 0); + } +} + + +/* + * Create and fill some arrays in font structure. + * + * Before calling function the members 'encoding' and 'ev' + * of font struct have to been set: + * + * The desired arrays must be requested by following flags + * (enc == font->enc): + * + * TT_FONT_encvec: Encoding vector (enc == pdc_builtin) + * + * TT_FONT_gid2code: font->gid2code[font->numglyphs]: + * glyph ID -> 8-bit code (enc >= 0, == pdc_builtin) + * glyph ID -> Unicode otherwise. + * + * TT_FONT_code2gid: font->code2gid[font->numcodes]: + * 8-bit code -> glyph ID (enc >= 0, == pdc_builtin) + * Unicode -> glyph ID (enc == pdc_unicode) + * glyph ID -> glyph ID (enc == pdc_glyphid) + * + * TT_FONT_gid2name font->gdi2name[font->numglyphs]: + * glyph ID -> glyph name (enc == pdc_glyphid only) + * + * TT_FONT_name2unitab font->name2unitab[font->tabsize]: + * glyph name -> Unicode for unregistered names + * + * TT_FONT_m_ciw font->m.ciw[font->m.numinters] (Interval table) + * Unicode -> glyph width (enc == pdc_unicode only) + * + * TT_FONT_m_widths font->m.widths[font->numcodes] + * 8-bit code -> glyph width (enc >= 0, == pdc_builtin) + * glyph ID -> glyph width (enc == pdc_glyphid) + * + * TT_FONT_names font->m.name = englishname4 + * font->name = englishname6 + */ +int +fnt_set_tt_fontarrays(tt_file *ttf, int flags) +{ + static const char *fn = "pdc_set_tt_fontarrays"; + pdc_core *pdc = ttf->pdc; + fnt_font *font = ttf->font; + pdc_bool logg2 = pdc_logg_is_enabled(pdc, 2, trc_font); + pdc_bool logg5 = pdc_logg_is_enabled(pdc, 5, trc_font); + pdc_bool logg7 = pdc_logg_is_enabled(pdc, 7, trc_font); + pdc_encoding enc = font->enc, encb = pdc_invalidenc; + pdc_encodingvector *ev = NULL, *evb = NULL; + const char *glyphname; + pdc_bool regorder, isencbyte = pdc_false; + pdc_ushort uc, uv; + int ncodes = 0, gidx = 0, width = 0, foundglyphs = 0, uvoffset = 0; + int ucoffset = 0; + int code; + + /* Unicode offset for symbol fonts */ + if (ttf->issymbol == pdc_true) + { + if (ttf->tab_OS_2) + { + /* e.g. WingDings has usFirstChar = 0xF020, but we must start + ** at 0xF000. I haven't seen non-symbol fonts with a usFirstChar + ** like that; perhaps we have to apply similar tricks then... + */ + uvoffset = (ttf->tab_OS_2->usFirstCharIndex & 0xFF00); + } + else + { + /* This would be an Apple font with an encoding different + * from macroman or a subset font withot OS_2 table. + */ + if (!ttf->fortet) + { + pdc_set_errmsg(pdc, FNT_E_TT_SYMBOLOS2, 0, 0, 0, 0); + return -1; + } + uvoffset = 0xF000; + } + + if (logg7) + pdc_logg(pdc, "\t\t\tuvoffset: U+%04X\n", uvoffset); + } + + /* font names */ + if (flags & TT_FONT_names && ttf->tab_name) + { + font->m.name = pdc_strdup(pdc, ttf->tab_name->englishname4); + font->name = pdc_strdup(pdc, ttf->tab_name->englishname6); + } + + /* is Standard Latin font */ + font->issymbfont = ttf->issymbol; + + /* number of glyphs */ + font->numglyphs = ttf->numGlyphs; + + /* number of codes */ + switch(enc) + { + case pdc_cid: + case pdc_unicode: + font->numcodes = ttf->numunicode; + break; + + case pdc_glyphid: + font->numcodes = font->numglyphs; + break; + + default: + font->numcodes = 256; + ev = pdc_get_encoding_vector(pdc, enc); + isencbyte = pdc_true; + break; + } + + + if (enc < 0 && ttf->hasonlymac) + { + encb = pdc_macroman; + evb = pdc_get_encoding_vector(pdc, encb); + } + else + { + encb = enc; + evb = ev; + + if (flags & TT_FONT_encvec && enc == pdc_builtin) + { + evb = fnt_create_font_ev(pdc, font); + ev = evb; + } + } + + if (flags & TT_FONT_code2gid) + { + if (ttf->numunicode <= PDC_NUM_BMPVAL || isencbyte || + enc == pdc_glyphid) + { + font->code2gid = (pdc_ushort *) pdc_calloc(pdc, + font->numcodes * sizeof (pdc_ushort), fn); + } + } + + if ((flags & TT_FONT_gid2code) || logg2) + { + if (ttf->numunicode <= PDC_NUM_BMPVAL || isencbyte) + { + font->gid2code = (pdc_ushort *) pdc_calloc(pdc, + font->numglyphs * sizeof (pdc_ushort), fn); + } + } + + + if (flags & TT_FONT_m_widths) + { + font->m.numwidths = font->numcodes; + font->m.widths = (int *) pdc_calloc(pdc, + font->m.numwidths * sizeof(int), fn); + } + + + /* + * Build the char width tables for the font, set mappings GID <-> Code, + * and count the characters. + */ + foundglyphs = 0; + regorder = pdc_true; + ncodes = (enc == pdc_glyphid) ? ttf->numunicode : font->numcodes; + for (code = 0; code < ncodes; code++) + { + uc = (pdc_ushort) code; + uv = 0; + gidx = 0; + + + if (encb == pdc_macroman && ttf->tab_cmap->mac) + { + tt_cmap0_6 *cm = ttf->tab_cmap->mac; + + if (code > -1 && code < (int) (cm->firstCode + cm->entryCount)) + gidx = cm->glyphIdArray[code]; + } + else if (ttf->issymbol == pdc_true) + { + switch (encb) + { + case pdc_unicode: + if (!ttf->fortet) + { + if (code < 0x00FF) + { + /* we map the lower Unicode values too */ + if (uvoffset > 0x00FF) + regorder = pdc_false; + uv = (pdc_ushort) (code + uvoffset); + break; + } + regorder = pdc_true; + } + + case pdc_glyphid: + uv = (pdc_ushort) code; + break; + + default: + { + uv = (pdc_ushort) (code + uvoffset); + } + if (evb != NULL) + evb->codes[code] = uv; + break; + } + + if (!gidx) + gidx = tt_unicode2gidx(ttf, (int) uv, logg7); + } + else + { + uv = evb->codes[code]; + if (uv) + { + gidx = tt_unicode2gidx(ttf, (int) uv, logg7); + } + } + + /* + * Mapping GID -> [Uni]code + * This is a 1:n relation (e.g. 1 -> SPACE, 1 -> NBSP) + * We prefer the first occurence (SPACE) (regorder), + * in the case of TT symbol fonts the second occurence. + */ + if (gidx && regorder && uc >= ucoffset) + { + /* mapping gid -> code */ + if (font->gid2code) + { + if (!font->gid2code[gidx]) + { + font->gid2code[gidx] = uc; + if (logg5) + pdc_logg(pdc, "\t\tGID: %d -> U+%04X\n", + gidx, font->gid2code[gidx]); + } + else if (logg2) + { + pdc_logg(pdc, "\t\tGID: %d: U+%04X vs. U+%04X\n", + gidx, font->gid2code[gidx], uc); + } + } + foundglyphs++; + + } + + switch (enc) + { + + default: + if (font->m.numwidths) + font->m.widths[code] = tt_gidx2width(ttf, gidx); + break; + } + + /* mapping code -> gid */ + if (font->code2gid) + { + font->code2gid[code] = (pdc_ushort) gidx; + if (logg5 && gidx) + pdc_logg(pdc, "\t\tU+%04X -> GID: %d\n", + code, font->code2gid[code]); + } + } + + + /* logging protocol and/or to check the completeness + * of the glyph names + */ + if (logg2 + ) + { + if (logg2) + pdc_logg(pdc, + "\n\t\tGlyph mapping for %d glyphs:\n", ttf->numGlyphs); + + width = -1; + for (gidx = 0; gidx < ttf->numGlyphs; gidx++) + { + pdc_bool fontspecific = pdc_false; + glyphname = NULL; + + + code = fnt_get_code(gidx, font); + if (!ttf->fortet) + width = tt_gidx2width(ttf, gidx); + + if (code >= 0 && glyphname == NULL) + { + if (enc >= 0 || (ttf->issymbol && ev != NULL)) + glyphname = ev->chars[code]; + else if (enc != pdc_builtin && code <= 0xFFFF) + glyphname = (char *) pdc_unicode2glyphname(pdc, + (pdc_ushort) code); + } + + pdc_logg(pdc, "\t\tGID%5d: ", gidx); + if (!ttf->fortet) + pdc_logg(pdc, "width=%4d ", width); + + switch (enc) + { + + default: + if (!gidx || code > 0) + { + if (enc >= 0 || (ttf->issymbol && ev != NULL)) + { + uv = ev->codes[code]; + pdc_logg(pdc, "code=%3d U+%04X ", code, uv); + } + else + { + if (ttf->fortet && enc == pdc_builtin) + pdc_logg(pdc, "U+%04X ", code); + else + pdc_logg(pdc, "code=%3d ", code); + } + } + break; + } + if (glyphname != NULL) + pdc_logg(pdc, "\"%s\"", glyphname); + if (fontspecific) + pdc_logg(pdc, " (specific)"); + pdc_logg(pdc, "\n"); + } + } + + if (!(flags & TT_FONT_gid2code)) + { + if (ttf->numunicode <= PDC_NUM_BMPVAL && font->gid2code != NULL) + { + pdc_free(pdc, font->gid2code); + font->gid2code = NULL; + } + } + + return foundglyphs; +} + +pdc_encoding +fnt_get_tt_encoding_key(tt_file *ttf, pdc_encoding inenc) +{ + pdc_encoding outenc = inenc; + + /* Symbol font */ + if (ttf->issymbol && inenc >= pdc_winansi) + outenc = pdc_builtin; + + /* MacRoman font */ + if (ttf->hasonlymac && inenc >= pdc_builtin) + outenc = pdc_macroman; + + if (!ttf->issymbol && !ttf->haswinuni && !ttf->hasonlymac) + { + outenc = pdc_invalidenc; + pdc_logg_cond(ttf->pdc, 1, trc_font, + "\tTrueType font contains %s cmap table\n", + ttf->tab_cmap ? "unsupported" : "no" ); + } + else + { + pdc_logg_cond(ttf->pdc, 1, trc_font, + "\tEncoding \"%s\" will be determined\n", + pdc_get_user_encoding(ttf->pdc, outenc)); + } + + return outenc; +} + +static pdc_bool +fnt_check_and_read_ttc(pdc_core *pdc, pdc_file *fp, + const char *filename, const char *fontname, + fnt_font *font, tt_ulong n_fonts) +{ + static const char *fn = "fnt_check_and_read_ttc"; + const char *sf; + tt_file *ttf; + pdc_byte *utf16fontname = NULL; + pdc_bool retval = pdc_false; + pdc_text_format textformat = PDC_UTF8; + pdc_text_format targettextformat = pdc_utf16be; + int i, inlen, outlen; + int ift = -1; + + /* initialize */ + ttf = fnt_new_tt(pdc, font); + ttf->filename = filename; + ttf->fontname = fontname; + ttf->check = pdc_true; + ttf->fp = fp; + ttf->verbose = pdc_false; + + /* searching for font index in font name */ + sf = strrchr(fontname, ':'); + if (sf != NULL) + { + sf++; + if (!*sf) + ift = 0; + else if (pdc_str2integer(sf, PDC_INT_UNSIGNED, &i)) + ift = i; + } + + /* create UTF-16-BE font name string for searching in font file */ + if (ift == -1) + { + inlen = (int) strlen(font->utf8name); + if (pdc_convert_string(pdc, textformat, 0, NULL, + (pdc_byte *) font->utf8name, inlen, + &targettextformat, NULL, + &utf16fontname, &outlen, + PDC_CONV_NOBOM | PDC_CONV_INFLATE, ttf->verbose)) + { + goto FNT_TRUETYPE_EXIT; + } + } + + /* search font */ + for (i = 0; i < (int)n_fonts; ++i) + { + if (i) fnt_delete_tt(ttf); + + tt_seek(ttf, (long) (TT_OFFSETTAB_SIZE + i * sizeof(tt_ulong))); + ttf->offset = tt_get_ulong(ttf); + tt_seek(ttf, (long) ttf->offset); + + pdc_logg_cond(pdc, 1, trc_font, "\tChecking font #%d \n", i+1); + + /* Offset Table */ + if (!fnt_read_offset_tab(ttf)) + goto FNT_TRUETYPE_EXIT; + + /* font name match in Naming Table */ + if (ift > -1) + { + if (ift == i) + break; + } + else + { + /* font name match in Naming Table */ + if (utf16fontname == NULL) + break; + ttf->utf16fontname = (char *) utf16fontname; + ttf->fnamelen = outlen; + if (tt_get_tab_name(ttf)) + break; + } + } + if (utf16fontname != NULL) + pdc_free(pdc, utf16fontname); + + /* font found */ + if (i < (int)n_fonts) + { + tt_byte *pos; + tt_ulong headlen, dirlen, tablen, length, offset; + + /* create file in memory */ + tablen = 0; + dirlen = 4 * sizeof(tt_ulong); + headlen = (tt_ulong) (TT_OFFSETTAB_SIZE + ttf->n_tables * dirlen); + font->filelen = headlen; + for (i = 0; i < ttf->n_tables; i++) + { + length = ttf->dir[i].length; + if (length > tablen) tablen = length; + font->filelen += length; + } + font->img = (pdc_byte *) pdc_malloc(pdc, font->filelen, fn); + + /* read font file */ + tt_seek( ttf, (long) ttf->offset); + tt_read( ttf, font->img, headlen); + pos = font->img + headlen; + for (i = 0; i < ttf->n_tables; i++) + { + length = ttf->dir[i].length; + tt_seek( ttf, (long) ttf->dir[i].offset); + tt_read( ttf, pos, length); + ttf->dir[i].offset = (unsigned int) (pos - font->img); + pos += length; + } + + /* correct offsets in Table Directory */ + pos = font->img + TT_OFFSETTAB_SIZE + 2 * sizeof(tt_ulong); + for (i = 0; i < ttf->n_tables; i++) + { + offset = ttf->dir[i].offset; + pos[0] = (tt_byte) (offset >> 24); + pos[1] = (tt_byte) (offset >> 16); + pos[2] = (tt_byte) (offset >> 8); + pos[3] = (tt_byte) (offset); + pos += dirlen; + } + retval = pdc_true; + } + else + { + pdc_set_errmsg(pdc, FNT_E_TTC_NOTFOUND, filename, 0, 0, 0); + goto FNT_TRUETYPE_EXIT; + } + + FNT_TRUETYPE_EXIT: + + ttf->check = pdc_false; + fnt_delete_tt(ttf); + + return retval; +} + +pdc_bool +fnt_check_tt_font(pdc_core *pdc, const char *filename, const char *fontname, + fnt_font *font, pdc_bool requested) +{ + pdc_file *fp; + char fullname[PDC_FILENAMELEN]; + tt_byte img[TT_OFFSETTAB_SIZE]; + pdc_bool ismem = pdc_false; + tt_ulong n_fonts = 0; + int retval = requested ? pdc_false : pdc_undef; + + fp = pdc_fsearch_fopen(pdc, filename, fullname, "font ",PDC_FILE_BINARY); + if (fp != NULL) + { + if (PDC_OK_FREAD(fp, img, TT_OFFSETTAB_SIZE)) + { + pdc_logg_cond(pdc, 1, trc_font, + "\tLoading TrueType fontfile \"%s\":\n", fullname); + + retval = fnt_test_tt_font(pdc, img, &n_fonts, requested); + if (retval == pdc_true) + { + ismem = pdc_file_isvirtual(fp); + + if (fontname != NULL) + { + if (n_fonts > 1) + { + retval = fnt_check_and_read_ttc(pdc, fp, filename, + fontname, font, n_fonts); + fp = NULL; + } + else + { + font->img = (pdc_byte *) + pdc_freadall(fp, &font->filelen, NULL); + } + + if (retval == pdc_true) + { + if (font->filelen == 0) + { + pdc_set_errmsg(pdc, + PDC_E_IO_READ, fullname, 0, 0, 0); + retval = pdc_false; + } + } + } + + if (retval == pdc_true) + { + if (fp != NULL && ismem) + { + font->imgname = pdc_strdup(pdc, filename); + pdc_lock_pvf(pdc, font->imgname); + } + + font->filename = pdc_strdup(pdc, fullname); + } + } + } + + if (fp != NULL) + pdc_fclose(fp); + } + else + { + retval = pdc_check_fopen_errmsg(pdc, requested); + } + + return retval; +} + + +/* + * After fnt_new_tt initialize following members + * (here with the opposite of default): + * + * ttf->filename = filename; + * ttf->fontname = fontname; + * + * ttf->verbose = pdc_false; + * ttf->kerning = pdc_true; + * ttf->vertical = pdc_true; + * ttf->fortet = pdc_true; + * + * ttf->check = pdc_true; + * ttf->incore = pdc_true; + * ttf->savecff = pdc_true; + * ttf->monospace = 1000; + * + * ttf->fp = fp; + * + */ +tt_file * +fnt_new_tt(pdc_core *pdc, fnt_font *font) +{ + static const char *fn = "fnt_new_tt"; + + tt_file *ttf = (tt_file *) + pdc_malloc(pdc, (size_t) sizeof (tt_file), fn); + + ttf->pdc = pdc; + ttf->font = font; + + ttf->img = (tt_byte *) font->img; + ttf->pos = ttf->img; + ttf->end = ttf->img + font->filelen; + + ttf->filename = NULL; + ttf->fontname = NULL; + ttf->verbose = pdc_true; + ttf->fortet = pdc_false; + ttf->check = pdc_false; + ttf->incore = pdc_false; + ttf->savecff = pdc_false; + ttf->monospace = 0; + ttf->fp = NULL; + + ttf->n_tables = 0; + ttf->offset = 0; + ttf->dir = (tt_dirent *) 0; + + ttf->tab_cmap = (tt_tab_cmap *) 0; + ttf->tab_head = (tt_tab_head *) 0; + ttf->tab_hhea = (tt_tab_hhea *) 0; + ttf->tab_hmtx = (tt_tab_hmtx *) 0; + ttf->tab_maxp = (tt_tab_maxp *) 0; + ttf->tab_name = (tt_tab_name *) 0; + ttf->tab_post = (tt_tab_post *) 0; + ttf->tab_OS_2 = (tt_tab_OS_2 *) 0; + ttf->tab_CFF_ = (tt_tab_CFF_ *) 0; + + ttf->numGlyphs = 0; + ttf->onlyCFF = 0; + ttf->hasGlyphNames = 0; + ttf->numunicode = PDC_NUM_BMPVAL; + ttf->builtinenc = pdc_stdenc; + ttf->regisadobe = pdc_false; + ttf->charcoll = cc_none; + ttf->supplement = 0; + + ttf->issymbol = pdc_false; + ttf->haswinuni = pdc_false; + ttf->hasonlymac = pdc_false; + + + ttf->utf16fontname = (char *) 0; + ttf->fnamelen = 0; + + return ttf; + +} /* fnt_new_tt */ + +void +fnt_delete_tt(tt_file *ttf) +{ + pdc_core *pdc = ttf->pdc; + int i; + + (void) i; + + if (ttf->check == pdc_false && ttf->fp != (pdc_file *) 0) + pdc_fclose(ttf->fp); + + if (ttf->dir != (tt_dirent *) 0) + pdc_free(pdc, ttf->dir); + ttf->dir = (tt_dirent *) 0; + + + if (ttf->tab_head != (tt_tab_head *) 0) + pdc_free(pdc, ttf->tab_head); + if (ttf->tab_hhea != (tt_tab_hhea *) 0) + pdc_free(pdc, ttf->tab_hhea); + if (ttf->tab_maxp != (tt_tab_maxp *) 0) + pdc_free(pdc, ttf->tab_maxp); + if (ttf->tab_OS_2 != (tt_tab_OS_2 *) 0) + pdc_free(pdc, ttf->tab_OS_2); + if (ttf->tab_CFF_ != (tt_tab_CFF_ *) 0) + pdc_free(pdc, ttf->tab_CFF_); + if (ttf->tab_post != (tt_tab_post *) 0) + { + pdc_free(pdc, ttf->tab_post); + } + + if (ttf->tab_cmap != (tt_tab_cmap *) 0) + { + if (ttf->tab_cmap->mac != (tt_cmap0_6 *) 0) { + if (ttf->tab_cmap->mac->glyphIdArray) + pdc_free(pdc, ttf->tab_cmap->mac->glyphIdArray); + pdc_free(pdc, ttf->tab_cmap->mac); + } + + if (ttf->tab_cmap->win != (tt_cmap4 *) 0) + { + tt_cmap4 *cm4 = (tt_cmap4 *) ttf->tab_cmap->win; + + if (cm4->endCount != 0) pdc_free(pdc, cm4->endCount); + if (cm4->startCount != 0) pdc_free(pdc, cm4->startCount); + if (cm4->idDelta != 0) pdc_free(pdc, cm4->idDelta); + if (cm4->idRangeOffs != 0) pdc_free(pdc, cm4->idRangeOffs); + if (cm4->glyphIdArray != 0) pdc_free(pdc, cm4->glyphIdArray); + + pdc_free(pdc, cm4); + } + + if (ttf->tab_cmap->ucs4 != (tt_cmap12 *) 0) + { + tt_cmap12 *cm12 = (tt_cmap12 *) ttf->tab_cmap->ucs4; + + if (cm12->grouptab != 0) pdc_free(pdc, cm12->grouptab); + + pdc_free(pdc, cm12); + } + + pdc_free(pdc, ttf->tab_cmap); + } + + if (ttf->tab_hmtx != (tt_tab_hmtx *) 0) + { + if (ttf->tab_hmtx->metrics != (tt_metric *) 0) + pdc_free(pdc, ttf->tab_hmtx->metrics); + if (ttf->tab_hmtx->lsbs != (tt_fword *) 0) + pdc_free(pdc, ttf->tab_hmtx->lsbs); + pdc_free(pdc, ttf->tab_hmtx); + } + + if (ttf->tab_name != (tt_tab_name *) 0) + { + if (ttf->tab_name->namerecords != (tt_nameref *) 0) + pdc_free(pdc, ttf->tab_name->namerecords); + if (ttf->tab_name->englishname4 != (char *) 0) + pdc_free(pdc, ttf->tab_name->englishname4); + if (ttf->tab_name->englishname6 != (char *) 0) + pdc_free(pdc, ttf->tab_name->englishname6); + if (ttf->tab_name->producer != (char *) 0) + pdc_free(pdc, ttf->tab_name->producer); + pdc_free(pdc, ttf->tab_name); + } + ttf->tab_name = (tt_tab_name *) 0; + + + /* Note: do not clean up ttf->img since the data belongs to font->img + */ + + if (ttf->check == pdc_false) + pdc_free(pdc, ttf); + +} /* fnt_delete_tt */ + + +#endif /* PDF_TRUETYPE_SUPPORTED */ diff --git a/src/pdflib/font/ft_truetype.h b/src/pdflib/font/ft_truetype.h new file mode 100644 index 0000000..89cd3fb --- /dev/null +++ b/src/pdflib/font/ft_truetype.h @@ -0,0 +1,558 @@ +/*---------------------------------------------------------------------------* + | PDFlib - A library for generating PDF on the fly | + +---------------------------------------------------------------------------+ + | Copyright (c) 1997-2006 Thomas Merz and PDFlib GmbH. All rights reserved. | + +---------------------------------------------------------------------------+ + | | + | This software is subject to the PDFlib license. It is NOT in the | + | public domain. Extended versions and commercial licenses are | + | available, please check http://www.pdflib.com. | + | | + *---------------------------------------------------------------------------*/ + +/* $Id: ft_truetype.h,v 1.1 2008/10/17 06:10:43 scuri Exp $ + * + * FONT TrueType typedefs, structures, and enums + * + */ + +#ifndef FT_TRUETYPE_H +#define FT_TRUETYPE_H + +typedef unsigned char tt_byte; +typedef char tt_char; +typedef unsigned short tt_ushort; +typedef short tt_short; +typedef unsigned int tt_ulong; +typedef int tt_long; + +typedef long tt_fixed; +typedef short tt_fword; +typedef unsigned short tt_ufword; + +#define tt_get_fixed tt_get_long +#define tt_get_fword tt_get_short +#define tt_get_ufword tt_get_ushort + +#define TT_XKERNPAIR_CHUNKSIZE 256 +#define TT_ACCGIDTAB_CHUNKSIZE 256 + +#define TT_OPERAND_STACKSIZE 48 + +#define TT_NUMSTDSTRINGS 391 +#define TT_NUMISOSTRINGS 229 +#define TT_NUMEXPSTRINGS 379 +#define TT_NUMEXPERTGIDS 166 + +#define TT_OFFSETTAB_SIZE 12 + +/* flags for fnt_set_tt_fontarrays */ +#define TT_FONT_encvec (1<<0) +#define TT_FONT_gid2code (1<<1) +#define TT_FONT_code2gid (1<<2) +#define TT_FONT_gid2name (1<<3) +#define TT_FONT_m_ciw (1<<4) +#define TT_FONT_m_widths (1<<5) +#define TT_FONT_names (1<<6) +#define TT_FONT_name2unitab (1<<7) + +typedef enum +{ + cff_version = 0, + cff_Notice = 1, + cff_FullName = 2, + cff_FamilyName = 3, + cff_Weight = 4, + cff_FontBBox = 5, + cff_BlueValues = 6, + cff_OtherBlues = 7, + cff_FamilyBlues = 8, + cff_FamilyOtherBlues = 9, + cff_StdHW = 10, + cff_StdVW = 11, + cff_Copyright = 0x100, /* 12 0 */ + cff_isFixedPitch = 0x101, /* 12 1 */ + cff_ItalicAngle = 0x102, /* 12 2 */ + cff_UnderlinePosition = 0x103, /* 12 3 */ + cff_UnderlineThickness = 0x104, /* 12 4 */ + cff_PaintType = 0x105, /* 12 5 */ + cff_CharstringType = 0x106, /* 12 6 */ + cff_FontMatrix = 0x107, /* 12 7 */ + cff_StrokeWidth = 0x108, /* 12 8 */ + cff_BlueScale = 0x109, /* 12 9 */ + cff_BlueShift = 0x10A, /* 12 10 */ + cff_BlueFuzz = 0x10B, /* 12 11 */ + cff_StemSnapH = 0x10C, /* 12 12 */ + cff_StemSnapV = 0x10D, /* 12 13 */ + cff_ForceBold = 0x10E, /* 12 14 */ + /* 0x10F, 12 15 */ + /* 0x110, 12 16 */ + cff_LanguageGroup = 0x111, /* 12 17 */ + cff_ExpansionFactor = 0x112, /* 12 18 */ + cff_initialRandomSeed = 0x113, /* 12 19 */ + cff_SyntheticBase = 0x114, /* 12 20 */ + cff_PostScript = 0x115, /* 12 21 */ + cff_BaseFontName = 0x116, /* 12 22 */ + cff_BaseFontBlend = 0x117, /* 12 23 */ + /* 0x118, 12 24 */ + /* 0x119, 12 25 */ + /* 0x11A, 12 26 */ + /* 0x11B, 12 27 */ + /* 0x11C, 12 28 */ + /* 0x11D, 12 29 */ + cff_ROS = 0x11E, /* 12 30 */ + cff_CIDFontVersion = 0x11F, /* 12 31 */ + cff_CIDFontRevision = 0x120, /* 12 32 */ + cff_CIDFontType = 0x121, /* 12 33 */ + cff_CIDCount = 0x122, /* 12 34 */ + cff_UIDBase = 0x123, /* 12 35 */ + cff_FDArray = 0x124, /* 12 36 */ + cff_FDSelect = 0x125, /* 12 37 */ + cff_FontName = 0x126, /* 12 38 */ + /* 0x127, 12 39 */ + cff_UniqueID = 13, + cff_XUID = 14, + cff_Charsets = 15, + cff_Encoding = 16, + cff_CharStrings = 17, + cff_Private = 18, + cff_Subrs = 19, + cff_defaultWidthX = 20, + cff_nominalWidthX = 21 +} +tt_cff_oper; + +typedef struct +{ + char tag[5]; + tt_ulong checksum; + tt_ulong offset; + tt_ulong length; +} tt_dirent; + +typedef enum +{ + tt_pfid_uni = 0, + tt_pfid_mac = 1, + tt_pfid_iso = 2, + tt_pfid_win = 3, + tt_pfid_custom = 4 +} tt_platform_id; + +typedef enum +{ + tt_wenc_symbol = 0, + tt_wenc_text = 1, + tt_wenc_mtext = 3, + tt_wenc_utext = 10 +} tt_win_encoding_id; + +/* format 4 cmap table: +*/ +typedef struct +{ + tt_ushort encodingID; + tt_ushort format; + tt_ushort length; + tt_ushort version; + tt_ushort segCountX2; /* segCount * 2 */ + tt_ushort searchRange; + tt_ushort entrySelector; + tt_ushort rangeShift; + tt_ushort * endCount; /* [segCount] */ + tt_ushort * startCount; /* [segCount] */ + tt_short * idDelta; /* [segCount] */ + tt_ushort * idRangeOffs; /* [segCount] */ + int numGlyphIds; + tt_ushort * glyphIdArray; +} tt_cmap4; + +/* combined data structure for format 0 and format 6 encoding tables: +*/ +typedef struct +{ + tt_ushort format; + tt_ushort length; + tt_ushort language; + tt_ushort firstCode; + tt_ushort entryCount; + tt_ushort *glyphIdArray; +} tt_cmap0_6; + +/* format 12 cmap table: +*/ +typedef struct +{ + tt_ulong startCharCode; + tt_ulong endCharCode; + tt_ulong startGlyphID; +} tt_grouptab; + +typedef struct +{ + tt_ushort format; + tt_ulong length; + tt_ulong language; + tt_ulong nGroups; + tt_grouptab *grouptab; /* [nGroups] */ +} tt_cmap12; + +typedef struct +{ + tt_ushort version; + tt_ushort numEncTabs; + + tt_cmap4 *win; + tt_cmap0_6 *mac; + tt_cmap12 *ucs4; + + /* picked table */ + tt_ushort platform; + tt_ushort encoding; + tt_ushort format; + tt_ulong offset; + tt_ulong length; +} tt_tab_cmap; + +typedef struct +{ + tt_fixed version; + tt_fixed fontRevision; + tt_ulong checkSumAdjustment; + tt_ulong magicNumber; + tt_ushort flags; + tt_ushort unitsPerEm; + tt_ulong created[2]; + tt_ulong modified[2]; + tt_fword xMin, yMin; + tt_fword xMax, yMax; + tt_ushort macStyle; + tt_ushort lowestRecPPEM; + tt_short fontDirectionHint; + tt_short indexToLocFormat; + tt_short glyphDataFormat; +} tt_tab_head; + +typedef struct +{ + tt_fixed version; + tt_fword ascender; + tt_fword descender; + tt_fword lineGap; + tt_fword advanceWidthMax; /* specification: tt_ufword */ + tt_fword minLeftSideBearing; + tt_fword minRightSideBearing; + tt_fword xMaxExtent; + tt_short caretSlopeRise; + tt_short caretSlopeRun; + tt_short res1; + tt_short res2; + tt_short res3; + tt_short res4; + tt_short res5; + tt_short metricDataFormat; + tt_ushort numberOfHMetrics; +} tt_tab_hhea; + +typedef struct +{ + tt_fword advanceWidth; /* specification: tt_ufword */ + tt_fword lsb; +} tt_metric; + +typedef struct +{ + tt_metric * metrics; + tt_fword * lsbs; +} tt_tab_hmtx; + +typedef struct +{ + tt_fixed version; + tt_ushort numGlyphs; + tt_ushort maxPoints; + tt_ushort maxContours; + tt_ushort maxCompositePoints; + tt_ushort maxCompositeContours; + tt_ushort maxZones; + tt_ushort maxTwilightPoints; + tt_ushort maxStorage; + tt_ushort maxFunctionDefs; + tt_ushort maxInstructionDefs; + tt_ushort maxStackElements; + tt_ushort maxSizeOfInstructions; + tt_ushort maxComponentElements; + tt_ushort maxComponentDepth; +} tt_tab_maxp; + +typedef struct +{ + tt_ushort platform; + tt_ushort encoding; + tt_ushort language; + tt_ushort namid; + tt_ushort length; + tt_ushort offset; +} tt_nameref; + +typedef struct +{ + tt_ushort format; + tt_ushort numNameRecords; + tt_ushort offsetStrings; + tt_nameref *namerecords; + char *englishname4; + char *englishname6; + char *producer; +} tt_tab_name; + +typedef struct +{ + tt_ushort version; + tt_short xAvgCharWidth; + tt_ushort usWeightClass; + tt_ushort usWidthClass; + tt_ushort fsType; /* tt_short? */ + tt_short ySubscriptXSize; + tt_short ySubscriptYSize; + tt_short ySubscriptXOffset; + tt_short ySubscriptYOffset; + tt_short ySuperscriptXSize; + tt_short ySuperscriptYSize; + tt_short ySuperscriptXOffset; + tt_short ySuperscriptYOffset; + tt_short yStrikeoutSize; + tt_short yStrikeoutPosition; + tt_ushort sFamilyClass; /* tt_short? */ + tt_byte panose[10]; + tt_ulong ulUnicodeRange1; + tt_ulong ulUnicodeRange2; + tt_ulong ulUnicodeRange3; + tt_ulong ulUnicodeRange4; + tt_char achVendID[4]; + tt_ushort fsSelection; + tt_ushort usFirstCharIndex; + tt_ushort usLastCharIndex; + + /* tt_ushort according to spec; obviously a spec bug. + */ + tt_short sTypoAscender; + tt_short sTypoDescender; + tt_short sTypoLineGap; + + tt_ushort usWinAscent; + tt_ushort usWinDescent; + + /* if version >= 1 + */ + tt_ulong ulCodePageRange1; + tt_ulong ulCodePageRange2; + + /* if version >= 2 (according to OpenType spec) + */ + tt_short sxHeight; + tt_short sCapHeight; + tt_ushort usDefaultChar; + tt_ushort usBreakChar; + tt_ushort usMaxContext; + + int charcolls[PDC_NUMCHARCOLL]; +} tt_tab_OS_2; + + +typedef struct +{ + tt_ulong offset; + tt_ulong length; +} +tt_tab_CFF_; + +typedef struct +{ + tt_fixed formatType; + double italicAngle; + tt_fword underlinePosition; + tt_fword underlineThickness; + tt_ulong isFixedPitch; + tt_ulong minMemType42; + tt_ulong maxMemType42; + tt_ulong minMemType1; + tt_ulong maxMemType1; + tt_ushort numberOfGlyphs; +} tt_tab_post; + +typedef struct +{ + tt_ushort start; + tt_ushort end; + tt_ushort cclass; +} tt_record_classrange; + +typedef struct +{ + tt_ushort left; + tt_ushort right; + tt_short value; + tt_short dominant; +} tt_xkern_pair; + +typedef struct +{ + tt_xkern_pair *pairs; + int capacity; + int number; +} tt_xkern_pair_list; + +typedef struct +{ + /* -------------------- input members -------------------- */ + + pdc_core *pdc; + fnt_font *font; /* corresponding font struct */ + + const char *filename; /* font file name */ + const char *fontname; /* font API name */ + + pdc_bool verbose; /* put warnings */ + pdc_bool fortet; /* for TET */ + + pdc_bool check; /* check for fontname */ + pdc_bool incore; /* whole font in-core */ + pdc_bool savecff; /* save results of CFF analyzing */ + int monospace; /* monospace amount */ + + tt_byte *img; /* in-core TT font file image */ + tt_byte *end; /* first byte above image buf */ + tt_byte *pos; /* current "file" position */ + pdc_file *fp; + + + /* ----------------- results from parsing ------------------- */ + + int n_tables; + tt_ulong offset; + tt_dirent * dir; + + /* table structs: */ + tt_tab_cmap *tab_cmap; + tt_tab_head *tab_head; + tt_tab_hhea *tab_hhea; + tt_tab_hmtx *tab_hmtx; + tt_tab_maxp *tab_maxp; + tt_tab_name *tab_name; + tt_tab_post *tab_post; + tt_tab_OS_2 *tab_OS_2; + tt_tab_CFF_ *tab_CFF_; + + + int numGlyphs; /* number of glyphs */ + int onlyCFF; /* only CFF_ table */ + int hasGlyphNames; /* CFF: has glyph names */ + int numunicode; /* number of Unicode values incl. 0 */ + int builtinenc; /* builtin encoding */ + pdc_bool regisadobe; /* registry is Adobe */ + int charcoll; /* character collection */ + int supplement; /* supplement number */ + + pdc_bool issymbol; /* symbol font */ + pdc_bool haswinuni; /* has a "Microsoft standard character + * to glyph index mapping table" + * cmap (3, 1) format 4 or + * cmap (3,10) format 12 or + * cmap (0, 3) format 4 (mac old case) */ + pdc_bool hasonlymac; /* has only macroman cmap (0,1) */ + + char *utf16fontname; /* UTF-16-BE font name for TTC fonts */ + int fnamelen; /* font name length */ + + +} tt_file; + +/* TrueType table names, defined as octal codes */ +#define fnt_str_ttcf "\164\164\143\146" +#define fnt_str_bhed "\142\150\145\144" +#define fnt_str_CFF_ "\103\106\106\040" +#define fnt_str_cvt_ "\143\166\164\040" +#define fnt_str_cmap "\143\155\141\160" +#define fnt_str_fpgm "\146\160\147\155" +#define fnt_str_glyf "\147\154\171\146" +#define fnt_str_GPOS "\107\120\117\123" +#define fnt_str_GSUB "\107\123\125\102" +#define fnt_str_head "\150\145\141\144" +#define fnt_str_hhea "\150\150\145\141" +#define fnt_str_hmtx "\150\155\164\170" +#define fnt_str_kern "\153\145\162\156" +#define fnt_str_loca "\154\157\143\141" +#define fnt_str_maxp "\155\141\170\160" +#define fnt_str_name "\156\141\155\145" +#define fnt_str_OS_2 "\117\123\057\062" /* OS/2 */ +#define fnt_str_post "\160\157\163\164" +#define fnt_str_prep "\160\162\145\160" + +#define fnt_str_vert "\166\145\162\164" + +/* Composite font flags. */ +/* See Reference of OpenType: glyf - Glyf Data */ +#define ARGS_ARE_WORDS 0x001 +#define ARGS_ARE_XY_VALUES 0x002 +#define ROUND_XY_TO_GRID 0x004 +#define WE_HAVE_A_SCALE 0x008 +/* reserved 0x010 */ +#define MORE_COMPONENTS 0x020 +#define WE_HAVE_AN_XY_SCALE 0x040 +#define WE_HAVE_A_2X2 0x080 +#define WE_HAVE_INSTR 0x100 +#define USE_MY_METRICS 0x200 + + +/* Functions */ + +#define FNT_TT2PDF(v) (int) PDC_ROUND(v * 1000.0 / ttf->tab_head->unitsPerEm) + +#define TT_ASSERT(ttf, cond) \ + ((cond) ? (void) 0 : tt_assert(ttf)) + +#define TT_IOCHECK(ttf, cond) \ + ((cond) ? (void) 0 : tt_error(ttf)) + +int tt_tag2idx(tt_file *ttf, char *tag); +void *tt_get_tab(tt_file *ttf, char *tag, size_t nbytes, pdc_bool tterror, + tt_ulong *offset); +void tt_get_tab_maxp(tt_file *ttf); +void tt_get_tab_head(tt_file *ttf); +void tt_get_tab_cmap(tt_file *ttf); +pdc_bool tt_get_tab_CFF_(tt_file *ttf); +void tt_get_tab_OS_2(tt_file *ttf); + +void tt_assert(tt_file *ttf); +void tt_error(tt_file *ttf); +void tt_seek(tt_file *ttf, long offset); +void tt_read(tt_file *ttf, void *buf, unsigned int nbytes); +long tt_tell(tt_file *ttf); +tt_ushort tt_get_ushort(tt_file *ttf); +tt_short tt_get_short(tt_file *ttf); +tt_ulong tt_get_ulong3(tt_file *ttf); +tt_ulong tt_get_ulong(tt_file *ttf); +tt_long tt_get_long(tt_file *ttf); +tt_ulong tt_get_offset(tt_file *ttf, tt_byte offsize); +pdc_bool tt_get_tab_name(tt_file *ttf); + +int tt_unicode2gidx(tt_file *ttf, int usv, pdc_bool logg); +int tt_gidx2width(tt_file *ttf, int gidx); + + +tt_file *fnt_new_tt(pdc_core *pdc, fnt_font *font); +void fnt_delete_tt(tt_file *ttf); +void fnt_set_tt_fontvalues(tt_file *ttf); +int fnt_set_tt_fontarrays(tt_file *ttf, int flags); +pdc_encoding fnt_get_tt_encoding_key(tt_file *ttf, pdc_encoding inenc); +pdc_bool fnt_read_tt(tt_file *ttf); +pdc_bool fnt_read_offset_tab(tt_file *ttf); +pdc_bool fnt_test_tt_font(pdc_core *pdc, tt_byte *img, tt_ulong *n_fonts, + pdc_bool requested); +pdc_bool fnt_is_opentype_font(tt_file *ttf); +pdc_bool fnt_check_tt_font(pdc_core *pdc, const char *filename, + const char *fontname, fnt_font *font, pdc_bool requested); + + +#endif /* FT_TRUETYPE_H */ diff --git a/src/pdflib/font/ft_type1.c b/src/pdflib/font/ft_type1.c new file mode 100644 index 0000000..2644284 --- /dev/null +++ b/src/pdflib/font/ft_type1.c @@ -0,0 +1,39 @@ +/*---------------------------------------------------------------------------* + | PDFlib - A library for generating PDF on the fly | + +---------------------------------------------------------------------------+ + | Copyright (c) 1997-2006 Thomas Merz and PDFlib GmbH. All rights reserved. | + +---------------------------------------------------------------------------+ + | | + | This software is subject to the PDFlib license. It is NOT in the | + | public domain. Extended versions and commercial licenses are | + | available, please check http://www.pdflib.com. | + | | + *---------------------------------------------------------------------------*/ + +/* $Id: ft_type1.c,v 1.1 2008/10/17 06:10:43 scuri Exp $ + * + * FONT Type1 font handling routines + * + */ + +#include "ft_font.h" + +pdc_bool +fnt_test_type1_font(pdc_core *pdc, const pdc_byte *img) +{ + char startsequ[5]; + + strcpy(startsequ, FNT_PFA_STARTSEQU); + + /* ASCII block sign and begin of text at byte 7 */ + if (img[0] == 0x80 && img[1] == 0x01 && + strncmp((const char *)&img[6], startsequ, 4) == 0) + { + pdc_logg_cond(pdc, 1, trc_font, + "\tPostScript Type1 font detected\n"); + return pdc_true; + } + return pdc_false; +} + + -- cgit v1.2.3