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. |
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. |
From: <doc...@us...> - 2008-03-31 20:36:40
|
Revision: 217 http://openpcl.svn.sourceforge.net/openpcl/?rev=217&view=rev Author: documentsystems Date: 2008-03-31 13:35:46 -0700 (Mon, 31 Mar 2008) Log Message: ----------- Change printer font width (mNumWidthPixelsInternalPrinterFont) from int to float for more precision. 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 2008-03-31 20:24:56 UTC (rev 216) +++ openpcl/src/com/openpcl/pclrenderimage/render/PriDrawText.java 2008-03-31 20:35:46 UTC (rev 217) @@ -29,7 +29,7 @@ protected PclRenderImage mPclRenderImage = null; protected Graphics2D mGraphics2D =null; protected int mSelectedSoftFontId = 0; - protected int mNumWidthPixelsInternalPrinterFont = 0; + protected float mNumWidthPixelsInternalPrinterFont = 0; protected PriPclContext mPriPclContext = null; protected PriFontManager mPriFontManager = null; protected PriFontBase mPriFontBase = null; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |