【问题】
用docbook生成pdf过程中出错:
六月 11, 2012 11:33:38 下午 org.apache.fop.fonts.truetype.TTFFile guessVerticalMetricsFromGlyphBBox 警告: capHeight value could not be determined. The font may not work as expected. 六月 11, 2012 11:33:38 下午 org.apache.fop.fonts.truetype.TTFFile guessVerticalMetricsFromGlyphBBox 警告: xHeight value could not be determined. The font may not work as expected. 六月 11, 2012 11:33:38 下午 org.apache.fop.events.LoggingEventListener processEvent 警告: Glyph "→" (0x2192, arrowright) not available in font "SymbolMT".
【解决过程】
1.找了半天,发现docbook源码中,没有找到此特殊字符。所以很是奇怪,为何会报此错误。
2.通过一点点取xi:include的文件,定位到是ch02_enc_type.xml出现的此错误。
最后好不容易找到了根本原因:原来是由于使用了源码:
打开文件后,点击 <menuchoice> <guimenu>文件</guimenu> <guimenuitem>另存为</guimenuitem> </menuchoice>会跳出一个对话框,
然后对应的menuchoice部分,会生成对应的那个特殊字符==右箭头==→==0x2192==arrowright,其属于字形Glyph。
然后对于glyph,fop官网有解释:
Missing Glyphs
Every font contains a particular set of glyphs. If no glyph can be found for a given character, FOP will issue a warning and use the glpyh for "#" (if available) instead. Before it does that, it consults a (currently hard-coded) registry of glyph substitution groups (see Glyphs.java in Apache XML Graphics Commons). This registry can supply alternative glyphs in some cases (like using space when a no-break space is requested). But there’s no guarantee that the result will be as expected (for example, in the case of hyphens and similar glyphs). A better way is to use a font that has all the necessary glyphs. This glyph substitution is only a last resort.
所以,看起来是对应的font中的glyph中没有包含此字符,所以才会有此错误警告的。
然后生成的pdf中,此右箭头被#代替了,所以很是难看。
想要解决此问题的话,先是不用此menuchoice了。
然后手动写源码,使用对应的右箭头,并且借用之前的办法,使用role="symbol"使得此字符变成symbol,然后就可以使用原先用:
<xsl:param name="symbol.font.family">Cambria Math</xsl:param>
设置的symbol的字体Cambria Math去显示此字符了。
对应的源码变成:
打开文件后,点击"文件"<phrase role="symbol">→</phrase>"另存为"会跳出一个对话框
生成的效果为:
【总结】
本来想要使用menuchoice,显得更专业的,结果导致右箭头不能正常显示,很是悲催,只能换回手动写右箭头,然后加上特殊的role去处理为symbol,才能显示,很是不爽,但是暂时也没办法,就只能先这样了。
转载请注明:在路上 » 【基本解决】docbook生成pdf过程中出错:Glyph "→" (0x2192, arrowright) not available in font "SymbolMT"