|
From: <doc...@us...> - 2007-07-26 01:27:14
|
Revision: 125
http://openpcl.svn.sourceforge.net/openpcl/?rev=125&view=rev
Author: documentsystems
Date: 2007-07-25 18:27:15 -0700 (Wed, 25 Jul 2007)
Log Message:
-----------
Howard Hoagland. Changed the move chars to the right to move less agressively to center the chars in each character cell box by changing Math.ceil to Math.round.
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:59:47 UTC (rev 124)
+++ openpcl/src/com/openpcl/pclrenderimage/render/PriDrawText.java 2007-07-26 01:27:15 UTC (rev 125)
@@ -256,12 +256,11 @@
// b. Use Math.floor for move char to the left
if (spaceOnLeft < spaceOnRight) {
// Move char to the right because the char is in the char cell box to far to the left and you can see it
- // needs to be moved to the right. Use Math.ceil on the move chars to the right to agressively move
- // chars to the right. For move right, dont use Math.floor (moves only a little bit), and Math.round is
- // between those two.
+ // needs to be moved to the right. Use Math.round on the move chars to the right dont use Math.floor
+ // (moves only a little bit), and Math.ceil moves too much.
// Reason is: the internal printer font char widths are wider than the screen char widths.
offsetXforCenterAllCharsInCharCellBox =
- (int) Math.ceil(((spaceOnLeft + spaceOnRight) / 2.0d) - spaceOnLeft);
+ (int) Math.round(((spaceOnLeft + spaceOnRight) / 2.0d) - spaceOnLeft);
switch (afterSubstitutionsCharToDraw) {
case 'j':
@@ -274,13 +273,13 @@
}
} 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.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.
+ // 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 moves too much too.
// 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.round(((spaceOnLeft + spaceOnRight) / 2.0d) - spaceOnRight));
+ -1 * ((int) Math.floor(((spaceOnLeft + spaceOnRight) / 2.0d) - spaceOnRight));
// For non bold chars (leave bold chars alone)
switch (afterSubstitutionsCharToDraw) {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|