Don't use std::isspace in kerned font implementation
This commit is contained in:
parent
8be3544295
commit
831dd7b688
1 changed files with 2 additions and 9 deletions
|
|
@ -44,7 +44,7 @@ namespace psemek::fonts
|
||||||
|
|
||||||
bool kerned_font::supports_character(char32_t c) const
|
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
|
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))
|
if (!supports_character(c))
|
||||||
c = unknown;
|
c = unknown;
|
||||||
|
|
||||||
char32_t cc = c;
|
auto const & data = data_.glyphs.at(c);
|
||||||
if (std::isspace(c))
|
|
||||||
cc = ' ';
|
|
||||||
|
|
||||||
auto const & data = data_.glyphs.at(cc);
|
|
||||||
|
|
||||||
glyph g;
|
glyph g;
|
||||||
g.character = c;
|
g.character = c;
|
||||||
|
|
@ -94,9 +90,6 @@ namespace psemek::fonts
|
||||||
|
|
||||||
std::optional<geom::box<float, 2>> kerned_font::texcoords(char32_t c) const
|
std::optional<geom::box<float, 2>> kerned_font::texcoords(char32_t c) const
|
||||||
{
|
{
|
||||||
if (std::isspace(c))
|
|
||||||
c = ' ';
|
|
||||||
|
|
||||||
auto it = data_.glyphs.find(c);
|
auto it = data_.glyphs.find(c);
|
||||||
if (it == data_.glyphs.end())
|
if (it == data_.glyphs.end())
|
||||||
return std::nullopt;
|
return std::nullopt;
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue