fix: corregir padding asimétrico en HelpOverlay con getGlyphHeight()
Añade TextRenderer::getGlyphHeight() (ascent - descent, sin line_gap) y lo usa en calculateTextDimensions() para descontar el gap sobrante de la última línea, aproximando padding superior e inferior simétricos. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -361,3 +361,11 @@ int TextRenderer::getTextHeight() {
|
||||
|
||||
return TTF_GetFontHeight(font_);
|
||||
}
|
||||
|
||||
int TextRenderer::getGlyphHeight() {
|
||||
if (!isInitialized()) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return TTF_GetFontAscent(font_) - TTF_GetFontDescent(font_);
|
||||
}
|
||||
|
||||
@@ -42,9 +42,12 @@ public:
|
||||
// Útil para notificaciones y elementos UI de tamaño fijo
|
||||
int getTextWidthPhysical(const char* text);
|
||||
|
||||
// Obtiene la altura de la fuente
|
||||
// Obtiene la altura de la fuente (incluye line_gap)
|
||||
int getTextHeight();
|
||||
|
||||
// Obtiene la altura real del glifo (ascender + |descendente|, sin line_gap)
|
||||
int getGlyphHeight();
|
||||
|
||||
// Verifica si está inicializado correctamente
|
||||
bool isInitialized() const { return font_ != nullptr && renderer_ != nullptr; }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user