mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 05:27:46 +00:00
LibGfx: Allow extracting paths from fonts and add Gfx::Path::text()
This updates fonts so rather than rastering directly to a bitmap, you can extract paths for glyphs. This is then used to implement a Gfx::Path::text("some text", font) API, that if given a vector font appends the path of the text to your Gfx::Path. This then allows arbitrary manipulation of the text (rotation, skewing, etc), paving the way for Word Art in Serenity.
This commit is contained in:
parent
b4cabde4a4
commit
50d33f79fa
14 changed files with 186 additions and 88 deletions
|
@ -83,6 +83,11 @@ RefPtr<Gfx::Bitmap> ScaledFont::rasterize_glyph(u32 glyph_id, GlyphSubpixelOffse
|
|||
return glyph_bitmap;
|
||||
}
|
||||
|
||||
bool ScaledFont::append_glyph_path_to(Gfx::Path& path, u32 glyph_id) const
|
||||
{
|
||||
return m_font->append_glyph_path_to(path, glyph_id, m_x_scale, m_y_scale);
|
||||
}
|
||||
|
||||
Gfx::Glyph ScaledFont::glyph(u32 code_point) const
|
||||
{
|
||||
return glyph(code_point, GlyphSubpixelOffset { 0, 0 });
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue