* @event.severity ERROR
*/
void invalidConfiguration(Object source, Exception e);
+
+ /**
+ * The characterset is missing metric information for the specified character
+ * @param source the event source
+ * @param character the character with missing metric information.
+ * @param charSet the character set containing missing metric information
+ * @event.severity WARN
+ */
+ void charactersetMissingMetrics(Object source, char character, String charSet);
}
<message key="fontConfigMissing">The mandatory configuation node: '{missingConfig}' was not found at {location}.</message>
<message key="characterSetNameInvalid">The character set given has an invalid name. [ Reason: {msg} ]</message>
<message key="codePageNotFound">The code page for an AFP font cannot be found.[ Reason: {e}]</message>
+ <message key="charactersetMissingMetrics">Metric information is missing for the glyph `{character}` in the characterset `{charSet}`. Using space increment width.</message>
</catalogue>
package org.apache.fop.afp.fonts;
+import org.apache.fop.afp.AFPEventProducer;
+
/**
* A font defined as a set of lines and curves as opposed to a bitmap font. An
* outline font can be scaled to any size and otherwise transformed more easily
/** The character set for this font */
protected CharacterSet charSet = null;
+ private final AFPEventProducer eventProducer;
+
/**
* Constructor for an outline font.
*
* @param name the name of the font
* @param embeddable sets whether or not this font is to be embedded
* @param charSet the chracter set
+ * @param eventProducer The object to handle any events which occur from the object.
*/
- public AbstractOutlineFont(String name, boolean embeddable, CharacterSet charSet) {
+ public AbstractOutlineFont(String name, boolean embeddable, CharacterSet charSet,
+ AFPEventProducer eventProducer) {
super(name, embeddable);
this.charSet = charSet;
+ this.eventProducer = eventProducer;
+ }
+
+ AFPEventProducer getAFPEventProducer() {
+ return eventProducer;
}
/**
import java.util.HashSet;
import java.util.Set;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import org.apache.fop.afp.AFPEventProducer;
+
/**
* Implementation of AbstractOutlineFont that supports double-byte fonts (CID Keyed font (Type 0)).
* The width of characters that are not prescribed a width metrics in the font resource use
*/
public class DoubleByteFont extends AbstractOutlineFont {
- //private static final Log LOG = LogFactory.getLog(DoubleByteFont.class);
+ private static final Log log = LogFactory.getLog(DoubleByteFont.class);
+
+ private final Set<Integer> charsProcessed;
//See also http://unicode.org/reports/tr11/ which we've not closely looked at, yet
//TODO the Unicode block listed here is probably not complete (ex. Hiragana, Katakana etc.)
* @param name the name of the font
* @param embeddable whether or not this font is embeddable
* @param charSet the character set
+ * @param eventProducer Handles any AFP related events
*/
- public DoubleByteFont(String name, boolean embeddable, CharacterSet charSet) {
- super(name, embeddable, charSet);
+ public DoubleByteFont(String name, boolean embeddable, CharacterSet charSet,
+ AFPEventProducer eventProducer) {
+ super(name, embeddable, charSet, eventProducer);
+ charsProcessed = new HashSet<Integer>();
}
/** {@inheritDoc} */
try {
charWidth = charSet.getWidth(toUnicodeCodepoint(character));
} catch (IllegalArgumentException e) {
+ if (!charsProcessed.contains(character)) {
+ charsProcessed.add(character);
+ getAFPEventProducer().charactersetMissingMetrics(this, (char)character,
+ charSet.getName().trim());
+ }
// We shall try and handle characters that have no mapped width metric in font resource
charWidth = -1;
}
package org.apache.fop.afp.fonts;
+import org.apache.fop.afp.AFPEventProducer;
+
/**
* Default implementation of AbstractOutlineFont.
*/
* @param name font's name
* @param embeddable whether or not this font is embeddable
* @param charSet font's character set
+ * @param eventProducer Handles any AFP related events
*/
- public OutlineFont(String name, boolean embeddable, CharacterSet charSet) {
- super(name, embeddable, charSet);
+ public OutlineFont(String name, boolean embeddable, CharacterSet charSet,
+ AFPEventProducer eventProducer) {
+ super(name, embeddable, charSet, eventProducer);
}
}
AFPResourceAccessor accessor = getAccessor(resourceResolver);
CharacterSet characterSet = CharacterSetBuilder.getDoubleByteInstance().buildDBCS(
characterset, super.codePage, super.encoding, charsetType, accessor, eventProducer);
- return getFontInfo(new DoubleByteFont(super.codePage, super.embeddable, characterSet),
- this);
+ return getFontInfo(new DoubleByteFont(super.codePage, super.embeddable, characterSet,
+ eventProducer), this);
}
}
characterSet = CharacterSetBuilder.getSingleByteInstance().buildSBCS(
characterset, super.codePage, super.encoding, accessor, eventProducer);
}
- return getFontInfo(new OutlineFont(super.name, super.embeddable, characterSet), this);
+ return getFontInfo(new OutlineFont(super.name, super.embeddable, characterSet,
+ eventProducer), this);
}
}
documents. Example: the fix of marks layering will be such a case when it's done.
-->
<release version="FOP Trunk" date="TBD">
+ <action context="Fonts" dev="MH" type="add" fixes-bug="53600" due-to="Robert Meyer">
+ Added an event if a glyph and its metric information does not exist in the character set
+ </action>
<action context="Renderers" dev="VH" type="add" fixes-bug="53596">
When PDF accessibility is enabled, the structure tree must contain information about the
number of columns or rows spanned by a table cell.