[FOray-commit] SF.net SVN: foray: [7810] trunk/foray/foray-font
Modular XSL-FO Implementation for Java.
Status: Alpha
Brought to you by:
victormote
|
From: <vic...@us...> - 2006-07-22 21:40:20
|
Revision: 7810 Author: victormote Date: 2006-07-22 14:39:22 -0700 (Sat, 22 Jul 2006) ViewCVS: http://svn.sourceforge.net/foray/?rev=7810&view=rev Log Message: ----------- Implement standard use of "final" modifier on local variables and parameters. Modified Paths: -------------- trunk/foray/foray-font/.project trunk/foray/foray-font/src/java/org/foray/font/FOrayConsumerFont.java trunk/foray/foray-font/src/java/org/foray/font/FOrayFont.java trunk/foray/foray-font/src/java/org/foray/font/FOrayFontConsumer.java trunk/foray/foray-font/src/java/org/foray/font/FOrayFontServer.java trunk/foray/foray-font/src/java/org/foray/font/FOrayFontUse.java trunk/foray/foray-font/src/java/org/foray/font/FSTrueTypeFont.java trunk/foray/foray-font/src/java/org/foray/font/FSType1Font.java trunk/foray/foray-font/src/java/org/foray/font/FontConfig.java trunk/foray/foray-font/src/java/org/foray/font/FontConfigParser.java trunk/foray/foray-font/src/java/org/foray/font/FontSelector.java trunk/foray/foray-font/src/java/org/foray/font/FontSelectorCBC.java trunk/foray/foray-font/src/java/org/foray/font/FreeStandingFont.java trunk/foray/foray-font/src/java/org/foray/font/RegisteredFont.java trunk/foray/foray-font/src/java/org/foray/font/RegisteredFontDesc.java trunk/foray/foray-font/src/java/org/foray/font/RegisteredFontFamily.java trunk/foray/foray-font/src/java/org/foray/font/Subset.java trunk/foray/foray-font/src/java/org/foray/font/SystemFont.java trunk/foray/foray-font/src/java/org/foray/font/charset/CharSet.java trunk/foray/foray-font/src/java/org/foray/font/charset/CharSetParser.java trunk/foray/foray-font/src/java/org/foray/font/format/FontFile.java trunk/foray/foray-font/src/java/org/foray/font/format/FontFileReader.java trunk/foray/foray-font/src/java/org/foray/font/format/Kerning.java trunk/foray/foray-font/src/java/org/foray/font/format/MetricsFile.java trunk/foray/foray-font/src/java/org/foray/font/format/MetricsFileAFM.java trunk/foray/foray-font/src/java/org/foray/font/format/MetricsFilePFM.java trunk/foray/foray-font/src/java/org/foray/font/format/MetricsFileReader.java trunk/foray/foray-font/src/java/org/foray/font/format/TTCTableHeader.java trunk/foray/foray-font/src/java/org/foray/font/format/TTFFile.java trunk/foray/foray-font/src/java/org/foray/font/format/TTFFileCollection.java trunk/foray/foray-font/src/java/org/foray/font/format/TTFFileSingle.java trunk/foray/foray-font/src/java/org/foray/font/format/TTFFont.java trunk/foray/foray-font/src/java/org/foray/font/format/TTFReader.java trunk/foray/foray-font/src/java/org/foray/font/format/TTFSubSetFile.java trunk/foray/foray-font/src/java/org/foray/font/format/TTFTable.java trunk/foray/foray-font/src/java/org/foray/font/format/TTFTableCFF.java trunk/foray/foray-font/src/java/org/foray/font/format/TTFTableCMAP.java trunk/foray/foray-font/src/java/org/foray/font/format/TTFTableDirEntry.java trunk/foray/foray-font/src/java/org/foray/font/format/TTFTableDirectory.java trunk/foray/foray-font/src/java/org/foray/font/format/TTFTableGLYF.java trunk/foray/foray-font/src/java/org/foray/font/format/TTFTableHEAD.java trunk/foray/foray-font/src/java/org/foray/font/format/TTFTableHHEA.java trunk/foray/foray-font/src/java/org/foray/font/format/TTFTableHMTX.java trunk/foray/foray-font/src/java/org/foray/font/format/TTFTableKERN.java trunk/foray/foray-font/src/java/org/foray/font/format/TTFTableLOCA.java trunk/foray/foray-font/src/java/org/foray/font/format/TTFTableMAXP.java trunk/foray/foray-font/src/java/org/foray/font/format/TTFTableNAME.java trunk/foray/foray-font/src/java/org/foray/font/format/TTFTableOS2.java trunk/foray/foray-font/src/java/org/foray/font/format/TTFTablePCLT.java trunk/foray/foray-font/src/java/org/foray/font/format/TTFTablePOST.java trunk/foray/foray-font/src/java/org/foray/font/format/Type1File.java trunk/foray/foray-font/src/java/org/foray/font/format/Type1PFAFile.java trunk/foray/foray-font/src/java/org/foray/font/format/Type1PFBFile.java trunk/foray/foray-font/src/java/org/foray/font/output/FOrayFontOutput.java trunk/foray/foray-font/src/java/org/foray/font/output/FOrayFontOutputFactory.java trunk/foray/foray-font/src/java/org/foray/font/output/FOrayFontPDF.java trunk/foray/foray-font/src/java/org/foray/font/output/FOrayFontPDFFactory.java trunk/foray/foray-font/src/java/org/foray/font/output/FOrayFontPS.java trunk/foray/foray-font/src/java/org/foray/font/output/FOrayFontPSFactory.java Modified: trunk/foray/foray-font/.project =================================================================== --- trunk/foray/foray-font/.project 2006-07-22 19:56:23 UTC (rev 7809) +++ trunk/foray/foray-font/.project 2006-07-22 21:39:22 UTC (rev 7810) @@ -8,12 +8,12 @@ </projects> <buildSpec> <buildCommand> - <name>com.atlassw.tools.eclipse.checkstyle.CheckstyleBuilder</name> + <name>org.eclipse.jdt.core.javabuilder</name> <arguments> </arguments> </buildCommand> <buildCommand> - <name>org.eclipse.jdt.core.javabuilder</name> + <name>com.atlassw.tools.eclipse.checkstyle.CheckstyleBuilder</name> <arguments> </arguments> </buildCommand> Modified: trunk/foray/foray-font/src/java/org/foray/font/FOrayConsumerFont.java =================================================================== --- trunk/foray/foray-font/src/java/org/foray/font/FOrayConsumerFont.java 2006-07-22 19:56:23 UTC (rev 7809) +++ trunk/foray/foray-font/src/java/org/foray/font/FOrayConsumerFont.java 2006-07-22 21:39:22 UTC (rev 7810) @@ -60,7 +60,8 @@ /** List of all child FontUse instances. */ private ArrayList fontUses = new ArrayList(1); - public FOrayConsumerFont(FOrayFont font, FOrayFontConsumer consumer) { + public FOrayConsumerFont(final FOrayFont font, + final FOrayFontConsumer consumer) { this.font = font; this.consumer = consumer; if (this.font.isSubsettable()) { @@ -116,15 +117,17 @@ return this.fontUses; } - public FOrayFontUse selectFontUse(RegisteredFontDesc rfd, int codePoint) { + public FOrayFontUse selectFontUse(final RegisteredFontDesc rfd, + final int codePoint) { if (rfd == null) { return null; } FOrayFontUse fontUse = null; - SystemFont sf = getSystemFont(); + final SystemFont sf = getSystemFont(); /* Check existing FontUse instances. */ for (int i = 0; i < this.fontUses.size() && fontUse == null; i++) { - FOrayFontUse trialFontUse = (FOrayFontUse) this.fontUses.get(i); + final FOrayFontUse trialFontUse = + (FOrayFontUse) this.fontUses.get(i); if (trialFontUse.getRegisteredFontDesc() != rfd) { continue; } @@ -133,7 +136,8 @@ continue; } } else { - org.axsl.psR.Encoding encoding = trialFontUse.getEncoding(); + final org.axsl.psR.Encoding encoding = + trialFontUse.getEncoding(); if (! encoding.canEncode(codePoint)) { continue; } @@ -148,7 +152,7 @@ /* We don't care about encodings for SystemFonts. */ fontUse = new FOrayFontUse(this, rfd, null); } else { - Encoding encoding = findEncoding(rfd, codePoint); + final Encoding encoding = findEncoding(rfd, codePoint); if (encoding == null) { /* We can't encode this character. * Return null so that the upstream font selection routines can @@ -164,9 +168,10 @@ /** * Returns the described FontUse instance, creating it if necessary. */ - public FOrayFontUse getFontUse(RegisteredFontDesc rfd, Encoding encoding) { + public FOrayFontUse getFontUse(final RegisteredFontDesc rfd, + final Encoding encoding) { for (int i = 0; i < this.fontUses.size(); i++) { - FOrayFontUse fontUse = (FOrayFontUse) this.fontUses.get(i); + final FOrayFontUse fontUse = (FOrayFontUse) this.fontUses.get(i); if (fontUse.getRegisteredFontDesc() != rfd) { continue; } @@ -178,7 +183,8 @@ return new FOrayFontUse(this, rfd, encoding); } - public Encoding findEncoding(RegisteredFontDesc rfd, int codePoint) { + public Encoding findEncoding(final RegisteredFontDesc rfd, + final int codePoint) { switch (this.consumer.getEncodingLatitude()) { case FOrayFontConsumer.ENCODING_SPECIFIED_ONLY: { return rfd.getEncoding(); @@ -193,9 +199,9 @@ return null; } - private Encoding getBestEncoding(int codePoint) { + private Encoding getBestEncoding(final int codePoint) { Encoding trialEncoding = null; - Encoding internalEncoding = this.font.getInternalEncoding(); + final Encoding internalEncoding = this.font.getInternalEncoding(); if (! (internalEncoding instanceof EncodingVector)) { /* CMap encodings should be able to handle any character in the * font's character set. */ Modified: trunk/foray/foray-font/src/java/org/foray/font/FOrayFont.java =================================================================== --- trunk/foray/foray-font/src/java/org/foray/font/FOrayFont.java 2006-07-22 19:56:23 UTC (rev 7809) +++ trunk/foray/foray-font/src/java/org/foray/font/FOrayFont.java 2006-07-22 21:39:22 UTC (rev 7810) @@ -44,7 +44,7 @@ /** Valid values are Font.FONT_SIMPLE and Font.FONT_COMPOSITE */ protected byte fontComplexity = org.axsl.fontR.Font.FONT_COMPLEXITY_UNKNOWN; - protected FOrayFont(RegisteredFont rf) { + protected FOrayFont(final RegisteredFont rf) { this.registeredFont = rf; } @@ -68,11 +68,11 @@ */ public abstract int getXHeight(int fontSize); - private int getEmWidth(int fontSize) { + private int getEmWidth(final int fontSize) { return fontSize; } - private int getEnWidth(int fontSize) { + private int getEnWidth(final int fontSize) { return Math.round(fontSize / 2); } @@ -84,7 +84,7 @@ /** * {@inheritDoc} */ - public int widthEstimate(int c, int fontSize) { + public int widthEstimate(final int c, final int fontSize) { switch (c) { case 0x09: // horizontal tab case 0x0A: // linefeed @@ -127,15 +127,15 @@ /** * {@inheritDoc} */ - public int width(CharSequence word, int fontSize, int letterSpacing, - int wordSpacing) { + public int width(final CharSequence word, final int fontSize, + final int letterSpacing, final int wordSpacing) { if (word == null) { return 0; } int width = 0; for (int i = 0; i < word.length(); i++) { // Add the width of the character itself. - int charWidth = width(word.charAt(i), fontSize); + final int charWidth = width(word.charAt(i), fontSize); if (charWidth == Integer.MIN_VALUE) { width += widthUndefinedGlyph(fontSize); } else { @@ -285,7 +285,7 @@ /** * {@inheritDoc} */ - public float normalLineHeightFactor(int algorithm) { + public float normalLineHeightFactor(final int algorithm) { switch (algorithm) { case LH_ALGORITHM_DEFAULT: default: { @@ -297,8 +297,10 @@ /** * {@inheritDoc} */ - public int baselineOffset(int writingMode, int baselineType, int fontSize) { - int baseline = extractBaseline(writingMode, baselineType, fontSize); + public int baselineOffset(final int writingMode, final int baselineType, + final int fontSize) { + final int baseline = extractBaseline(writingMode, baselineType, + fontSize); if (baseline == Integer.MIN_VALUE) { return estimateBaseline(writingMode, baselineType, fontSize); } @@ -325,8 +327,8 @@ * @param fontSize Same as for {@link #baselineOffset(int, int, int)}. * @return The estimated value of the baseline. */ - public int estimateBaseline(int writingMode, int baselineType, - int fontSize) { + public int estimateBaseline(final int writingMode, final int baselineType, + final int fontSize) { switch (baselineType) { case Constants.BASELINE_ALPHABETIC: { return fontSize + this.getDescender(fontSize); @@ -367,7 +369,7 @@ } } - public int baseline(String script) { + public int baseline(final String script) { /* TODO: Fix this. */ return Constants.BASELINE_ALPHABETIC; } @@ -375,7 +377,7 @@ /** * {@inheritDoc} */ - public int underlineSize(int fontSize) { + public int underlineSize(final int fontSize) { /* TODO: Where possible, replace this heuristic with data from the * font itself. */ /* Until we learn better, make this the same size as the strikeout. */ @@ -385,7 +387,7 @@ /** * {@inheritDoc} */ - public int underlinePosition(int fontSize) { + public int underlinePosition(final int fontSize) { /* TODO: Where possible, replace this heuristic with data from the * font itself. */ return (fontSize / 10) * -1; @@ -394,7 +396,7 @@ /** * {@inheritDoc} */ - public int overlineSize(int fontSize) { + public int overlineSize(final int fontSize) { /* TODO: Where possible, replace this heuristic with data from the * font itself. */ /* Until we learn better, make this the same size as the strikeout. */ @@ -404,7 +406,7 @@ /** * {@inheritDoc} */ - public int overlinePosition(int fontSize) { + public int overlinePosition(final int fontSize) { /* TODO: Where possible, replace this heuristic with data from the * font itself. */ return getAscender(fontSize) + (fontSize / 10); @@ -413,7 +415,7 @@ /** * {@inheritDoc} */ - public int strikeoutSize(int fontSize) { + public int strikeoutSize(final int fontSize) { /* TODO: Where possible, replace this heuristic with data from the * font itself. */ /* This computation comes from the OpenType manual, Section OS/2 @@ -425,7 +427,7 @@ /** * {@inheritDoc} */ - public int strikeoutPosition(int fontSize) { + public int strikeoutPosition(final int fontSize) { /* TODO: Where possible, replace this heuristic with data from the * font itself. */ return getAscender(fontSize) * 3 / 8; Modified: trunk/foray/foray-font/src/java/org/foray/font/FOrayFontConsumer.java =================================================================== --- trunk/foray/foray-font/src/java/org/foray/font/FOrayFontConsumer.java 2006-07-22 19:56:23 UTC (rev 7809) +++ trunk/foray/foray-font/src/java/org/foray/font/FOrayFontConsumer.java 2006-07-22 21:39:22 UTC (rev 7810) @@ -111,14 +111,14 @@ * Constructor. * @param server The FOrayFontServer instance serving this FontConsumer. */ - public FOrayFontConsumer(FOrayFontServer server) { + public FOrayFontConsumer(final FOrayFontServer server) { this.server = server; this.usesFreeStandingFonts = true; this.usesSystemFonts = true; this.prefersFreeStandingFonts = true; } - public void setFontSources(int[] fontSources) { + public void setFontSources(final int[] fontSources) { if (fontSources == null || fontSources.length < 1) { return; @@ -145,7 +145,7 @@ * override the logger used by FOrayFontServer. * @param logger */ - public void setLogger(Log logger) { + public void setLogger(final Log logger) { this.logger = logger; } @@ -178,7 +178,7 @@ return this.server; } - private FontSelector getFontSelector(int strategy) { + private FontSelector getFontSelector(final int strategy) { switch (strategy) { case Font.FONT_SELECTION_CBC: { return this.getFontSelectorCBC(); @@ -195,7 +195,7 @@ return this.fontSelectorAutoType; } - public void setFontSelectorAutoType(String newFontSelectorAutoType) { + public void setFontSelectorAutoType(final String newFontSelectorAutoType) { if (this.fontSelectorAuto == null) { /* Fails silently if the "auto" FontSelector has already been * created. */ @@ -220,14 +220,14 @@ /** * {@inheritDoc} */ - public org.axsl.fontR.FontUse selectFontXSL(int selectionStrategy, - String [] familyList, int style, - int weight, int variant, int stretch, int size, int codePoint) - throws FontException { - FontSelector selector = getFontSelector(selectionStrategy); + public org.axsl.fontR.FontUse selectFontXSL(final int selectionStrategy, + final String [] familyList, final int style, final int weight, + final int variant, final int stretch, final int size, + final int codePoint) throws FontException { + final FontSelector selector = getFontSelector(selectionStrategy); FOrayFont fontSelected = null; - RegisteredFontDesc fontDescSelected = selector.selectFont(familyList, - style, weight, variant, stretch, size, codePoint); + final RegisteredFontDesc fontDescSelected = selector.selectFont( + familyList, style, weight, variant, stretch, size, codePoint); if (fontDescSelected != null) { fontSelected = whichUse(fontDescSelected, codePoint); @@ -235,7 +235,7 @@ if (fontSelected == null) { /* None of the requested font-family items can provide a suitable * font. */ - FOrayFontUse fontUse = getDefaultFontUse(); + final FOrayFontUse fontUse = getDefaultFontUse(); if (fontUse == null) { throw new FontException("Unable to provide even a default " + "font."); @@ -245,10 +245,10 @@ if (fontSelected == null) { return null; } - FOrayConsumerFont consumerFont = registerFontUse(fontSelected); + final FOrayConsumerFont consumerFont = registerFontUse(fontSelected); /* Selection of the actual FontUse is delegated to consumerFont. */ - FOrayFontUse fontUse = consumerFont.selectFontUse(fontDescSelected, - codePoint); + final FOrayFontUse fontUse = consumerFont.selectFontUse( + fontDescSelected, codePoint); return fontUse; } @@ -256,7 +256,7 @@ * Return a default font. We don't care what it can encode. */ protected FOrayFontUse getDefaultFontUse() { - RegisteredFontDesc fontDescSelected = selectDefaultFont(); + final RegisteredFontDesc fontDescSelected = selectDefaultFont(); if (fontDescSelected == null) { return null; } @@ -268,7 +268,7 @@ fontSelected = fontDescSelected.getRegisteredFont() .getSystemFont(); } - FOrayConsumerFont consumerFont = registerFontUse(fontSelected); + final FOrayConsumerFont consumerFont = registerFontUse(fontSelected); return consumerFont.getFontUse(fontDescSelected, fontSelected.getInternalEncoding()); } @@ -290,10 +290,11 @@ * font. * @return The FontUse instance dictated by the parameters of consumer. */ - protected FOrayFont whichUse(RegisteredFontDesc rfd, int codePoint) { - RegisteredFont rf = rfd.getRegisteredFont(); - FreeStandingFont fsf = eligibleFreeStandingFont(rfd, codePoint); - SystemFont sf = eligibleSystemFont(rf, codePoint); + protected FOrayFont whichUse(final RegisteredFontDesc rfd, + final int codePoint) { + final RegisteredFont rf = rfd.getRegisteredFont(); + final FreeStandingFont fsf = eligibleFreeStandingFont(rfd, codePoint); + final SystemFont sf = eligibleSystemFont(rf, codePoint); /* Consumer uses and prefers FreeStandingFont and it is available. */ if (fsf != null && preferFreeStandingFonts()) { @@ -313,17 +314,18 @@ return sf; } - private FreeStandingFont eligibleFreeStandingFont(RegisteredFontDesc rfd, - int codePoint) { + private FreeStandingFont eligibleFreeStandingFont( + final RegisteredFontDesc rfd, final int codePoint) { if (! isUsingFreeStandingFonts()) { return null; } - FreeStandingFont fsf = rfd.getRegisteredFont().getFreeStandingFont(); + final FreeStandingFont fsf = + rfd.getRegisteredFont().getFreeStandingFont(); if (fsf == null) { return null; } - FOrayConsumerFont consumerFont = this.getConsumerFont(fsf); - Encoding encoding = consumerFont.findEncoding(rfd, codePoint); + final FOrayConsumerFont consumerFont = this.getConsumerFont(fsf); + final Encoding encoding = consumerFont.findEncoding(rfd, codePoint); if (encoding == null) { /* Either no known encoding for this font can encode this character * or we have been restricted from using an encoding that can. @@ -333,11 +335,12 @@ return fsf; } - private SystemFont eligibleSystemFont(RegisteredFont rf, int codePoint) { + private SystemFont eligibleSystemFont(final RegisteredFont rf, + final int codePoint) { if (! isUsingSystemFonts()) { return null; } - SystemFont sf = rf.getSystemFont(); + final SystemFont sf = rf.getSystemFont(); if (sf == null) { return null; } @@ -364,8 +367,9 @@ /** * {@inheritDoc} */ - public org.axsl.fontR.FontUse selectFontCSS(String [] familyList, int style, - int weight, int variant, int stretch, int size, int codePoint) + public org.axsl.fontR.FontUse selectFontCSS(final String [] familyList, + final int style, final int weight, final int variant, + final int stretch, final int size, final int codePoint) throws FontException { return selectFontXSL(Font.FONT_SELECTION_CBC, familyList, style, weight, variant, stretch, size, codePoint); @@ -378,11 +382,12 @@ if (this.usedFonts.size() < 1) { return new FOrayFont[0]; } - FOrayFont[] usedFontsToReturn = new FOrayFont[this.usedFonts.size()]; + final FOrayFont[] usedFontsToReturn = + new FOrayFont[this.usedFonts.size()]; int index = 0; - Iterator iterator = usedFonts.keySet().iterator(); + final Iterator iterator = usedFonts.keySet().iterator(); while (iterator.hasNext()) { - FOrayFont realFont = (FOrayFont) iterator.next(); + final FOrayFont realFont = (FOrayFont) iterator.next(); usedFontsToReturn[index] = realFont; index++; } @@ -400,23 +405,23 @@ int count = 0; Iterator iterator = this.usedFonts.entrySet().iterator(); while (iterator.hasNext()) { - FOrayConsumerFont consumerFont = + final FOrayConsumerFont consumerFont = (FOrayConsumerFont) iterator.next(); count += consumerFont.getFontUses().size(); } if (count < 1) { return new FOrayFontUse[0]; } - FOrayFontUse[] toReturn = new FOrayFontUse[count]; + final FOrayFontUse[] toReturn = new FOrayFontUse[count]; count = 0; /* Get a new iterator. */ iterator = this.usedFonts.entrySet().iterator(); while (iterator.hasNext()) { - FOrayConsumerFont consumerFont = + final FOrayConsumerFont consumerFont = (FOrayConsumerFont) iterator.next(); - ArrayList fontUses = consumerFont.getFontUses(); + final ArrayList fontUses = consumerFont.getFontUses(); for (int i = 0; i < fontUses.size(); i++) { - FOrayFontUse fontUse = (FOrayFontUse) fontUses.get(i); + final FOrayFontUse fontUse = (FOrayFontUse) fontUses.get(i); toReturn[count] = fontUse; count ++; } @@ -428,7 +433,7 @@ * Record the fact that this FontConsumer has used this font. * @param font The Font instance that was used. */ - protected FOrayConsumerFont registerFontUse(FOrayFont font) { + protected FOrayConsumerFont registerFontUse(final FOrayFont font) { FOrayConsumerFont consumerFont = (FOrayConsumerFont) usedFonts.get(font); if (consumerFont == null) { @@ -442,10 +447,10 @@ * {@inheritDoc} */ public void optimizeFonts() { - Iterator iter = usedFonts.keySet().iterator(); + final Iterator iter = usedFonts.keySet().iterator(); while (iter.hasNext()) { - Object obj = iter.next(); - FOrayConsumerFont consumerFont = (FOrayConsumerFont) + final Object obj = iter.next(); + final FOrayConsumerFont consumerFont = (FOrayConsumerFont) usedFonts.get(obj); consumerFont.optimize(); } @@ -457,7 +462,7 @@ * related FontUse instance. * @return The related FontUse instance. */ - public FOrayConsumerFont getConsumerFont(FOrayFont font) { + public FOrayConsumerFont getConsumerFont(final FOrayFont font) { FOrayConsumerFont consumerFont = (FOrayConsumerFont) usedFonts.get(font); if (consumerFont != null) { @@ -477,7 +482,7 @@ return encodingLatitude; } - private boolean validEncodingLatitude(int encodingLatitude) { + private boolean validEncodingLatitude(final int encodingLatitude) { for (int i = 0; i < VALID_ENCODING_LATITUDES.length; i++) { if (encodingLatitude == VALID_ENCODING_LATITUDES[i]) { return true; @@ -493,7 +498,8 @@ * {@link #ENCODING_INTERNAL_ONLY}, {@link #ENCODING_SPECIFIED_ONLY}, or * {@link #ENCODING_ANY}. */ - public void setEncodingLatitude(int encodingLatitude) throws FontException { + public void setEncodingLatitude(final int encodingLatitude) + throws FontException { if (! validEncodingLatitude(encodingLatitude)) { throw new FontException("FOrayFontConsumer invalid encoding " + "latitude: " + encodingLatitude); Modified: trunk/foray/foray-font/src/java/org/foray/font/FOrayFontServer.java =================================================================== --- trunk/foray/foray-font/src/java/org/foray/font/FOrayFontServer.java 2006-07-22 19:56:23 UTC (rev 7809) +++ trunk/foray/foray-font/src/java/org/foray/font/FOrayFontServer.java 2006-07-22 21:39:22 UTC (rev 7810) @@ -135,11 +135,11 @@ * messages that are more client-related can be logged to the FontConsumer * logger. */ - public FOrayFontServer(Log logger) { + public FOrayFontServer(final Log logger) { this.logger = logger; try { registerStandardOutputFactories(); - } catch (FontException e) { + } catch (final FontException e) { getLogger().error("Error registering standard Font output " + "factories:\n" + e.getMessage()); e.printStackTrace(); @@ -151,7 +151,7 @@ } protected RegisteredFontFamily getRegisteredFontFamily( - String fontFamilyName) { + final String fontFamilyName) { RegisteredFontFamily rff = (RegisteredFontFamily) this.fontFamilies.get(fontFamilyName); if (rff != null) { @@ -183,19 +183,19 @@ } /* Punt and try to create something that will work. */ try { - RegisteredFont rf = new RegisteredFont(this, null, null, null, null, - null, "serif"); - RegisteredFontFamily rff = this.registerFontFamily2("serif"); + final RegisteredFont rf = new RegisteredFont(this, null, null, null, + null, null, "serif"); + final RegisteredFontFamily rff = this.registerFontFamily2("serif"); rff.registerFontDesc(rf, null, "normal", "normal", "normal", "normal", null, null, null, null); - } catch (FontException e) { + } catch (final FontException e) { getLogger().error("Unable to create default system font."); } this.defaultSystemFont = getDefaultFont(false); return this.defaultSystemFont; } - protected RegisteredFontDesc getDefaultFont(boolean freeStandingFont){ + protected RegisteredFontDesc getDefaultFont(final boolean freeStandingFont){ RegisteredFontDesc defaultFont = null; RegisteredFontFamily rff = getRegisteredFontFamily("any"); if (rff != null) { @@ -222,9 +222,9 @@ if (defaultFont != null) { return defaultFont; } - Iterator iterator = this.fontFamilies.entrySet().iterator(); + final Iterator iterator = this.fontFamilies.entrySet().iterator(); while (iterator.hasNext() && defaultFont == null) { - Map.Entry entry = (Map.Entry) iterator.next(); + final Map.Entry entry = (Map.Entry) iterator.next(); rff = (RegisteredFontFamily) entry.getValue(); defaultFont = rff.findRegisteredFontDesc( FOrayFont.FONT_STYLE_ANY, @@ -241,7 +241,7 @@ * Set the base URL for general resources, unless it has already been set. * @param url The base URL for general resources. */ - public void setBaseURL(URL url) { + public void setBaseURL(final URL url) { /* If not already set, set it */ if (baseURL == null) { baseURL = url; @@ -263,7 +263,7 @@ * Set the base URL for Font locations, unless it has already been set. * @param url The base URL for fonts. */ - public void setBaseFontURL(URL url) { + public void setBaseFontURL(final URL url) { /* If not already set, set it */ if (baseFontURL == null) { baseFontURL = url; @@ -297,7 +297,7 @@ * parsing. * @throws FontException on font configuration error. */ - public void setup(URL fontConfigFile, Map fontConfigOptions) + public void setup(final URL fontConfigFile, final Map fontConfigOptions) throws FontException { if (setupCompleted) { return; @@ -328,13 +328,15 @@ registerBase14Font("Base14-ZapfDingbats", "ZapfDingbats.afm"); } - private void registerBase14Font(String fontName, String fileName) { - String resourceName = "org/foray/font/resources/base-14/" + fileName; - ClassLoader loader = ClassLoader.getSystemClassLoader(); - URL metricURL = loader.getResource(resourceName); + private void registerBase14Font(final String fontName, + final String fileName) { + final String resourceName = "org/foray/font/resources/base-14/" + + fileName; + final ClassLoader loader = ClassLoader.getSystemClassLoader(); + final URL metricURL = loader.getResource(resourceName); try { registerFont(fontName, null, metricURL, null, "none", null); - } catch (FontException e) { + } catch (final FontException e) { this.logger.warn(e); } } @@ -343,18 +345,18 @@ if (! this.usingSystemFonts) { return; } - Font[] fontList = this.getSystemFontList(); + final Font[] fontList = this.getSystemFontList(); if (fontList == null) { return; } for (int i = 0; i < fontList.length; i++) { - Font awtFont = fontList[i]; + final Font awtFont = fontList[i]; RegisteredFontFamily rff = this.getRegisteredFontFamily( awtFont.getFamily()); if (rff == null) { try { rff = registerFontFamily2(awtFont.getFamily()); - } catch (FontException e) { + } catch (final FontException e) { /* This should never happen. We just made sure it doesn't * already exist. */ continue; @@ -364,7 +366,7 @@ try { rf = new RegisteredFont(this, awtFont.getFontName(), null, null, null, "none", awtFont.getFontName()); - } catch (FontException e) { + } catch (final FontException e) { this.logger.error(e.getMessage()); continue; } @@ -376,15 +378,15 @@ if (awtFont.isBold()) { fontWeight = org.axsl.fontR.Font.FONT_WEIGHT_BOLD; } - byte fontVariant = org.axsl.fontR.Font.FONT_VARIANT_NORMAL; - byte fontStretch = org.axsl.fontR.Font.FONT_STRETCH_NORMAL; + final byte fontVariant = org.axsl.fontR.Font.FONT_VARIANT_NORMAL; + final byte fontStretch = org.axsl.fontR.Font.FONT_STRETCH_NORMAL; new RegisteredFontDesc(rf, rff, null, fontStyle, fontWeight, fontVariant, fontStretch); try { rff.registerFontDesc(rf, null, fontStyle, fontWeight, fontVariant, fontStretch, Float.NaN, Float.NaN, Float.NaN, null); - } catch (FontException e) { + } catch (final FontException e) { this.logger.error(e.getMessage()); } } @@ -393,18 +395,18 @@ /** * Reads the font configuration file */ - private void readFontConfig(URL fontConfigURL) throws FontException { + private void readFontConfig(final URL fontConfigURL) throws FontException { if (fontConfigURL == null) { return; } InputStream inputStream; try { inputStream = fontConfigURL.openStream(); - } catch (IOException e) { + } catch (final IOException e) { throw new FontException(e.getMessage()); } - InputSource source = new InputSource(inputStream); - FontConfigParser parser = + final InputSource source = new InputSource(inputStream); + final FontConfigParser parser = new FontConfigParser(this, source); parser.start(); if (hasFatalConfigurationError) { @@ -414,11 +416,11 @@ protected Graphics2D getGraphics2D() { if (this.graphic == null) { - BufferedImage fontImage = + final BufferedImage fontImage = new BufferedImage(100, 100, BufferedImage.TYPE_INT_RGB); try { this.graphic = fontImage.createGraphics(); - } catch (InternalError e) { + } catch (final InternalError e) { return null; } this.graphic.setRenderingHint (RenderingHints.KEY_FRACTIONALMETRICS, @@ -441,9 +443,9 @@ + "Unable to get System fonts."); return; } - GraphicsEnvironment ge + final GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment(); - String[] list = ge.getAvailableFontFamilyNames(); + final String[] list = ge.getAvailableFontFamilyNames(); // Make sure they are sorted for fast searching Arrays.sort(list); this.systemFontFamilyList = list; @@ -453,7 +455,7 @@ * Add a RegisteredFontFamily to the Collection. * @param name the name of the font family (e.g. "Courier") */ - protected RegisteredFontFamily registerFontFamily2(String name) + protected RegisteredFontFamily registerFontFamily2(final String name) throws FontException { /* Make sure it is not already registered. */ RegisteredFontFamily rff = this.getRegisteredFontFamily(name); @@ -472,16 +474,17 @@ * @param realFamily The name of the real font family to which this alias * should be associated (e.g. "Helvetica"). */ - public void registerFontFamilyAlias(String alias, String realFamily) + public void registerFontFamilyAlias(final String alias, + final String realFamily) throws FontException { - RegisteredFontFamily rff + final RegisteredFontFamily rff = (RegisteredFontFamily)fontFamilies.get(realFamily); if (rff == null) { throw new FontException("Font family " + realFamily + " not found. Can't register alias: " + alias); } if (fontFamilyAliases.containsKey(alias)) { - RegisteredFontFamily family = + final RegisteredFontFamily family = ((RegisteredFontFamily)fontFamilyAliases.get(alias)); throw new FontException("Alias " + alias + " already registered to family " + family.getName()); @@ -508,7 +511,7 @@ * have. * @param using When true, FreeStanding fonts will be configured. */ - public void setUsingFreeStandingFonts(boolean using) { + public void setUsingFreeStandingFonts(final boolean using) { if (setupCompleted) { if (using != usingFreeStandingFonts) { getLogger().error("Font setup already completed. " + @@ -526,7 +529,7 @@ * SystemFonts, regardless of what settings that FontConsumer may have. * @param using When true, System fonts will be configured. */ - public void setUsingSystemFonts(boolean using) { + public void setUsingSystemFonts(final boolean using) { if (setupCompleted) { if (using != usingSystemFonts) { getLogger().error("Font setup already completed. " + @@ -537,7 +540,7 @@ usingSystemFonts = using; } - protected void setFatalConfigurationError(boolean hasError) { + protected void setFatalConfigurationError(final boolean hasError) { if (hasError) { hasFatalConfigurationError = true; } @@ -562,7 +565,7 @@ + "Unable to get System fonts."); return null; } - GraphicsEnvironment ge + final GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment(); return ge.getAllFonts(); } @@ -570,27 +573,27 @@ /** * {@inheritDoc} */ - public Encoding getEncoding(String name) { + public Encoding getEncoding(final String name) { return org.foray.ps.encode.EncodingVector.getPredefinedEncoding(name); } /** * {@inheritDoc} */ - public org.axsl.fontR.Font[] getAllFonts(boolean freeStandingFonts, - boolean systemFonts) { - ArrayList fontList = new ArrayList(); - Iterator iterator = this.fontFamilies.entrySet().iterator(); + public org.axsl.fontR.Font[] getAllFonts(final boolean freeStandingFonts, + final boolean systemFonts) { + final ArrayList fontList = new ArrayList(); + final Iterator iterator = this.fontFamilies.entrySet().iterator(); while (iterator.hasNext()) { - Map.Entry entry = (Map.Entry) iterator.next(); - RegisteredFontFamily family = (RegisteredFontFamily) + final Map.Entry entry = (Map.Entry) iterator.next(); + final RegisteredFontFamily family = (RegisteredFontFamily) entry.getValue(); - ArrayList rfdList = family.getFontDescriptions(); + final ArrayList rfdList = family.getFontDescriptions(); if (rfdList != null) { for (int i = 0; i < rfdList.size(); i++) { - RegisteredFontDesc rfd = (RegisteredFontDesc) + final RegisteredFontDesc rfd = (RegisteredFontDesc) rfdList.get(i); - RegisteredFont rf = rfd.getRegisteredFont(); + final RegisteredFont rf = rfd.getRegisteredFont(); if (freeStandingFonts && rf.getFreeStandingFont() != null) { fontList.add(rf.getFreeStandingFont()); @@ -605,11 +608,11 @@ if (fontList.size() < 1) { return null; } - ArrayList returnList = new ArrayList(); + final ArrayList returnList = new ArrayList(); for (int i = 0; i < fontList.size(); i++) { - org.axsl.fontR.FontUse fontUse = + final org.axsl.fontR.FontUse fontUse = (org.axsl.fontR.FontUse) fontList.get(i); - org.axsl.fontR.Font font = fontUse.getFont(); + final org.axsl.fontR.Font font = fontUse.getFont(); boolean duplicateFound = false; for (int j = 0; j < returnList.size() && ! duplicateFound; j++) { if (font == returnList.get(j)) { @@ -621,7 +624,7 @@ returnList.add(font); } } - FOrayFont[] returnArray = new FOrayFont[returnList.size()]; + final FOrayFont[] returnArray = new FOrayFont[returnList.size()]; for (int i = 0; i < returnArray.length; i++) { returnArray[i] = (FOrayFont) returnList.get(i); } @@ -637,20 +640,20 @@ /** * @param entityResolver The entityResolver to set. */ - public void setEntityResolver(EntityResolver entityResolver) { + public void setEntityResolver(final EntityResolver entityResolver) { this.entityResolver = entityResolver; } /** * {@inheritDoc} */ - public void registerFontOutputFactory(FontOutputFactory factory) + public void registerFontOutputFactory(final FontOutputFactory factory) throws FontException { /* */ if (factory == null) { throw new FontException("Cannot register a null FontOutputFactory"); } - String mimeType = factory.getMimeType(); + final String mimeType = factory.getMimeType(); if (mimeType == null || mimeType.equals("")) { throw new FontException("Mime type invalid: " + mimeType); @@ -658,38 +661,38 @@ this.fontOutputFactories.put(mimeType, factory); } - public FontOutputFactory getOutputFactory(String mimeType) { + public FontOutputFactory getOutputFactory(final String mimeType) { return (FontOutputFactory) this.fontOutputFactories.get(mimeType); } /** * {@inheritDoc} */ - public boolean fontOutputFactoryAvailable(String mimeType) { - FontOutputFactory factory = getOutputFactory(mimeType); + public boolean fontOutputFactoryAvailable(final String mimeType) { + final FontOutputFactory factory = getOutputFactory(mimeType); return factory != null; } /** * {@inheritDoc} */ - public void registerFontFamily(String name) throws FontException { + public void registerFontFamily(final String name) throws FontException { registerFontFamily2(name); } /** * {@inheritDoc} */ - public boolean isRegisteredFontFamily(String name) { - RegisteredFontFamily rff = this.getRegisteredFontFamily(name); + public boolean isRegisteredFontFamily(final String name) { + final RegisteredFontFamily rff = this.getRegisteredFontFamily(name); return (rff != null); } /** * {@inheritDoc} */ - public String getFontFamilyForAlias(String alias) { - RegisteredFontFamily family = + public String getFontFamilyForAlias(final String alias) { + final RegisteredFontFamily family = (RegisteredFontFamily)fontFamilyAliases.get(alias); if (family == null) { return null; @@ -700,9 +703,9 @@ /** * {@inheritDoc} */ - public void registerFont(String fontID, URL fontFileURL, - URL metricsFileURL, String collectionID, String embed, - String systemName) throws FontException { + public void registerFont(final String fontID, final URL fontFileURL, + final URL metricsFileURL, final String collectionID, + final String embed, final String systemName) throws FontException { if (! isUsableFont(systemName, fontFileURL, metricsFileURL)) { return; } @@ -710,7 +713,7 @@ if (fontFileURL != null) { try { fontFileReader = new FontFileReader(this.logger, fontFileURL); - } catch (IOException e) { + } catch (final IOException e) { throw new FontException(e); } } @@ -719,7 +722,7 @@ try { metricsFileReader = new MetricsFileReader(this.getLogger(), metricsFileURL); - } catch (IOException e) { + } catch (final IOException e) { throw new FontException(e); } } @@ -727,10 +730,11 @@ collectionID, embed, systemName); } - public void registerFont(String fontID, String fontFileDescription, - byte[] fontFileContents, String metricsFileDescription, - byte[] metricsFileContents, String collectionID, String embed, - String systemName) throws FontException { + public void registerFont(final String fontID, + final String fontFileDescription, final byte[] fontFileContents, + final String metricsFileDescription, + final byte[] metricsFileContents, final String collectionID, + final String embed, final String systemName) throws FontException { if (! isUsableFont(systemName, fontFileContents, metricsFileContents)) { return; } @@ -739,7 +743,7 @@ try { fontFileReader = new FontFileReader(this.logger, fontFileDescription, fontFileContents); - } catch (IOException e) { + } catch (final IOException e) { throw new FontException(e); } } @@ -748,7 +752,7 @@ try { metricsFileReader = new MetricsFileReader(this.getLogger(), metricsFileDescription, metricsFileContents); - } catch (IOException e) { + } catch (final IOException e) { throw new FontException(e); } } @@ -756,8 +760,8 @@ collectionID, embed, systemName); } - private boolean isUsableFont(String systemName, Object fontFile, - Object metricsFile) { + private boolean isUsableFont(final String systemName, final Object fontFile, + final Object metricsFile) { if (! usingFreeStandingFonts) { /* If not using FreeStandingFonts, then this font should not be * registered unless it will be able to generate a SystemFont. */ @@ -777,13 +781,13 @@ return true; } - public RegisteredFont getRegisteredFont(String name) { + public RegisteredFont getRegisteredFont(final String name) { return (RegisteredFont) this.registeredFonts.get(name); } - public void registerFont(String fontID, RegisteredFont rf) + public void registerFont(final String fontID, final RegisteredFont rf) throws FontException { - Object object = this.registeredFonts.get(fontID); + final Object object = this.registeredFonts.get(fontID); if (object != null) { throw new FontException("Font ID already registered: " + fontID); } @@ -793,29 +797,31 @@ /** * {@inheritDoc} */ - public boolean isRegisteredFont(String fontID) { - Object object = this.registeredFonts.get(fontID); + public boolean isRegisteredFont(final String fontID) { + final Object object = this.registeredFonts.get(fontID); return (object != null); } /** * {@inheritDoc} */ - public void registerFontDescription(String fontFamily, String fontID, - Encoding encoding, byte style, short weight, byte variant, - byte stretch, float simulatedSmallCaps, float simulatedOblique, - float simulatedBackslant, float[] simulatedStretch) + public void registerFontDescription(final String fontFamily, + final String fontID, final Encoding encoding, final byte style, + final short weight, final byte variant, final byte stretch, + final float simulatedSmallCaps, final float simulatedOblique, + final float simulatedBackslant, final float[] simulatedStretch) throws FontException { - RegisteredFontFamily rff = this.getRegisteredFontFamily(fontFamily); - RegisteredFont rf = this.getRegisteredFont(fontID); + final RegisteredFontFamily rff = this.getRegisteredFontFamily( + fontFamily); + final RegisteredFont rf = this.getRegisteredFont(fontID); rff.registerFontDesc(rf, encoding, style, weight, variant, stretch, simulatedSmallCaps, simulatedOblique, simulatedBackslant, simulatedStretch); } - public FontSelector makeFontSelector(FOrayFontConsumer consumer) { - String selectorName = consumer.getFontSelectorAutoType(); - FontSelectorFactory factory = (FontSelectorFactory) + public FontSelector makeFontSelector(final FOrayFontConsumer consumer) { + final String selectorName = consumer.getFontSelectorAutoType(); + final FontSelectorFactory factory = (FontSelectorFactory) this.registeredFontSelectorFactories.get(selectorName); if (factory != null) { return factory.makeFontSelector(consumer); @@ -835,8 +841,8 @@ * @throws FontException If either <code>name</code>, or * <code>factory</code> is invalid. */ - public void registerFontSelectorFactory(String name, - FontSelectorFactory factory) throws FontException { + public void registerFontSelectorFactory(final String name, + final FontSelectorFactory factory) throws FontException { if (name == null || factory == null) { throw new FontException("Unable to register null or unnamed " Modified: trunk/foray/foray-font/src/java/org/foray/font/FOrayFontUse.java =================================================================== --- trunk/foray/foray-font/src/java/org/foray/font/FOrayFontUse.java 2006-07-22 19:56:23 UTC (rev 7809) +++ trunk/foray/foray-font/src/java/org/foray/font/FOrayFontUse.java 2006-07-22 21:39:22 UTC (rev 7810) @@ -64,8 +64,8 @@ private HashMap fontOutputs = new HashMap(); - public FOrayFontUse(FOrayConsumerFont consumerFont, RegisteredFontDesc rfd, - Encoding encoding) { + public FOrayFontUse(final FOrayConsumerFont consumerFont, + final RegisteredFontDesc rfd, final Encoding encoding) { this.consumerFont = consumerFont; this.registeredFontDesc = rfd; this.encoding = encoding; @@ -86,7 +86,7 @@ /** * {@inheritDoc} */ - public int encodeCharacter(int codePoint) { + public int encodeCharacter(final int codePoint) { /* First get the font's encoding for the character. */ int fontEncodedChar = codePoint; if (this.encoding != null) { @@ -110,7 +110,8 @@ * {@inheritDoc} */ public short nextBolderWeight() { - RegisteredFontDesc desc = this.registeredFontDesc.nextBolderFont(); + final RegisteredFontDesc desc = + this.registeredFontDesc.nextBolderFont(); if (desc != null) { return desc.getFontWeight(); } @@ -122,7 +123,8 @@ * {@inheritDoc} */ public short nextLighterWeight() { - RegisteredFontDesc desc = this.registeredFontDesc.nextLighterFont(); + final RegisteredFontDesc desc = + this.registeredFontDesc.nextLighterFont(); if (desc != null) { return desc.getFontWeight(); } @@ -134,7 +136,8 @@ * {@inheritDoc} */ public org.axsl.fontR.FontUse nextBolderFont() { - RegisteredFontDesc desc = this.registeredFontDesc.nextBolderFont(); + final RegisteredFontDesc desc = + this.registeredFontDesc.nextBolderFont(); return fontUseForDesc(desc); } @@ -142,26 +145,29 @@ * {@inheritDoc} */ public org.axsl.fontR.FontUse nextLighterFont() { - RegisteredFontDesc desc = this.registeredFontDesc.nextLighterFont(); + final RegisteredFontDesc desc = + this.registeredFontDesc.nextLighterFont(); return fontUseForDesc(desc); } - private org.axsl.fontR.FontUse fontUseForDesc(RegisteredFontDesc desc) { + private org.axsl.fontR.FontUse fontUseForDesc( + final RegisteredFontDesc desc) { if (desc == null) { return null; } - FOrayFontConsumer consumer = this.getFOrayFontConsumer(); - FOrayFont font = consumer.whichUse(desc, ' '); - FOrayConsumerFont consumerFont = consumer.registerFontUse(font); + final FOrayFontConsumer consumer = this.getFOrayFontConsumer(); + final FOrayFont font = consumer.whichUse(desc, ' '); + final FOrayConsumerFont consumerFont = consumer.registerFontUse(font); return consumerFont.selectFontUse(desc, ' '); } /** * {@inheritDoc} */ - public int unavailableChar(CharSequence charSequence, int beginIndex) { + public int unavailableChar(final CharSequence charSequence, + final int beginIndex) { for (int i = 0; i < charSequence.length(); i++) { - char c = charSequence.charAt(i); + final char c = charSequence.charAt(i); if (! glyphAvailable(c)) { return i; } @@ -172,11 +178,12 @@ /** * {@inheritDoc} */ - public int[] unavailableChars(CharSequence charSequence, int beginIndex) { + public int[] unavailableChars(final CharSequence charSequence, + final int beginIndex) { int count = 0; /* Count them first. */ for (int i = 0; i < charSequence.length(); i++) { - char c = charSequence.charAt(i); + final char c = charSequence.charAt(i); if (! glyphAvailable(c)) { count++; } @@ -185,11 +192,11 @@ return null; } /* Create empty array. */ - int[] returnArray = new int[count]; + final int[] returnArray = new int[count]; /* Read through them again, completing the array. */ count = 0; for (int i = 0; i < charSequence.length(); i++) { - char c = charSequence.charAt(i); + final char c = charSequence.charAt(i); if (! glyphAvailable(c)) { returnArray[count] = i; count++; @@ -201,7 +208,7 @@ /** * {@inheritDoc} */ - public boolean glyphAvailable(int codePoint) { + public boolean glyphAvailable(final int codePoint) { /* Does the font have the glyph? */ if (! this.getFOrayFont().glyphAvailable(codePoint)) { return false; @@ -212,14 +219,14 @@ return true; } /* Can my encoding encode it? */ - int encodedChar = this.encoding.encodeCharacter(codePoint); + final int encodedChar = this.encoding.encodeCharacter(codePoint); return (encodedChar != 0); } /** * {@inheritDoc} */ - public int compareTo(Object object) { + public int compareTo(final Object object) { if (object == this) { return 0; } @@ -229,8 +236,8 @@ /** * {@inheritDoc} */ - public int smallCapsSize(int fontSize) { - float percent = this.registeredFontDesc.getSimulateSmallCaps(); + public int smallCapsSize(final int fontSize) { + final float percent = this.registeredFontDesc.getSimulateSmallCaps(); if (percent == Float.NaN) { return fontSize; } @@ -311,7 +318,7 @@ * {@inheritDoc} */ public String getPostscriptName() { - String postScriptName = this.getFont().getPostscriptName(); + final String postScriptName = this.getFont().getPostscriptName(); if (this.encoding == this.getFont().getInternalEncoding()) { return postScriptName; } @@ -332,14 +339,14 @@ /** * {@inheritDoc} */ - public void registerCharUsed(int c) { + public void registerCharUsed(final int c) { this.anyCharsUsed = true; /* If we are not subsetting, there is no need to spend the overhead to * register the use. */ if (this.getSubset() == null) { return; } - int glyphIndex = this.encodeCharacter(c); + final int glyphIndex = this.encodeCharacter(c); /* This just "touches" the subsetting logic. */ this.getSubset().encodeSubsetIndex(glyphIndex); } @@ -347,7 +354,7 @@ /** * {@inheritDoc} */ - public void registerCharsUsed(CharSequence charSequence) { + public void registerCharsUsed(final CharSequence charSequence) { if (charSequence == null) { return; } @@ -358,7 +365,7 @@ return; } for (int i = 0; i < charSequence.length(); i++) { - char c = charSequence.charAt(i); + final char c = charSequence.charAt(i); registerCharUsed(c); } } @@ -385,16 +392,16 @@ /** * {@inheritDoc} */ - public FontOutput getFontOutput(String mimeType) { + public FontOutput getFontOutput(final String mimeType) { FontOutput output = (FontOutput) this.fontOutputs.get(mimeType); if (output != null) { return output; } - FontOutputFactory factory = getFOrayFontServer().getOutputFactory( + final FontOutputFactory factory = getFOrayFontServer().getOutputFactory( mimeType); try { output = factory.createFontOutput(this); - } catch (FontException e) { + } catch (final FontException e) { getLogger().error("Error creating Font output for: " + mimeType + "\n" + e.getMessage()); } Modified: trunk/foray/foray-font/src/java/org/foray/font/FSTrueTypeFont.java =================================================================== --- trunk/foray/foray-font/src/java/org/foray/font/FSTrueTypeFont.java 2006-07-22 19:56:23 UTC (rev 7809) +++ trunk/foray/foray-font/src/java/org/foray/font/FSTrueTypeFont.java 2006-07-22 21:39:22 UTC (rev 7810) @@ -44,28 +44,29 @@ * Construct an instance. * @param rf The RegisteredFont that should be used to create this font. */ - protected FSTrueTypeFont(RegisteredFont rf) { + protected FSTrueTypeFont(final RegisteredFont rf) { super(rf); parseFont(); } - public byte[] getRawFontFile(FOrayFontUse fontUse) throws IOException { - Subset subset = fontUse.getSubset(); + public byte[] getRawFontFile(final FOrayFontUse fontUse) + throws IOException { + final Subset subset = fontUse.getSubset(); if (subset != null) { - TTFSubSetFile ttfSubset = new TTFSubSetFile(ttf, subset); + final TTFSubSetFile ttfSubset = new TTFSubSetFile(ttf, subset); return ttfSubset.buildEmbeddableSubset(); } - InputStream instream = getFontInputStream(); + final InputStream instream = getFontInputStream(); return IOUtil.toByteArray(instream, 128000); } public void parseFont() { - TTFFile ttfFile = (TTFFile) getRegisteredFont().getFontFileReader() - .cre... [truncated message content] |