References: [1] http://marc.theaimsgroup.com/?l=fop-dev&m=100559770232644&w=2 [2] http://marc.theaimsgroup.com/?l=fop-dev&m=100790930100949&w=2 [3] http://marc.theaimsgroup.com/?l=fop-dev&m=100386481704186&w=2
In fop 0.20.x unicode characters with value greater 256 not represented in the font are substituted with the character '#'. With the patch [1] all characters not represented in the font are substituted. This makes a problem in LineArea.getCharWidth. Because the line feed character has no glyph the width of the line feed is computed to the width of the '#' character and is unequal to the space character. This is the reason for the second problem described in [2]. Attached is a simple patch for fop 0.20.3RC to solve the problem. The patch from Peter [1](together with the two updates) can now entered in cvs in the maintenance branch. The patch [1](together with the first update in [2]) should be entered in cvs in the main branch. The design is easier to understand and the patch solves some design problems [3]. The attached patch (second update) is not necessary for the main branch in the moment. I think it is better to wait until the patch is in cvs and then to change the interface of the font subsystem. If a character is not contained in a font, the font subsystem should generate an exception. The area tree builder can then decide to substitute the character or to print a warning message. Rainer Garus
--- Fop-0.20.3rc/src/org/apache/fop/layout/LineArea.java Sat Jan 19 17:15:36 2002 +++ Fop1/src/org/apache/fop/layout/LineArea.java Wed Jan 30 19:46:52 2002 @@ -1235,51 +1235,53 @@ * versions of space that might not exists in the font. */ private int getCharWidth(char c) { - int width = currentFontState.width(currentFontState.mapChar(c)); - if (width <= 0) { - // Estimate the width of spaces not represented in - // the font - int em = currentFontState.width(currentFontState.mapChar('m')); - int en = currentFontState.width(currentFontState.mapChar('n')); - if (em <= 0) - em = 500 * currentFontState.getFontSize(); - if (en <= 0) - en = em - 10; + int width; - if (c == ' ') - width = em; - if (c == '\u2000') - width = en; - if (c == '\u2001') - width = em; - if (c == '\u2002') - width = em / 2; - if (c == '\u2003') - width = currentFontState.getFontSize(); - if (c == '\u2004') - width = em / 3; - if (c == '\u2005') - width = em / 4; - if (c == '\u2006') - width = em / 6; - if (c == '\u2007') - width = getCharWidth(' '); - if (c == '\u2008') - width = getCharWidth('.'); - if (c == '\u2009') - width = em / 5; - if (c == '\u200A') - width = 5; - if (c == '\u200B') - width = 100; - if (c == '\u00A0') - width = getCharWidth(' '); - if (c == '\u202F') - width = getCharWidth(' ') / 2; - if (c == '\u3000') - width = getCharWidth(' ') * 2; - if ((c == '\n') || (c == '\r') || (c == '\t')) - width = getCharWidth(' '); + if ((c == '\n') || (c == '\r') || (c == '\t') || (c == '\u00A0')) { + width = getCharWidth(' '); + } else { + width = currentFontState.width(currentFontState.mapChar(c)); + if (width <= 0) { + // Estimate the width of spaces not represented in + // the font + int em = currentFontState.width(currentFontState.mapChar('m')); + int en = currentFontState.width(currentFontState.mapChar('n')); + if (em <= 0) + em = 500 * currentFontState.getFontSize(); + if (en <= 0) + en = em - 10; + + if (c == ' ') + width = em; + if (c == '\u2000') + width = en; + if (c == '\u2001') + width = em; + if (c == '\u2002') + width = em / 2; + if (c == '\u2003') + width = currentFontState.getFontSize(); + if (c == '\u2004') + width = em / 3; + if (c == '\u2005') + width = em / 4; + if (c == '\u2006') + width = em / 6; + if (c == '\u2007') + width = getCharWidth(' '); + if (c == '\u2008') + width = getCharWidth('.'); + if (c == '\u2009') + width = em / 5; + if (c == '\u200A') + width = 5; + if (c == '\u200B') + width = 100; + if (c == '\u202F') + width = getCharWidth(' ') / 2; + if (c == '\u3000') + width = getCharWidth(' ') * 2; + } } return width;
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]