diff options
| author | Ben Harris <bjh21@bjh21.me.uk> | 2006-05-13 13:56:05 +0000 |
|---|---|---|
| committer | Ben Harris <bjh21@bjh21.me.uk> | 2006-05-13 13:56:05 +0000 |
| commit | c072eb7debe80aca352a5dc26bff08a6ecd8baff (patch) | |
| tree | 18c4cff9d3257803ec49535179ead154ffd3a4c6 /psdata.c | |
| parent | 1d9065a073a8f8ac707a6fa2e7683755f1b82df0 (diff) | |
| download | halibut-c072eb7debe80aca352a5dc26bff08a6ecd8baff.zip halibut-c072eb7debe80aca352a5dc26bff08a6ecd8baff.tar.gz halibut-c072eb7debe80aca352a5dc26bff08a6ecd8baff.tar.bz2 halibut-c072eb7debe80aca352a5dc26bff08a6ecd8baff.tar.xz | |
Initial support for adding fonts at run-time. Currently we only support
loading AFM files, we recognise them by name, and we can't embed fonts in
the output (which is also invalid, though accepted by xpdf, in the PDF case).
Oh, and there's no documentation. Still, it's a start.
[originally from svn r6681]
Diffstat (limited to 'psdata.c')
| -rw-r--r-- | psdata.c | 30 |
1 files changed, 30 insertions, 0 deletions
@@ -3,6 +3,7 @@ * formats. */ +#include <assert.h> #include "halibut.h" #include "paper.h" @@ -4086,6 +4087,35 @@ 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->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; |