[ 
https://issues.apache.org/jira/browse/FOP-2494?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Robert Meyer updated FOP-2494:
------------------------------
    Comment: was deleted

(was: I've been investigating this and have found the method we were using to 
identify the number of character names in the post table was flawed. In the 
case of the UbuntuMono-R.ttf font there are 1296 characters. 258 of these come 
under the standard encoding whereas everything else should have an associated 
name in the table. Unfortunately what we were doing was to read the post table 
and use the glyph ID array to determine how many of those are greater than 258 
by looping through them. The problem here is the fact that the indexes aren't 
necessarily in a complete order. Therefore although we may count only 1046 
characters that are greater than 258, the index array may do the following:

1,2,3,5,6,7,9,10,11,12...etc

The maximum glyph ID in this case is 1315, which minus 258 is 1057. As such a 
fix for this will be to set the size of the Strings array (and subsequently 
read) upon the maximum glyph index taken from that set. It's a fairly simple 
fix and will post a patch and commit after I've done some further testing 
tomorrow.)

> Unable to use Ubuntu Mono Font
> ------------------------------
>
>                 Key: FOP-2494
>                 URL: https://issues.apache.org/jira/browse/FOP-2494
>             Project: FOP
>          Issue Type: Bug
>          Components: font/opentype
>    Affects Versions: 2.0
>         Environment: Ubuntu 14.04, Java 8u45
>            Reporter: Harshad
>            Assignee: Robert Meyer
>
> I want to use the Ubuntu Mono font, which is installed on my system. But FOP 
> throws an exception when it is auto-detecting the fonts:
> {code}
> Unable to load font file: 
> file:/usr/share/fonts/truetype/ubuntu-font-family/UbuntuMono-R.ttf
> java.lang.ArrayIndexOutOfBoundsException: 1047                                
>                                                                
>   at org.apache.fop.fonts.truetype.OpenFont.readPostScript(OpenFont.java:1320)
>   at org.apache.fop.fonts.truetype.OpenFont.readFont(OpenFont.java:736)
>   at org.apache.fop.fonts.truetype.OFFontLoader.read(OFFontLoader.java:109)
>   at org.apache.fop.fonts.truetype.OFFontLoader.read(OFFontLoader.java:93)
>   at org.apache.fop.fonts.FontLoader.getFont(FontLoader.java:124)
>   at org.apache.fop.fonts.FontLoader.loadFont(FontLoader.java:108)
>   at 
> org.apache.fop.fonts.autodetect.FontInfoFinder.find(FontInfoFinder.java:254)
>   at org.apache.fop.fonts.FontAdder.add(FontAdder.java:63)
>   at 
> org.apache.fop.fonts.FontDetectorFactory$DefaultFontDetector.detect(FontDetectorFactory.java:97)
>   at org.apache.fop.fonts.FontManager.autoDetectFonts(FontManager.java:229)
>   at 
> org.apache.fop.fonts.DefaultFontConfigurator.configure(DefaultFontConfigurator.java:82)
>   at 
> org.apache.fop.render.PrintRendererConfigurator.getCustomFontCollection(PrintRendererConfigurator.java:147)
>   at 
> org.apache.fop.render.PrintRendererConfigurator.setupFontInfo(PrintRendererConfigurator.java:127)
>   at org.apache.fop.render.intermediate.IFUtil.setupFonts(IFUtil.java:170)
>   at 
> org.apache.fop.render.intermediate.IFRenderer.setupFontInfo(IFRenderer.java:187)
>   at org.apache.fop.area.RenderPagesModel.<init>(RenderPagesModel.java:75)
>   at org.apache.fop.area.AreaTreeHandler.setupModel(AreaTreeHandler.java:135)
>   at org.apache.fop.area.AreaTreeHandler.<init>(AreaTreeHandler.java:105)
>   at 
> org.apache.fop.render.RendererFactory.createFOEventHandler(RendererFactory.java:350)
>   at org.apache.fop.fo.FOTreeBuilder.<init>(FOTreeBuilder.java:107)
>   at org.apache.fop.apps.Fop.createDefaultHandler(Fop.java:104)
>   at org.apache.fop.apps.Fop.<init>(Fop.java:78)
>   at org.apache.fop.apps.FOUserAgent.newFop(FOUserAgent.java:179)
>   at org.apache.fop.apps.FopFactory.newFop(FopFactory.java:240)
> {code}
> The same exception is thrown for other variants of the font (bold, italic, 
> etc).
> Note that this font can be downloaded freely from http://font.ubuntu.com/
> The latest version of the font is 0.80, and that is what I have installed on 
> my system.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to