aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Bowditch <cbowditch@apache.org>2012-01-19 14:26:06 +0000
committerChris Bowditch <cbowditch@apache.org>2012-01-19 14:26:06 +0000
commit6c9666b14029c8470200da24a4f184a022cd3a59 (patch)
tree79ac086d8b014a6a23da01ca246703879ecbd583
parentb30c82eb93a5abfe8eaaf7f11b248b38f8478c6e (diff)
downloadxmlgraphics-fop-6c9666b14029c8470200da24a4f184a022cd3a59.tar.gz
xmlgraphics-fop-6c9666b14029c8470200da24a4f184a022cd3a59.zip
Bugzilla #52416:
Suppress unnecessary "font not found warnings" when generating AFP with raster fonts Submitted by: Luis Bernardo git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@1233393 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--src/java/org/apache/fop/afp/fonts/RasterFont.java26
-rw-r--r--status.xml3
2 files changed, 17 insertions, 12 deletions
diff --git a/src/java/org/apache/fop/afp/fonts/RasterFont.java b/src/java/org/apache/fop/afp/fonts/RasterFont.java
index 2a4d5d270..da5060ccc 100644
--- a/src/java/org/apache/fop/afp/fonts/RasterFont.java
+++ b/src/java/org/apache/fop/afp/fonts/RasterFont.java
@@ -70,14 +70,14 @@ public class RasterFont extends AFPFont {
/**
* Get the character set metrics for the specified point size.
*
- * @param size the point size (in mpt)
+ * @param sizeInMpt the point size (in mpt)
* @return the character set metrics
*/
- public CharacterSet getCharacterSet(int size) {
+ public CharacterSet getCharacterSet(int sizeInMpt) {
- //TODO: replace with Integer.valueOf() once we switch to Java 5
- Integer requestedSize = new Integer(size);
+ Integer requestedSize = Integer.valueOf(sizeInMpt);
CharacterSet csm = (CharacterSet) charSets.get(requestedSize);
+ double sizeInPt = sizeInMpt / 1000.0;
if (csm != null) {
return csm;
@@ -101,10 +101,10 @@ public class RasterFont extends AFPFont {
Integer fontSize;
if (!smallerSizes.isEmpty()
- && (size - smallerSize) <= (largerSize - size)) {
- fontSize = new Integer(smallerSize);
+ && (sizeInMpt - smallerSize) <= (largerSize - sizeInMpt)) {
+ fontSize = Integer.valueOf(smallerSize);
} else {
- fontSize = new Integer(largerSize);
+ fontSize = Integer.valueOf(largerSize);
}
csm = (CharacterSet) charSets.get(fontSize);
@@ -115,16 +115,18 @@ public class RasterFont extends AFPFont {
substitutionCharSets = new HashMap();
}
substitutionCharSets.put(requestedSize, csm);
- String msg = "No " + (size / 1000f) + "pt font " + getFontName()
- + " found, substituted with " + fontSize.intValue() / 1000f + "pt font";
- LOG.warn(msg);
+ // do not output the warning if the font size is closer to an integer less than 0.1
+ if (!(Math.abs(fontSize.intValue() / 1000.0 - sizeInPt) < 0.1)) {
+ String msg = "No " + sizeInPt + "pt font " + getFontName()
+ + " found, substituted with " + fontSize.intValue() / 1000f + "pt font";
+ LOG.warn(msg);
+ }
}
}
if (csm == null) {
// Still no match -> error
- String msg = "No font found for font " + getFontName()
- + " with point size " + size / 1000f;
+ String msg = "No font found for font " + getFontName() + " with point size " + sizeInPt;
LOG.error(msg);
throw new FontRuntimeException(msg);
}
diff --git a/status.xml b/status.xml
index 53d1cbdc2..b395abe1e 100644
--- a/status.xml
+++ b/status.xml
@@ -61,6 +61,9 @@
documents. Example: the fix of marks layering will be such a case when it's done.
-->
<release version="FOP Trunk" date="TBD">
+ <action context="Code" dev="CB" type="add" fixes-bug="52416" due-to="Luis Bernardo">
+ Suppress unnecessary "font not found warnings" when generating AFP with raster fonts
+ </action>
<action context="Code" dev="CB" type="add" fixes-bug="51209" due-to="Luis Bernardo">
SVG text in AFP creates miscoded GOCA text
</action>