Glyphs are not cached but rather loaded from disk each time a character is rendered, leading to poor performance.
|
for (; (c = g_utf8_get_char(text)) != '\0'; text = g_utf8_next_char(text)) { |
|
index = FT_Get_Char_Index(options->font->face, c); |
|
ret = FT_Load_Glyph(options->font->face, index, FT_LOAD_DEFAULT); |
|
if (ret) { |
|
continue; |
|
} |
|
// ret = FT_Render_Glyph(slot, FT_RENDER_MODE_NORMAL); |
|
// if (ret) { |
|
// continue; |
|
// } |
|
if (slot->format != FT_GLYPH_FORMAT_BITMAP) { |
|
continue; |
|
} |
|
if (slot->bitmap.pixel_mode != FT_PIXEL_MODE_MONO) { |
|
continue; |
|
} |
|
mem.plane0 = slot->bitmap.buffer; |
|
grx_context_new_full(GRX_FRAME_MODE_RAM_1BPP, slot->bitmap.pitch * 8, |
|
slot->bitmap.rows, &mem, &ctx); |
|
grx_bit_blt_1bpp(x + slot->bitmap_left - x_offset, |
|
y - slot->bitmap_top + y_offset, &ctx, 0, 0, |
|
slot->bitmap.width, slot->bitmap.rows, |
|
options->fg_color, options->bg_color); |
|
x += slot->advance.x >> 6; |
|
y += slot->advance.y >> 6; |
|
} |
|
} |
https://freetype.org/freetype2/docs/reference/ft2-cache_subsystem.html
Glyphs are not cached but rather loaded from disk each time a character is rendered, leading to poor performance.
grx/src/text/drawtext.c
Lines 91 to 117 in 09177aa
https://freetype.org/freetype2/docs/reference/ft2-cache_subsystem.html