From f44ce256892409fcca405a4a43564f392b840807 Mon Sep 17 00:00:00 2001 From: handa Date: Fri, 27 Jan 2006 07:24:14 +0000 Subject: [PATCH] *** empty log message *** --- example/otfview.c | 56 +++++++++++++++++++++++++++++++++-------------------- 1 file changed, 35 insertions(+), 21 deletions(-) diff --git a/example/otfview.c b/example/otfview.c index 53ee52d..87b67c9 100644 --- a/example/otfview.c +++ b/example/otfview.c @@ -574,30 +574,44 @@ DumpProc (Widget w, XtPointer client_data, XtPointer call_data) idx = FT_Get_Char_Index (face, (FT_ULong) index); else idx = index; - if (FT_Load_Glyph (face, idx, FT_LOAD_RENDER | FT_LOAD_MONOCHROME) == 0 - && face->glyph->bitmap.rows > 0 - && face->glyph->bitmap.width > 0) + if (FT_Load_Glyph (face, idx, FT_LOAD_RENDER | FT_LOAD_MONOCHROME) == 0) { - unsigned char *p = face->glyph->bitmap.buffer; - int width = (face->glyph->bitmap.width - 1) / 8 + 1; - - fprintf (fp, "gsave %f %f translate %d %d scale 0 0 moveto\n", - xoff + (unit + margin * 2) * j + margin - g_x, - yoff + (unit + label_height + margin * 2) * (15 - i) + label_height + margin - g_y, - unit, unit); - fprintf (fp, "%d %d true [%f 0 0 %f %d %d]\n", - width * 8, face->glyph->bitmap.rows, - scale, -scale, face->glyph->bitmap_left, - face->glyph->bitmap_top); - fprintf (fp, "{< "); - for (k = 0; k < face->glyph->bitmap.rows; - k++, p += face->glyph->bitmap.pitch) + if (face->glyph->bitmap.rows > 0 + && face->glyph->bitmap.width > 0) { - for (l = 0; l < width; l++) - fprintf (fp, "%02X", p[l]); - fprintf (fp, "\n"); + unsigned char *p = face->glyph->bitmap.buffer; + int width = (face->glyph->bitmap.width - 1) / 8 + 1; + + fprintf (fp, "gsave %f %f translate %d %d scale 0 0 moveto\n", + xoff + (unit + margin * 2) * j + margin - g_x, + yoff + (unit + label_height + margin * 2) * (15 - i) + label_height + margin - g_y, + unit, unit); + fprintf (fp, "%d %d true [%f 0 0 %f %d %d]\n", + width * 8, face->glyph->bitmap.rows, + scale, -scale, face->glyph->bitmap_left, + face->glyph->bitmap_top); + fprintf (fp, "{< "); + for (k = 0; k < face->glyph->bitmap.rows; + k++, p += face->glyph->bitmap.pitch) + { + for (l = 0; l < width; l++) + fprintf (fp, "%02X", p[l]); + fprintf (fp, "\n"); + } + fprintf (fp, ">} imagemask grestore\n"); + } + else + { + int boxsize = unit + margin * 2; + + fprintf (fp, "gsave 0 setlinewidth %d %d translate\n", + xoff + boxsize * j, + yoff + (boxsize + label_height) * (15 - i) + label_height); + fprintf (fp, "0 0 moveto %d %d lineto stroke\n", + boxsize, boxsize); + fprintf (fp, "0 %d moveto %d 0 lineto stroke grestore\n", + boxsize, boxsize); } - fprintf (fp, ">} imagemask grestore\n"); } } fprintf (fp, "showpage\n"); -- 1.7.10.4