Skip to content

Commit a8cdbcc

Browse files
determine page and text position for glyph warning, #21
1 parent b0c7163 commit a8cdbcc

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

fop-core/src/main/java/org/apache/fop/fonts/MultiByteFont.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -677,7 +677,7 @@ private GlyphSequence mapCharsToGlyphs(CharSequence cs, List associations) {
677677
notifyMapOperation();
678678
gi = findGlyphIndex(cc);
679679
if (gi == SingleByteEncoding.NOT_FOUND_CODE_POINT) {
680-
warnMissingGlyph((char) cc);
680+
warnMissingGlyph((char) cc, cs);
681681
gi = giMissing;
682682
}
683683
cb.put(cc);

fop-core/src/main/java/org/apache/fop/fonts/Typeface.java

+13-1
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,8 @@ public abstract class Typeface implements FontMetrics {
4848
*/
4949
private long charMapOps;
5050

51+
private CharSequence cs;
52+
5153
/** An optional event listener that receives events such as missing glyphs etc. */
5254
protected FontEventListener eventListener;
5355

@@ -136,7 +138,11 @@ protected void warnMissingGlyph(char c) {
136138
if (warnedChars.size() < 8 && !warnedChars.contains(ch)) {
137139
warnedChars.add(ch);
138140
if (this.eventListener != null) {
139-
this.eventListener.glyphNotAvailable(this, c, getFontName());
141+
String suffix = getFontName();
142+
if (cs != null && cs.length() > 1) {
143+
suffix += "\". Found in the character sequence \"" + cs;
144+
}
145+
this.eventListener.glyphNotAvailable(this, c, suffix);
140146
} else {
141147
if (warnedChars.size() == 8) {
142148
log.warn("Many requested glyphs are not available in font "
@@ -151,6 +157,12 @@ protected void warnMissingGlyph(char c) {
151157
}
152158
}
153159

160+
protected void warnMissingGlyph(char c, CharSequence cs) {
161+
this.cs = cs;
162+
warnMissingGlyph(c);
163+
}
164+
165+
154166
/** {@inheritDoc} */
155167
public String toString() {
156168
StringBuffer sbuf = new StringBuffer(super.toString());

0 commit comments

Comments
 (0)