From f4d789d67c67af153a4039f3ab49b82a6c836aab Mon Sep 17 00:00:00 2001 From: handa Date: Mon, 2 Feb 2004 13:09:19 +0000 Subject: [PATCH] *** empty log message *** --- example/otfview.c | 46 ++++++++++++++++++++++++++-------------------- 1 file changed, 26 insertions(+), 20 deletions(-) diff --git a/example/otfview.c b/example/otfview.c index ae5f2d8..cc6d272 100644 --- a/example/otfview.c +++ b/example/otfview.c @@ -290,22 +290,30 @@ DumpProc (Widget w, XtPointer client_data, XtPointer pixel_size) g_x = - (face->bbox.xMin * size / face->units_per_EM); g_y = face->bbox.yMax * size / face->units_per_EM; - for (i = 0; i < 0x10000; i++) - if (FT_Load_Glyph (face, i, FT_LOAD_RENDER | FT_LOAD_MONOCHROME) == 0) - { - if (g_x < - face->glyph->bitmap_left) - g_x = - face->glyph->bitmap_left; - if (g_y < face->glyph->bitmap_top) - g_y = face->glyph->bitmap_top; - if (g_width - < g_x + face->glyph->bitmap_left + face->glyph->bitmap.width) - g_width - = g_x + face->glyph->bitmap_left + face->glyph->bitmap.width; - if (g_height - < g_y - face->glyph->bitmap_top + face->glyph->bitmap.rows) - g_height - = g_y - face->glyph->bitmap_top + face->glyph->bitmap.rows; - } + for (i = 0; i < 0xFF; i++) + { + int idx; + + if (charmap_index >= 0) + idx = FT_Get_Char_Index (face, (FT_ULong) i); + else + idx = i; + if (FT_Load_Glyph (face, idx, FT_LOAD_RENDER | FT_LOAD_MONOCHROME) == 0) + { + if (g_x < - face->glyph->bitmap_left) + g_x = - face->glyph->bitmap_left; + if (g_y < face->glyph->bitmap_top) + g_y = face->glyph->bitmap_top; + if (g_width + < g_x + face->glyph->bitmap_left + face->glyph->bitmap.width) + g_width + = g_x + face->glyph->bitmap_left + face->glyph->bitmap.width; + if (g_height + < g_y - face->glyph->bitmap_top + face->glyph->bitmap.rows) + g_height + = g_y - face->glyph->bitmap_top + face->glyph->bitmap.rows; + } + } pix_width = (g_width + 1) * 16 + margin + 1; pix_height = (g_height + FONT_HEIGHT + 1) * 16 + margin + 1; pixmap = XCreatePixmap (display, @@ -364,7 +372,7 @@ DumpProc (Widget w, XtPointer client_data, XtPointer pixel_size) FILE *fp; sprintf (name, "%s.pbm", filename); -#if 1 + printf ("Writing %s ...", name); fp = fopen (name, "w"); fprintf (fp, "P4\n%d %d\n", image->width, image->height); bytes_per_line = (image->width + 7) / 8; @@ -372,9 +380,7 @@ DumpProc (Widget w, XtPointer client_data, XtPointer pixel_size) for (y = 0; y < image->height; y++, data += image->bytes_per_line) fwrite (data, 1, bytes_per_line, fp); fclose (fp); -#else - XWriteBitmapFile (display, name, pixmap, pix_width, pix_height, 0, 0); -#endif + printf ("done\n"); } FT_Set_Pixel_Sizes (face, 0, (int) pixel_size); } -- 1.7.10.4