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,
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;
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);
}