Don't use std::isspace in kerned font implementation

This commit is contained in:
Nikita Lisitsa 2023-10-02 23:26:04 +03:00
parent 8be3544295
commit 831dd7b688

View file

@ -44,7 +44,7 @@ namespace psemek::fonts
bool kerned_font::supports_character(char32_t c) const
{
return std::isspace(c) || data_.glyphs.contains(c);
return data_.glyphs.contains(c);
}
std::vector<glyph> kerned_font::shape(std::string_view str, shape_options const & options, geom::point<float, 2> & pen) const
@ -70,11 +70,7 @@ namespace psemek::fonts
if (!supports_character(c))
c = unknown;
char32_t cc = c;
if (std::isspace(c))
cc = ' ';
auto const & data = data_.glyphs.at(cc);
auto const & data = data_.glyphs.at(c);
glyph g;
g.character = c;
@ -94,9 +90,6 @@ namespace psemek::fonts
std::optional<geom::box<float, 2>> kerned_font::texcoords(char32_t c) const
{
if (std::isspace(c))
c = ' ';
auto it = data_.glyphs.find(c);
if (it == data_.glyphs.end())
return std::nullopt;