Make kerned_font shape glyphs along the Y=0 baseline
This commit is contained in:
parent
a2922708e8
commit
7c20a91546
2 changed files with 3 additions and 4 deletions
|
|
@ -92,7 +92,7 @@ namespace psemek::ui
|
||||||
data.offset_y = charInfo["yoffset"].GetFloat();
|
data.offset_y = charInfo["yoffset"].GetFloat();
|
||||||
data.advance = charInfo["xadvance"].GetFloat();
|
data.advance = charInfo["xadvance"].GetFloat();
|
||||||
|
|
||||||
data.offset_y = - data.offset_y - data.size_y;
|
data.offset_y = - data.offset_y - data.size_y + result.size[1];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -64,7 +64,6 @@ namespace psemek::ui
|
||||||
|
|
||||||
std::vector<glyph> result;
|
std::vector<glyph> result;
|
||||||
|
|
||||||
float const offset_to_baseline = (data_.size[1] - data_.baseline) * options.scale;
|
|
||||||
for (char32_t c : str)
|
for (char32_t c : str)
|
||||||
{
|
{
|
||||||
if (!supports_character(c))
|
if (!supports_character(c))
|
||||||
|
|
@ -79,9 +78,9 @@ namespace psemek::ui
|
||||||
glyph g;
|
glyph g;
|
||||||
g.character = c;
|
g.character = c;
|
||||||
g.position[0].min = pen[0] + data.offset_x * options.scale;
|
g.position[0].min = pen[0] + data.offset_x * options.scale;
|
||||||
g.position[1].min = pen[1] + offset_to_baseline - (data.offset_y + data.size_y) * options.scale;
|
g.position[1].min = pen[1] - (data.offset_y + data.size_y) * options.scale;
|
||||||
g.position[0].max = pen[0] + (data.offset_x + data.size_x) * options.scale;
|
g.position[0].max = pen[0] + (data.offset_x + data.size_x) * options.scale;
|
||||||
g.position[1].max = pen[1] + offset_to_baseline - data.offset_y * options.scale;
|
g.position[1].max = pen[1] - data.offset_y * options.scale;
|
||||||
result.push_back(g);
|
result.push_back(g);
|
||||||
|
|
||||||
geom::vector<float, 2> advance{data.advance * options.scale, data_.size[1] * options.scale};
|
geom::vector<float, 2> advance{data.advance * options.scale, data_.size[1] * options.scale};
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue