Sfoglia il codice sorgente

text: fix alignment when rendering text with inter-character spacing.

undefined
Sam Hocevar 9 anni fa
parent
commit
a6c681d392
1 ha cambiato i file con 2 aggiunte e 2 eliminazioni
  1. +2
    -2
      src/text.cpp

+ 2
- 2
src/text.cpp Vedi File

@@ -102,8 +102,8 @@ void Text::TickDraw(float seconds, Scene &scene)
{
Font *font = Forge::GetFont(data->m_font);
vec3 delta(0.0f);
float text_width = (length - 0.5f) * font->GetSize().x
+ (length - 1) * data->m_spacing;
float text_width = ((length - 0.5f) + (length - 1) * data->m_spacing)
* font->GetSize().x;

if (data->m_align == TextAlign::Right)
delta.x -= text_width * data->m_scale.x;


Caricamento…
Annulla
Salva