1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 06:47:35 +00:00

Revert "Unicode: s/codepoint/code_point/g"

This reverts commit ea9ac3155d.
It replaced "codepoint" with "code_points", not "code_point".
This commit is contained in:
Nico Weber 2020-08-05 16:28:19 -04:00 committed by Andreas Kling
parent 9664bac281
commit 19ac1f6368
45 changed files with 449 additions and 449 deletions

View file

@ -255,20 +255,20 @@ bool Font::write_to_file(const StringView& path)
return true;
}
GlyphBitmap Font::glyph_bitmap(u32 code_points) const
GlyphBitmap Font::glyph_bitmap(u32 codepoint) const
{
return GlyphBitmap(&m_rows[code_points * m_glyph_height], { glyph_width(code_points), m_glyph_height });
return GlyphBitmap(&m_rows[codepoint * m_glyph_height], { glyph_width(codepoint), m_glyph_height });
}
int Font::glyph_or_emoji_width(u32 code_points) const
int Font::glyph_or_emoji_width(u32 codepoint) const
{
if (code_points < m_glyph_count)
return glyph_width(code_points);
if (codepoint < m_glyph_count)
return glyph_width(codepoint);
if (m_fixed_width)
return m_glyph_width;
auto* emoji = Emoji::emoji_for_code_points(code_points);
auto* emoji = Emoji::emoji_for_codepoint(codepoint);
if (emoji == nullptr)
return glyph_width('?');
return emoji->size().width();
@ -285,11 +285,11 @@ int Font::width(const Utf8View& utf8) const
bool first = true;
int width = 0;
for (u32 code_points : utf8) {
for (u32 codepoint : utf8) {
if (!first)
width += glyph_spacing();
first = false;
width += glyph_or_emoji_width(code_points);
width += glyph_or_emoji_width(codepoint);
}
return width;
@ -301,7 +301,7 @@ int Font::width(const Utf32View& view) const
return 0;
int width = (view.length() - 1) * glyph_spacing();
for (size_t i = 0; i < view.length(); ++i)
width += glyph_or_emoji_width(view.code_pointss()[i]);
width += glyph_or_emoji_width(view.codepoints()[i]);
return width;
}