From: <doc...@us...> - 2007-07-26 00:59:50
|
Revision: 124 http://openpcl.svn.sourceforge.net/openpcl/?rev=124&view=rev Author: documentsystems Date: 2007-07-25 17:59:47 -0700 (Wed, 25 Jul 2007) Log Message: ----------- Howard Hoagland. Fixed the bumping the chars to the left a little more to center the characters in their char cell box to look better on the screen. Also, changed the bump the "f" char 1/2 of the calculated space because it was being moved too far to the left and touching the "e" or "o" char to it's left. Modified Paths: -------------- openpcl/src/com/openpcl/pclrenderimage/render/PriDrawText.java Modified: openpcl/src/com/openpcl/pclrenderimage/render/PriDrawText.java =================================================================== --- openpcl/src/com/openpcl/pclrenderimage/render/PriDrawText.java 2007-07-26 00:04:12 UTC (rev 123) +++ openpcl/src/com/openpcl/pclrenderimage/render/PriDrawText.java 2007-07-26 00:59:47 UTC (rev 124) @@ -274,21 +274,20 @@ } } else { // Move char to the left because the char is in the char cell box to far to the right and you can see it - // needs to be moved to the left. Use Math.floor on the move chars to the left to "only a little bit" move - // chars to the left. For move left, dont use Math.ceil (aggressively moves), and Math.round is - // between those two. + // needs to be moved to the left. Use Math.round on the move chars to the left to "only a little bit" move + // chars to the left. For move left, dont use Math.ceil (aggressively moves), and Math.floor moves not enough. // Reason is: the internal printer font char widths are wider than the screen char widths, but there are // some chars that need to move left instead of move right. For example, the "r" char is flushed right // in the char cell box and needs to move only a small bit to the left, not a lot. offsetXforCenterAllCharsInCharCellBox = - -1 * ((int) Math.floor(((spaceOnLeft + spaceOnRight) / 2.0d) - spaceOnRight)); + -1 * ((int) Math.round(((spaceOnLeft + spaceOnRight) / 2.0d) - spaceOnRight)); // For non bold chars (leave bold chars alone) switch (afterSubstitutionsCharToDraw) { case 'f': // Bump to the left the specified chars 1/2 of calculated left/right difference due to // TextLayout.getBounds() has the these chars out of the bounding box to the right. - if (offsetXforCenterAllCharsInCharCellBox > 1) { offsetXforCenterAllCharsInCharCellBox /= 2; } + if (offsetXforCenterAllCharsInCharCellBox < 1) { offsetXforCenterAllCharsInCharCellBox /= 2; } break; default: break; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |