From a1b9fa8b510823029b59f94be7683a3e15e98c2c Mon Sep 17 00:00:00 2001 From: handa Date: Sat, 18 Oct 2003 02:55:34 +0000 Subject: [PATCH] *** empty log message *** --- example/Makefile.am | 8 ++--- example/otfimage.c | 91 --------------------------------------------------- 2 files changed, 4 insertions(+), 95 deletions(-) delete mode 100644 example/otfimage.c diff --git a/example/Makefile.am b/example/Makefile.am index 2a47702..2dfe880 100644 --- a/example/Makefile.am +++ b/example/Makefile.am @@ -1,4 +1,4 @@ -bin_PROGRAMS = otfdump otfdraw otfview otflist otfimage +bin_PROGRAMS = otfdump otfdraw otfview otflist otftobdf INCLUDES = `freetype-config --cflags` CommonLDADD = ${top_builddir}/src/libotf.la @@ -20,6 +20,6 @@ otfview_SOURCE = otfview.c otfview_LDADD = ${CommonLDADD} otfview_LDFLAGS = `freetype-config --libs` ${X_LIBS} ${X_PRE_LIBS} -lX11 -lXt -lXaw -lXmu -ldl -static -otfimage_SOURCE = otfimage.c -otfimage_LDADD = ${CommonLDADD} -otfimage_LDFLAGS = `freetype-config --libs` -static +otftobdf_SOURCE = otftobdf.c +otftobdf_LDADD = ${CommonLDADD} +otftobdf_LDFLAGS = `freetype-config --libs` -static diff --git a/example/otfimage.c b/example/otfimage.c deleted file mode 100644 index ca36cf5..0000000 --- a/example/otfimage.c +++ /dev/null @@ -1,91 +0,0 @@ -#include - -#include -#include FT_FREETYPE_H - -#define DEFAULT_PIXEL_SIZE 16 - -FT_Face face; - -int -dump_image (int pixel_size, int index, int code, int full) -{ - int err = FT_Load_Glyph (face, index, FT_LOAD_RENDER | FT_LOAD_MONOCHROME); - int i,j, size; - unsigned char *buf; - - if (err) - return -1; - size = face->glyph->bitmap.rows * face->glyph->bitmap.width; - if (! size) - return -1; - buf = (unsigned char *) face->glyph->bitmap.buffer; - printf ("(#x%04X \"P4 %d %d ", - code, face->glyph->bitmap.width, face->glyph->bitmap.rows); - for (i = 0; i < face->glyph->bitmap.rows; i++) - for (j = 0; j < (face->glyph->bitmap.width + 7) / 8; j++) - { - printf("\\%o", buf[i * face->glyph->bitmap.pitch + j]); - } - printf ("\")\n"); - return 0; -} - -/* Format MSG by FMT and print the result to the stderr, and exit. */ - -#define FATAL_ERROR(fmt, arg) \ - do { \ - fprintf (stderr, fmt, arg); \ - exit (1); \ - } while (0) - -int -main (int argc, char **argv) -{ - FT_Library library; - int err; - int i; - int pixel_size = DEFAULT_PIXEL_SIZE; - FT_UInt unicode_table[0x80]; - int max_glyph_id; - - if (argc != 2) - FATAL_ERROR ("%s\n", "Usage: otfimage [ X-OPTION ... ] OTF-FILE"); - - if ((err = FT_Init_FreeType (&library))) - FATAL_ERROR ("%s\n", "FT_Init_FreeType: error"); - err = FT_New_Face (library, argv[1], 0, &face); - if (err == FT_Err_Unknown_File_Format) - FATAL_ERROR ("%s\n", "FT_New_Face: unknown file format"); - else if (err) - FATAL_ERROR ("%s\n", "FT_New_Face: unknown error"); - if ((err = FT_Set_Pixel_Sizes (face, 0, pixel_size))) - FATAL_ERROR ("%s\n", "FT_Set_Pixel_Sizes: error"); - - { - char *str = getenv ("PIXEL_SIZE"); - - if (str && (i = atoi (str)) > 0) - pixel_size = i; - } - - for (i = 0, max_glyph_id = 0; i < 0x10000; i++) - if (! FT_Load_Glyph (face, i, FT_LOAD_RENDER | FT_LOAD_MONOCHROME)) - max_glyph_id = i; - - for (i = 0x0D00; i < 0x0D80; i++) - { - unicode_table[i - 0x0D00] = FT_Get_Char_Index (face, (FT_ULong) i); - if (unicode_table[i - 0x0D00]) - printf ("%04X->%04X\n", i, unicode_table[i - 0x0D00]); - } - - for (i = 0; i < 0x80; i++) - if (unicode_table[i]) - dump_image (pixel_size, unicode_table[i], 0x0D00 + i, 1); - for (i = 0; i < 0x10000; i++) - dump_image (pixel_size, i, 0x0E00 + i, 0); - - - exit (0); -} -- 1.7.10.4