From 68c2fea47978360ba79f8ed940e9751e3fec815c Mon Sep 17 00:00:00 2001 From: "PSp..om" Date: Fri, 21 Oct 2011 08:44:25 +0000 Subject: [PATCH] The last change neglected the first character which has special treatment for its x0 setting but still requires that the xAdvance be adjusted to account for accumulated xOffset. git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@8473 75d07b2b-3a1a-0410-a2c5-0572b91ccdca --- engine/src/core/com/jme3/font/LetterQuad.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/engine/src/core/com/jme3/font/LetterQuad.java b/engine/src/core/com/jme3/font/LetterQuad.java index bf4b082bb..ba2b5fe81 100644 --- a/engine/src/core/com/jme3/font/LetterQuad.java +++ b/engine/src/core/com/jme3/font/LetterQuad.java @@ -291,6 +291,18 @@ class LetterQuad { if (previous.isHead() || previous.eol) { x0 = bound.x; + + // The first letter quad will be drawn right at the first + // position... but it does not offset by the characters offset + // amount. This means that we've potentially accumulated extra + // pixels and the next letter won't get drawn far enough unless + // we add this offset back into xAdvance.. by subtracting it. + // This is the same thing that's done below because we've + // technically baked the offset in just like below. It doesn't + // look like it at first glance so I'm keeping it separate with + // this comment. + xAdvance -= xOffset * incrScale; + } else { x0 = previous.getNextX() + xOffset * incrScale;