From: handa Date: Fri, 27 Jan 2006 07:24:14 +0000 (+0000) Subject: *** empty log message *** X-Git-Tag: REL-0-9-5~33 X-Git-Url: http://git.chise.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f44ce256892409fcca405a4a43564f392b840807;p=m17n%2Flibotf.git *** empty log message *** --- 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");