From: <doc...@us...> - 2007-09-07 23:32:47
|
Revision: 165 http://openpcl.svn.sourceforge.net/openpcl/?rev=165&view=rev Author: documentsystems Date: 2007-09-07 16:32:50 -0700 (Fri, 07 Sep 2007) Log Message: ----------- Howard Hoagland. Added 3 lines of code to fix bug 1790142 "Does not render", submitted By: David Hill of www.davesplanet.net, where if the horizontal cpi pitch is 0 in the PCL command "ESC ( s 0 h" in an input PCL file, that would cause the PCL parsing to stop. Modified Paths: -------------- openpcl/src/com/openpcl/pclrenderimage/render/PriFonts.java Modified: openpcl/src/com/openpcl/pclrenderimage/render/PriFonts.java =================================================================== --- openpcl/src/com/openpcl/pclrenderimage/render/PriFonts.java 2007-08-29 02:34:00 UTC (rev 164) +++ openpcl/src/com/openpcl/pclrenderimage/render/PriFonts.java 2007-09-07 23:32:50 UTC (rev 165) @@ -420,7 +420,13 @@ * @param pNumCharactersPerInch */ public void setFontHorizontalPitch(int pNumCharactersPerInch) { - mCurrentHorizontalPitch = pNumCharactersPerInch; + if (pNumCharactersPerInch == 0) { + // Avoid divide by zero stops the PCL parsing when the passed in chars per inch is 0 + mCurrentHorizontalPitch = 12; + } else { + mCurrentHorizontalPitch = pNumCharactersPerInch; + } + mCurrentHorizontalMotionIndexHMI = (120 / mCurrentHorizontalPitch); // PriDebug.infoln(PriDebug.spacesForPclParseMsgs + // "PriFonts set Horizontal Pitch (number of characters per inch) to " + mCurrentHorizontalPitch); 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:40:43
|
Revision: 219 http://openpcl.svn.sourceforge.net/openpcl/?rev=219&view=rev Author: documentsystems Date: 2008-03-31 13:39:54 -0700 (Mon, 31 Mar 2008) Log Message: ----------- Change horizontal positioning to be based on float values rather than int. Turn off default bolding of fixed-width text. Modified Paths: -------------- openpcl/src/com/openpcl/pclrenderimage/render/PriFonts.java Modified: openpcl/src/com/openpcl/pclrenderimage/render/PriFonts.java =================================================================== --- openpcl/src/com/openpcl/pclrenderimage/render/PriFonts.java 2008-03-31 20:38:11 UTC (rev 218) +++ openpcl/src/com/openpcl/pclrenderimage/render/PriFonts.java 2008-03-31 20:39:54 UTC (rev 219) @@ -32,10 +32,10 @@ protected ArrayList<int[]> mCharWidthArrayList = null; // For mono fonts, number of characters per inch = (s#H - protected int mCurrentHorizontalPitch = 10; + protected float mCurrentHorizontalPitch = 10; // For mono fonts not proportional fonts, (cpi = 120 / HMI). = &k#H - protected int mCurrentHorizontalMotionIndexHMI = 12; + protected float mCurrentHorizontalMotionIndexHMI = 12; protected int mCurrentFontStylePlanBoldItalic = Font.PLAIN; protected float mCurrentFontHeight = 12; @@ -170,7 +170,7 @@ public FontRenderContext getFontRenderContext() { return mFontRenderContext; } public int getCurrentFontStylePlanBoldItalic() { return mCurrentFontStylePlanBoldItalic; } public boolean getIsMonospacedFont() { return mCurrentJavaBuiltInFont == sFontIsMonospaced; } - public int getCurrentHorizontalPitch() { return mCurrentHorizontalPitch; } + public float getCurrentHorizontalPitch() { return mCurrentHorizontalPitch; } /** Get the adjusted pixel width of the character in the current font by using the internal printer font * character width tables. @@ -183,7 +183,7 @@ if (mCurrentJavaBuiltInFont == sFontIsMonospaced) { // To see how HMI works, see the comment block in setHorizontalMotionIndexHMI() - int charsPerInchUsingHMI = 120 / mCurrentHorizontalMotionIndexHMI; + float charsPerInchUsingHMI = 120 / mCurrentHorizontalMotionIndexHMI; // Mono font is selected. Use the current setting for "(dots per inch) / (chars per inch using HMI)" tNumWidthPixels = Math.round((float)PriPageSettings.sPrintDotsPerInch / (float)charsPerInchUsingHMI); } else { @@ -453,7 +453,7 @@ * * @param pHmiValue */ - public void setHorizontalMotionIndexHMI(int pHmiValue) { + public void setHorizontalMotionIndexHMI(float pHmiValue) { mCurrentHorizontalMotionIndexHMI = pHmiValue; mCurrentHorizontalPitch = (120 / mCurrentHorizontalMotionIndexHMI); // PriDebug.infoln(PriDebug.spacesForPclParseMsgs + @@ -532,7 +532,7 @@ switch (mCurrentJavaBuiltInFont) { case sFontIsMonospaced: - makeTextBeBold |= Font.BOLD; + // makeTextBeBold |= Font.BOLD; setMonospacedJavaBuiltInFont(makeTextBeBold, zoomFontHeight); break; case sFontIsSansSerif: This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |