Tags: None
State: None
https://learnopengl.com/In-Practice/Text-Rendering
- Rasterization: rendering a glyph to pixels
- Shaping:
- how to layout a sequence of glyphs on multiple lines
- may not be straight-forward such as for latin languages
CoreText / CoreGraphics
Notes on Metal
Steps:
- Create CGContext
- Create MTLBuffer pointing to same memory
- Write to MTLBuffer with CGContext
- Create MTLTexture out of MTLBuffer
- FreeType / Harfbuzz
- FreeType for rasterization
- Harfbuzz for shaping
Create a font with Harfbuzz
#include <hb-ft.h>
FT_New_Face(ft_library, font_path, index, &face);
FT_Set_Char_Size(face, 0, 1000, 0, 0);
hb_font_t *font = hb_ft_font_create(face);