fix: en la migracio de la marquesina a la nova versio de Text s'havia posat per error un kerning superior al que havia

opt: millores en la getió de la marquesina per optimitzar rendiment
This commit is contained in:
2026-03-22 19:43:35 +01:00
parent 911ee7a13e
commit 495c23a3d2
4 changed files with 25 additions and 10 deletions

View File

@@ -274,6 +274,17 @@ auto Text::glyphWidth(uint32_t codepoint, int kerning) const -> int {
return 0;
}
// Devuelve el clip rect (región en el bitmap) de un glifo dado su codepoint
auto Text::getGlyphClip(uint32_t codepoint) const -> SDL_FRect {
auto it = offset_.find(codepoint);
if (it == offset_.end()) { it = offset_.find('?'); }
if (it == offset_.end()) { return {.x = 0.0F, .y = 0.0F, .w = 0.0F, .h = 0.0F}; }
return {.x = static_cast<float>(it->second.x),
.y = static_cast<float>(it->second.y),
.w = static_cast<float>(box_width_),
.h = static_cast<float>(box_height_)};
}
// Devuelve el tamaño de la caja de cada caracter
auto Text::getCharacterSize() const -> int {
return box_width_;