[ 
https://issues.apache.org/jira/browse/FOP-3062?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17519752#comment-17519752
 ] 

Richard Zowalla edited comment on FOP-3062 at 4/8/22 6:52 PM:
--------------------------------------------------------------

A possible fix / solution / workaround would (maybe - I was just looking at the 
code) probably be:

1. Pass "useAdvanced" as a new parameter to FontInfoFinder#find(...). To avoid 
breaking the API, we could do something like:

 
{code:java}
 public EmbedFontInfo[] find(URI fontURI, InternalResourceResolver 
resourceResolver, FontCache fontCache) {
  return find(fontURI, resourceResolver, fontCache);
 }
 
 public EmbedFontInfo[] find(URI fontURI, InternalResourceResolver 
resourceResolver, FontCache fontCache, boolean useAdvanced) {
  ...
 }
 {code}
 
 2. Add a boolean property for "useAdvanced" to the FontManager (?) to 
propagate to the FontFinderInfo / FontAdder.
  
Note: If "complexScriptFeaturues" has the same meaning ie is semantically equal 
to "useAdvanced" in FontInfoFinder, we would need to make sure, that this 
property is passed to the FontManager (after being set via XML or 
programmatically). Something like [^propagate_use_advanced.patch] - if this 
goes in the right direction, I can also prepare a PR on GitHub.

Btw. the same holds for "useKerning", which is set to "true" by default in 
find(...). Shouldn't that be a parameter to, which is passed from the font 
manager to the find(...) method?

Wdyt? 


was (Author: rzo1):
A possible fix / solution / workaround would (maybe - I was just looking at the 
code) probably be:

1. Pass "useAdvanced" as a new parameter to FontInfoFinder#find(...). To avoid 
breaking the API, we could do something like:

 
{code:java}
 public EmbedFontInfo[] find(URI fontURI, InternalResourceResolver 
resourceResolver, FontCache fontCache) {
  return find(fontURI, resourceResolver, fontCache);
 }
 
 public EmbedFontInfo[] find(URI fontURI, InternalResourceResolver 
resourceResolver, FontCache fontCache, boolean useAdvanced) {
  ...
 }
 {code}
 
 2. Add a boolean property for "useAdvanced" to the FontManager (?) to 
propagate to the FontFinderInfo / FontAdder.
  
Note: If "complexScriptFeaturues" has the same meaning ie is semantically equal 
to "useAdvanced" in FontInfoFinder, we would need to make sure, that this 
property is passed to the FontManager (after being set via XML or 
programmatically). Something like 
https://issues.apache.org/jira/secure/attachment/13042174/propagate_use_advanced.patch

 

Btw. the same holds for "useKerning", which is set to "true" by default in 
find(...). Shouldn't that be a parameter to, which is passed from the font 
manager to the find(...) method?

Wdyt? 

