From 66f4f9aa79343ec31afbf0a2fbe4a5359ff649ec Mon Sep 17 00:00:00 2001 From: Jeremias Maerki Date: Mon, 12 Nov 2007 08:27:46 +0000 Subject: [PATCH] Issue a clear warning if the selected hyphenation character is not available in a font. Otherwise you'd just get a "glyph not available" error and you wonder why the hell FOP wants to use that character. git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@594046 13f79535-47bb-0310-9956-ffa450edef68 --- .../apache/fop/layoutmgr/inline/TextLayoutManager.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/java/org/apache/fop/layoutmgr/inline/TextLayoutManager.java b/src/java/org/apache/fop/layoutmgr/inline/TextLayoutManager.java index e62f3dc2a..d446e0e7d 100644 --- a/src/java/org/apache/fop/layoutmgr/inline/TextLayoutManager.java +++ b/src/java/org/apache/fop/layoutmgr/inline/TextLayoutManager.java @@ -20,8 +20,8 @@ package org.apache.fop.layoutmgr.inline; import java.util.ArrayList; -import java.util.List; import java.util.LinkedList; +import java.util.List; import java.util.ListIterator; import org.apache.commons.logging.Log; @@ -195,7 +195,13 @@ public class TextLayoutManager extends LeafNodeLayoutManager { // With CID fonts, space isn't neccesary currentFontState.width(32) spaceCharIPD = font.getCharWidth(' '); // Use hyphenationChar property - hyphIPD = font.getCharWidth(foText.getCommonHyphenation().hyphenationCharacter.getCharacter()); + char hyphChar = foText.getCommonHyphenation().hyphenationCharacter.getCharacter(); + if (font.hasChar(hyphChar)) { + hyphIPD = font.getCharWidth(hyphChar); + } else { + log.warn("Hyphenation character 0x" + Integer.toHexString(hyphChar) + + " is not available for font: " + font.getFontTriplet()); + } SpaceVal ls = SpaceVal.makeLetterSpacing(foText.getLetterSpacing()); halfLS = new SpaceVal(MinOptMax.multiply(ls.getSpace(), 0.5), -- 2.39.5