mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 16:57:35 +00:00
LibGfx: Add ability to request glyphs at subpixel offsets to fonts
This adds the option to pass a subpixel offset when fetching a glyph from a font, this offset is currently snapped to thirds of a pixel (i.e. 0, 0.33, 0.66). This is then used when rasterizing the glyph, which is then cached like usual. Note that when using subpixel offsets you're trading a bit of space for accuracy. With the current third of a pixel offsets you can end up with up to 9 bitmaps per glyph.
This commit is contained in:
parent
a1726b1ba5
commit
ada48a1daf
14 changed files with 121 additions and 21 deletions
|
@ -52,6 +52,10 @@ public:
|
|||
void set_slope(u8 slope) { m_slope = slope; }
|
||||
|
||||
Glyph glyph(u32 code_point) const override;
|
||||
Glyph glyph(u32 code_point, GlyphSubpixelOffset) const override { return glyph(code_point); }
|
||||
|
||||
float glyph_left_bearing(u32) const override { return 0; }
|
||||
|
||||
Glyph raw_glyph(u32 code_point) const;
|
||||
bool contains_glyph(u32 code_point) const override;
|
||||
bool contains_raw_glyph(u32 code_point) const { return m_glyph_widths[code_point] > 0; }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue