mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 08:17:35 +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
|
@ -28,6 +28,8 @@ public:
|
|||
virtual Gfx::ScaledGlyphMetrics glyph_metrics(u32 glyph_id, float x_scale, float y_scale, float point_width, float point_height) const override { return m_input_font->glyph_metrics(glyph_id, x_scale, y_scale, point_width, point_height); }
|
||||
virtual float glyphs_horizontal_kerning(u32 left_glyph_id, u32 right_glyph_id, float x_scale) const override { return m_input_font->glyphs_horizontal_kerning(left_glyph_id, right_glyph_id, x_scale); }
|
||||
virtual RefPtr<Gfx::Bitmap> rasterize_glyph(u32 glyph_id, float x_scale, float y_scale, Gfx::GlyphSubpixelOffset subpixel_offset) const override { return m_input_font->rasterize_glyph(glyph_id, x_scale, y_scale, subpixel_offset); }
|
||||
virtual bool append_glyph_path_to(Gfx::Path& path, u32 glyph_id, float x_scale, float y_scale) const override { return m_input_font->append_glyph_path_to(path, glyph_id, x_scale, y_scale); }
|
||||
|
||||
virtual u32 glyph_count() const override { return m_input_font->glyph_count(); }
|
||||
virtual u16 units_per_em() const override { return m_input_font->units_per_em(); }
|
||||
virtual u32 glyph_id_for_code_point(u32 code_point) const override { return m_input_font->glyph_id_for_code_point(code_point); }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue