Переглянути джерело

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

undefined
Sam Hocevar 10 роки тому
джерело
коміт
a6c681d392
1 змінених файлів з 2 додано та 2 видалено
  1. +2
    -2
      src/text.cpp

+ 2
- 2
src/text.cpp Переглянути файл

@@ -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;


Завантаження…
Відмінити
Зберегти