mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-02-17 01:11:45 +00:00
[ui] Set text view height to font height
Text_StringView sets the view bounds to the bounds of the glyphs in the view. This has its advantages, but is not suitable for automatic UI sizing. However, the view is positioned correctly, so nothing needs to be done there. Now full height glyphs (eg, C) look balanced in the view, and glyphs with descenders (g) brush the bottom of the view.
This commit is contained in:
parent
ed5ef3a5fb
commit
85fd3c34cc
1 changed files with 6 additions and 0 deletions
|
@ -279,6 +279,12 @@ add_text (view_t view, imui_state_t *state, imui_ctx_t *ctx)
|
|||
|
||||
auto text = Text_StringView (ctx->tsys, view, ctx->font,
|
||||
state->label, state->label_len, 0, 0);
|
||||
|
||||
int ascender = ctx->font->face->size->metrics.ascender / 64;
|
||||
int descender = ctx->font->face->size->metrics.descender / 64;
|
||||
auto len = View_GetLen (text);
|
||||
View_SetLen (text, len.x, ascender - descender);
|
||||
|
||||
View_SetVisible (text, 1);
|
||||
Ent_SetComponent (text.id, c_glyphs, reg,
|
||||
Ent_GetComponent (text.id, c_passage_glyphs, reg));
|
||||
|
|
Loading…
Reference in a new issue