diff options
author | Han-Wen Nienhuys <hanwen@xs4all.nl> | 2007-04-29 03:07:43 -0400 |
---|---|---|
committer | Han-Wen Nienhuys <hanwen@xs4all.nl> | 2007-04-29 03:07:43 -0400 |
commit | c527e165cfd5e37afc5cbf52da8836e74fb2ead2 (patch) | |
tree | 1621a4f675d4289a678a7ed9bba2bc474b7600ae | |
parent | 7691f442f8bd9a879ae09bcf234a78c2dec22353 (diff) |
new t42 body write try.
-rw-r--r-- | lily/ttf.cc | 48 |
1 files changed, 47 insertions, 1 deletions
diff --git a/lily/ttf.cc b/lily/ttf.cc index 869cdbaed1..b2ffbe340d 100644 --- a/lily/ttf.cc +++ b/lily/ttf.cc @@ -144,6 +144,52 @@ print_body (void *out, string name) fclose (fd); } +#if 0 +static +void t42_write_sting (void *out, unsigned char const * buffer, size_t s) +{ + lily_cookie_fprintf (out, "\n<"); + int l = 0; + static char xdigits[] = "0123456789ABCDEF"; + for (size_t j = 0; j < s; j++) + { + if (j != 0 && j % 36 == 0) + lily_cookie_putc ('\n', out); + + if (l ++ >= CHUNKSIZE) + lily_cookie_fprintf (out, "00>\n<"); + + /* lily_cookie_fprintf (out,"%02X",(int)buffer[j]) is too slow */ + lily_cookie_putc (xdigits[ (buffer[j] & 0xF0) >> 4], out); + lily_cookie_putc (xdigits[buffer[j] & 0x0F], out); + } + lily_cookie_fprintf (out, "00>"); /* Adobe bug? */ +} + + +static void +new_print_body (void *out, FT_Face face) +{ + FT_UInt idx = 0; + + FT_ULong tag, length; + + lily_cookie_fprintf (out, "/sfnts ["); + while (FT_Sfnt_Table_Info(face, idx, &tag, &length)!= + FT_Err_Table_Missing) + { + unsigned char *buf = new unsigned char[length]; + FT_Error error = FT_Load_Sfnt_Table(face, tag, 0, buf, NULL); + + t42_write_sting (out, buf, length); + + delete[] buf; + idx ++; + } + lily_cookie_fprintf (out, "\n] def\n"); +} +#endif + static void print_trailer (void *out, FT_Face face) @@ -212,7 +258,7 @@ create_type42_font (void *out, string name) FT_Face face = open_ft_face (name); print_header (out, face); - print_body (out, name); + print_body (out, face); print_trailer (out, face); FT_Done_Face (face); |