> AssertionError in GlyphPositioningTable$DeviceTable with SFArabic.ttf
> ---------------------------------------------------------------------
>
>                 Key: FOP-3062
>                 URL: https://issues.apache.org/jira/browse/FOP-3062
>             Project: FOP
>          Issue Type: Bug
>          Components: unqualified
>    Affects Versions: 2.7
>            Reporter: Richard Zowalla
>            Priority: Major
>         Attachments: SFArabic.ttf, image-2022-04-08-16-09-21-254.png, 
> propagate_use_advanced.patch
>
>
> While working on a M1 Mac OS system:
>  
> {code:java}
> Java version: 17.0.2, vendor: Oracle Corporation, runtime: 
> /Library/Java/JavaVirtualMachines/jdk-17.0.2.jdk/Contents/HomeDefault locale: 
> de_DE, platform encoding: UTF-8
> OS name: "mac os x", version: "12.3", arch: "aarch64", family: "mac"{code}
> I get the following AssertionError with a simple FOP config as follows:
> {code:java}
> <fop version="1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
>      
> xsi:noNamespaceSchemaLocation="http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/foschema/fop-configuration.xsd?view=co";>
>     <!-- Renderer -->
>     <renderers>        <!-- PDF Renderer -->
>         <renderer mime="application/pdf">            <!-- Filter -->
>             <filterList>
>                 <value>null</value>
>             </filterList>
>             <!-- Filter Image Settings-->
>             <filterList type="image">
>                 <value>flate</value>
>                 <value>ascii-85</value>
>             </filterList>
>             <!-- Font Configuration -->
>             <fonts>                <!-- <auto-detect/> -->
>                 <directory>/Users/abc/uploads/fonts</directory>
>             </fonts>
>         </renderer>
>     </renderers>
>     <fonts>
>         <!-- <auto-detect/> -->
>         <directory>/Users/abc/uploads/fonts</directory>
>     </fonts>
> </fop> {code}
> The font, which violates the assertion in DeviceTable is:
> *[file:/System/Library/Fonts/SFArabic.ttf*|file:///System/Library/Fonts/SFArabic.ttf*]
>  
> *Stacktrace:*
> {code:java}
> java.lang.AssertionError at 
> org.apache.fop.complexscripts.fonts.GlyphPositioningTable$DeviceTable.<init>(GlyphPositioningTable.java:1774)
>  at 
> org.apache.fop.complexscripts.fonts.OTFAdvancedTypographicTableReader.readPosDeviceTable(OTFAdvancedTypographicTableReader.java:1727)
>  at 
> org.apache.fop.complexscripts.fonts.OTFAdvancedTypographicTableReader.readPosAnchor(OTFAdvancedTypographicTableReader.java:2051)
>  at 
> org.apache.fop.complexscripts.fonts.OTFAdvancedTypographicTableReader.readMarkToLigaturePosTableFormat1(OTFAdvancedTypographicTableReader.java:2345)
>  at 
> org.apache.fop.complexscripts.fonts.OTFAdvancedTypographicTableReader.readMarkToLigaturePosTable(OTFAdvancedTypographicTableReader.java:2371)
>  at 
> org.apache.fop.complexscripts.fonts.OTFAdvancedTypographicTableReader.readGPOSSubtable(OTFAdvancedTypographicTableReader.java:3122)
>  at 
> org.apache.fop.complexscripts.fonts.OTFAdvancedTypographicTableReader.readLookupTable(OTFAdvancedTypographicTableReader.java:3191)
>  at 
> org.apache.fop.complexscripts.fonts.OTFAdvancedTypographicTableReader.readLookupList(OTFAdvancedTypographicTableReader.java:3218)
>  at 
> org.apache.fop.complexscripts.fonts.OTFAdvancedTypographicTableReader.readCommonLayoutTables(OTFAdvancedTypographicTableReader.java:3239)
>  at 
> org.apache.fop.complexscripts.fonts.OTFAdvancedTypographicTableReader.readGPOS(OTFAdvancedTypographicTableReader.java:3499)
>  at 
> org.apache.fop.complexscripts.fonts.OTFAdvancedTypographicTableReader.readAll(OTFAdvancedTypographicTableReader.java:84)
>  at 
> org.apache.fop.fonts.truetype.OpenFont.handleCharacterSpacing(OpenFont.java:889)
>  at org.apache.fop.fonts.truetype.OpenFont.readFont(OpenFont.java:861) at 
> org.apache.fop.fonts.truetype.OFFontLoader.read(OFFontLoader.java:119) at 
> org.apache.fop.fonts.truetype.OFFontLoader.read(OFFontLoader.java:103) at 
> org.apache.fop.fonts.FontLoader.getFont(FontLoader.java:126) at 
> org.apache.fop.fonts.FontLoader.loadFont(FontLoader.java:110) at 
> org.apache.fop.fonts.autodetect.FontInfoFinder.find(FontInfoFinder.java:253) 
> at org.apache.fop.fonts.FontAdder.add(FontAdder.java:63) at 
> org.apache.fop.fonts.FontDetectorFactory$DefaultFontDetector.detect(FontDetectorFactory.java:105)
>  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:363)
>  at org.apache.fop.fo.FOTreeBuilder.<init>(FOTreeBuilder.java:109) 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:184) at 
> org.apache.fop.apps.FopFactory.newFop(FopFactory.java:234){code}



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

Reply via email to