X-Git-Url: https://git.distorted.org.uk/~mdw/sgt/halibut/blobdiff_plain/9db47bc3abd7302dfb7bd4f01925697d88dfb3b9..f6220253b2e31a88862b8beae822ff11cc5576ab:/psdata.c diff --git a/psdata.c b/psdata.c index afa477b..8c3b9cd 100644 --- a/psdata.c +++ b/psdata.c @@ -3,6 +3,7 @@ * formats. */ +#include #include "halibut.h" #include "paper.h" @@ -12,7 +13,7 @@ * * Generated from the Adobe Glyph List at * - * http://partners.adobe.com/asn/tech/type/glyphlist.txt + * http://partners.adobe.com/public/developer/en/opentype/glyphlist.txt * * by a succession of Perl/sh fragments, quoted alongside each * array. @@ -1791,8 +1792,8 @@ const char *const ps_std_glyphs[] = { /* * Character width information from the standard PS fonts. * Units are UNITS_PER_PT defined in paper.h. - * Extracted from the (non-free) AFM files in - * + * Extracted from the AFM files in + * * by the following script: fonts="Times-Roman Times-Italic Times-Bold Times-BoldItalic \ @@ -1831,6 +1832,19 @@ while () { chomp; print "$m{$_}, " }; print "\n"' $i |\ done printf '};\n' + * The AFM files have the following copyright and licence: + * + * Copyright (c) 1985, 1987, 1989, 1990, 1991, 1992, 1993, 1997 + * Adobe Systems Incorporated. All Rights Reserved. + * + * This file and the 14 PostScript(R) AFM files it accompanies may be + * used, copied, and distributed for any purpose and without charge, + * with or without modification, provided that all copyright notices + * are retained; that the AFM files are not distributed without this + * file; that all modifications to this file or any of the AFM files + * are prominently noted in the modified file(s); and that this + * paragraph is not modified. Adobe Systems has no responsibility or + * obligation to support the use of the AFM files. */ static const kern_pair times_roman_kerns[] = { @@ -4073,6 +4087,36 @@ static const struct ps_std_font_data { }}, }; +void init_std_fonts(void) { + int i, j; + 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); + 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;