X-Git-Url: https://git.distorted.org.uk/~mdw/sgt/halibut/blobdiff_plain/0e60e7fec6be3a96f978d3723b9b671bf037f6a0..b5232689b6acadf75a2663aa386cc4685d1139a3:/psdata.c diff --git a/psdata.c b/psdata.c index f1d72cd..04046be 100644 --- a/psdata.c +++ b/psdata.c @@ -3,6 +3,7 @@ * formats. */ +#include #include "halibut.h" #include "paper.h" @@ -4086,6 +4087,48 @@ static const struct ps_std_font_data { }}, }; +/* + * Rough kludge to get ligatures in until this is all rewritten. All + * the standard fonts have the same ligatures anyway. + */ +static ligature const ps_std_ligs[] = { + {31,34,160}, {31,37,162}, {0xFFFF,0xFFFF,0xFFFF} +}; + +void init_std_fonts(void) { + int i, j; + ligature const *lig; + kern_pair const *kern; + static int done = FALSE; + + if (done) return; + for (i = 0; i < (int)lenof(ps_std_fonts); i++) { + font_info *fi = snew(font_info); + fi->fp = NULL; + fi->name = ps_std_fonts[i].name; + fi->nglyphs = lenof(ps_std_glyphs) - 1; + fi->glyphs = ps_std_glyphs; + fi->widths = ps_std_fonts[i].widths; + fi->kerns = newtree234(kern_cmp); + for (kern = ps_std_fonts[i].kerns; kern->left != 0xFFFF; kern++) + add234(fi->kerns, (void *)kern); + fi->ligs = newtree234(lig_cmp); + for (lig = ps_std_ligs; lig->left != 0xFFFF; lig++) + add234(fi->ligs, (void *)lig); + for (j = 0; j < (int)lenof(fi->bmp); j++) + fi->bmp[j] = 0xFFFF; + for (j = 0; j < fi->nglyphs; j++) { + wchar_t ucs; + ucs = ps_glyph_to_unicode(fi->glyphs[j]); + assert(ucs != 0xFFFF); + fi->bmp[ucs] = j; + } + fi->next = all_fonts; + all_fonts = fi; + } + done = TRUE; +} + const int *ps_std_font_widths(char const *fontname) { int i;