mirror of
https://github.com/RGBCube/serenity
synced 2025-07-28 07:17:34 +00:00
LibGfx: Make Font::glyph_width*() APIs return float
This commit is contained in:
parent
3407ab0fd1
commit
555d7a6fce
7 changed files with 14 additions and 14 deletions
|
@ -308,7 +308,7 @@ bool BitmapFont::contains_glyph(u32 code_point) const
|
|||
return index.has_value() && m_glyph_widths[index.value()] > 0;
|
||||
}
|
||||
|
||||
u8 BitmapFont::glyph_width(u32 code_point) const
|
||||
float BitmapFont::glyph_width(u32 code_point) const
|
||||
{
|
||||
if (is_ascii(code_point) && !is_ascii_printable(code_point))
|
||||
return 0;
|
||||
|
|
|
@ -56,7 +56,7 @@ public:
|
|||
bool contains_glyph(u32 code_point) const override;
|
||||
bool contains_raw_glyph(u32 code_point) const { return m_glyph_widths[code_point] > 0; }
|
||||
|
||||
ALWAYS_INLINE int glyph_or_emoji_width(u32 code_point) const override
|
||||
virtual float glyph_or_emoji_width(u32 code_point) const override
|
||||
{
|
||||
if (m_fixed_width)
|
||||
return m_glyph_width;
|
||||
|
@ -67,7 +67,7 @@ public:
|
|||
int x_height() const override { return m_x_height; }
|
||||
int preferred_line_height() const override { return glyph_height() + m_line_gap; }
|
||||
|
||||
u8 glyph_width(u32 code_point) const override;
|
||||
virtual float glyph_width(u32 code_point) const override;
|
||||
u8 raw_glyph_width(u32 code_point) const { return m_glyph_widths[code_point]; }
|
||||
|
||||
u8 min_glyph_width() const override { return m_min_glyph_width; }
|
||||
|
|
|
@ -126,8 +126,8 @@ public:
|
|||
virtual Glyph glyph(u32 code_point) const = 0;
|
||||
virtual bool contains_glyph(u32 code_point) const = 0;
|
||||
|
||||
virtual u8 glyph_width(u32 code_point) const = 0;
|
||||
virtual int glyph_or_emoji_width(u32 code_point) const = 0;
|
||||
virtual float glyph_width(u32 code_point) const = 0;
|
||||
virtual float glyph_or_emoji_width(u32 code_point) const = 0;
|
||||
virtual float glyphs_horizontal_kerning(u32 left_code_point, u32 right_code_point) const = 0;
|
||||
virtual u8 glyph_height() const = 0;
|
||||
virtual int x_height() const = 0;
|
||||
|
|
|
@ -57,14 +57,14 @@ Gfx::Glyph ScaledFont::glyph(u32 code_point) const
|
|||
return Gfx::Glyph(bitmap, metrics.left_side_bearing, metrics.advance_width, metrics.ascender);
|
||||
}
|
||||
|
||||
u8 ScaledFont::glyph_width(u32 code_point) const
|
||||
float ScaledFont::glyph_width(u32 code_point) const
|
||||
{
|
||||
auto id = glyph_id_for_code_point(code_point);
|
||||
auto metrics = glyph_metrics(id);
|
||||
return metrics.advance_width;
|
||||
}
|
||||
|
||||
int ScaledFont::glyph_or_emoji_width(u32 code_point) const
|
||||
float ScaledFont::glyph_or_emoji_width(u32 code_point) const
|
||||
{
|
||||
auto id = glyph_id_for_code_point(code_point);
|
||||
auto metrics = glyph_metrics(id);
|
||||
|
|
|
@ -43,8 +43,8 @@ public:
|
|||
virtual u16 weight() const override { return m_font->weight(); }
|
||||
virtual Gfx::Glyph glyph(u32 code_point) const override;
|
||||
virtual bool contains_glyph(u32 code_point) const override { return m_font->glyph_id_for_code_point(code_point) > 0; }
|
||||
virtual u8 glyph_width(u32 code_point) const override;
|
||||
virtual int glyph_or_emoji_width(u32 code_point) const override;
|
||||
virtual float glyph_width(u32 code_point) const override;
|
||||
virtual float glyph_or_emoji_width(u32 code_point) const override;
|
||||
virtual float glyphs_horizontal_kerning(u32 left_code_point, u32 right_code_point) const override;
|
||||
virtual int preferred_line_height() const override { return metrics().height() + metrics().line_gap; }
|
||||
virtual u8 glyph_height() const override { return m_point_height; }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue