int grub_font_get_constructed_device_width (grub_font_t hinted_font, const struct grub_unicode_glyph *glyph_id) { int ret; struct grub_font_glyph *main_glyph; main_glyph = grub_font_construct_dry_run (hinted_font, glyph_id, NULL, NULL, &ret); if (!main_glyph) return unknown_glyph->device_width; return ret; }
struct grub_font_glyph * grub_font_construct_glyph (grub_font_t hinted_font, const struct grub_unicode_glyph *glyph_id) { struct grub_font_glyph *main_glyph; struct grub_video_signed_rect bounds; struct grub_font_glyph *glyph; struct grub_font_glyph **combining_glyphs; main_glyph = grub_font_construct_dry_run (hinted_font, glyph_id, &bounds, &combining_glyphs, NULL); if (!main_glyph) return grub_font_dup_glyph (unknown_glyph); if (!combining_glyphs) return grub_font_dup_glyph (main_glyph); glyph = grub_zalloc (sizeof (*glyph) + (bounds.width * bounds.height + 7) / 8); if (!glyph) { grub_errno = GRUB_ERR_NONE; return grub_font_dup_glyph (main_glyph); } glyph->font = main_glyph->font; glyph->width = bounds.width; glyph->height = bounds.height; glyph->offset_x = bounds.x; glyph->offset_y = bounds.y; if (glyph_id->attributes & GRUB_UNICODE_GLYPH_ATTRIBUTE_MIRROR) grub_font_blit_glyph_mirror (glyph, main_glyph, main_glyph->offset_x - glyph->offset_x, (glyph->height + glyph->offset_y) - (main_glyph->height + main_glyph->offset_y)); else grub_font_blit_glyph (glyph, main_glyph, main_glyph->offset_x - glyph->offset_x, (glyph->height + glyph->offset_y) - (main_glyph->height + main_glyph->offset_y)); blit_comb (glyph_id, glyph, NULL, main_glyph, combining_glyphs, NULL); return glyph; }
int grub_font_get_constructed_device_width (grub_font_t hinted_font, const struct grub_unicode_glyph *glyph_id) { int ret; struct grub_font_glyph *main_glyph; ensure_comb_space (glyph_id); main_glyph = grub_font_construct_dry_run (hinted_font, glyph_id, NULL, render_combining_glyphs, &ret); if (!main_glyph) return unknown_glyph->device_width; return ret; }
struct grub_font_glyph * grub_font_construct_glyph (grub_font_t hinted_font, const struct grub_unicode_glyph *glyph_id) { struct grub_font_glyph *main_glyph; struct grub_video_signed_rect bounds; static struct grub_font_glyph *glyph = 0; static grub_size_t max_glyph_size = 0; ensure_comb_space (glyph_id); main_glyph = grub_font_construct_dry_run (hinted_font, glyph_id, &bounds, render_combining_glyphs, NULL); if (!main_glyph) return unknown_glyph; if (!render_combining_glyphs && glyph_id->ncomb) return main_glyph; if (!glyph_id->ncomb && !glyph_id->attributes) return main_glyph; if (max_glyph_size < sizeof (*glyph) + (bounds.width * bounds.height + GRUB_CHAR_BIT - 1) / GRUB_CHAR_BIT) { grub_free (glyph); max_glyph_size = (sizeof (*glyph) + (bounds.width * bounds.height + GRUB_CHAR_BIT - 1) / GRUB_CHAR_BIT) * 2; if (max_glyph_size < 8) max_glyph_size = 8; glyph = grub_malloc (max_glyph_size); } if (!glyph) { grub_errno = GRUB_ERR_NONE; return main_glyph; } grub_memset (glyph, 0, sizeof (*glyph) + (bounds.width * bounds.height + GRUB_CHAR_BIT - 1) / GRUB_CHAR_BIT); glyph->font = main_glyph->font; glyph->width = bounds.width; glyph->height = bounds.height; glyph->offset_x = bounds.x; glyph->offset_y = bounds.y; if (glyph_id->attributes & GRUB_UNICODE_GLYPH_ATTRIBUTE_MIRROR) grub_font_blit_glyph_mirror (glyph, main_glyph, main_glyph->offset_x - glyph->offset_x, (glyph->height + glyph->offset_y) - (main_glyph->height + main_glyph->offset_y)); else grub_font_blit_glyph (glyph, main_glyph, main_glyph->offset_x - glyph->offset_x, (glyph->height + glyph->offset_y) - (main_glyph->height + main_glyph->offset_y)); blit_comb (glyph_id, glyph, NULL, main_glyph, render_combining_glyphs, NULL); return glyph; }