-bin_PROGRAMS = otfdump otfdraw otfview otflist otfimage
+bin_PROGRAMS = otfdump otfdraw otfview otflist otftobdf
INCLUDES = `freetype-config --cflags`
CommonLDADD = ${top_builddir}/src/libotf.la
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
+++ /dev/null
-#include <stdio.h>
-
-#include <ft2build.h>
-#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);
-}