瀏覽代碼

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

undefined
Sam Hocevar 9 年之前
父節點
當前提交
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;


Loading…
取消
儲存