Revision: 3061 http://vexi.svn.sourceforge.net/vexi/?rev=3061&view=rev Author: clrg Date: 2008-08-10 01:57:39 +0000 (Sun, 10 Aug 2008)
Log Message: ----------- Fix first character clipping on shrunk text Modified Paths: -------------- trunk/core/org.vexi.core/src/org/vexi/graphics/Font.java Modified: trunk/core/org.vexi.core/src/org/vexi/graphics/Font.java =================================================================== --- trunk/core/org.vexi.core/src/org/vexi/graphics/Font.java 2008-08-10 00:36:13 UTC (rev 3060) +++ trunk/core/org.vexi.core/src/org/vexi/graphics/Font.java 2008-08-10 01:57:39 UTC (rev 3061) @@ -92,9 +92,15 @@ Glyph g = glyphs[c]; if (g == null) glyphs[c] = g = Platform.createGlyph(this, c); g.render(); - if (pb != null) pb.drawGlyph(g, x + width + g.bearingx, y + g.font.max_ascent - g.baseline, cx1, cy1, cx2, cy2, textcolor); + height = java.lang.Math.max(height, max_ascent + max_descent); + // avoid clipping first character + int ox = x + width; + if (i!=0) ox += g.bearingx; + // render glyph and move on + if (pb != null) pb.drawGlyph(g, ox, y + g.font.max_ascent - g.baseline, cx1, cy1, cx2, cy2, textcolor); width += g.advance; - height = java.lang.Math.max(height, max_ascent + max_descent); + // take into account clipping avoidance + if (i==0) width -= g.bearingx; } return ((((long)width) << 32) | (height & 0xffffffffL)); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ Vexi-svn mailing list Vexi-svn@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/vexi-svn