[jira] [Comment Edited] (FOP-3062) AssertionError in GlyphPositioningTable$DeviceTable with SFArabic.ttf

2022-04-08 Thread Simon Steiner (Jira)


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

Simon Steiner edited comment on FOP-3062 at 4/8/22 7:13 PM:


Aim should be to fix assertion failure


was (Author: ssteiner1):
We will fix the assertion failure

> 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}
> http://www.w3.org/2001/XMLSchema-instance;
>  
> xsi:noNamespaceSchemaLocation="http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/foschema/fop-configuration.xsd?view=co;>
> 
> 
> 
> 
> null
> 
> 
> 
> flate
> ascii-85
> 
> 
> 
> /Users/abc/uploads/fonts
> 
> 
> 
> 
> 
> /Users/abc/uploads/fonts
> 
>  {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.(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.(RenderPagesModel.java:75) at 
> 

[jira] [Comment Edited] (FOP-3062) AssertionError in GlyphPositioningTable$DeviceTable with SFArabic.ttf

2022-04-08 Thread Richard Zowalla (Jira)


[ 
https://issues.apache.org/jira/browse/FOP-3062?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=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}
> http://www.w3.org/2001/XMLSchema-instance;
>  
> xsi:noNamespaceSchemaLocation="http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/foschema/fop-configuration.xsd?view=co;>
> 
> 
> 
> 
> null
> 
> 
> 
> flate
> ascii-85
> 
> 
> 
> /Users/abc/uploads/fonts
> 
> 
> 
> 
> 
> /Users/abc/uploads/fonts
> 
>  {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.(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 
> 

[jira] [Comment Edited] (FOP-3062) AssertionError in GlyphPositioningTable$DeviceTable with SFArabic.ttf

2022-04-08 Thread Richard Zowalla (Jira)


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

Richard Zowalla edited comment on FOP-3062 at 4/8/22 6:48 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 
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? 


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 [^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}
> http://www.w3.org/2001/XMLSchema-instance;
>  
> xsi:noNamespaceSchemaLocation="http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/foschema/fop-configuration.xsd?view=co;>
> 
> 
> 
> 
> null
> 
> 
> 
> flate
> ascii-85
> 
> 
> 
> /Users/abc/uploads/fonts
> 
> 
> 
> 
> 
> /Users/abc/uploads/fonts
> 
>  {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.(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 
> 

[jira] [Comment Edited] (FOP-3062) AssertionError in GlyphPositioningTable$DeviceTable with SFArabic.ttf

2022-04-08 Thread Richard Zowalla (Jira)


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

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

Thanks for updating the documentation as well as your time.

I tested the sample code: If I hard-code the path to SFArabic via  the font is loaded and used (at least no exception / assertion error 
is thrown)
{code:java}
Apr. 08, 2022 6:47:05 PM org.apache.fop.fo.properties.CommonHyphenation 
getHyphChar
WARNUNG: Substituted specified hyphenation character (0x2d) with 0x20 because 
the font doesn't have the specified hyphenation character: SFArabic,normal,400
Apr. 08, 2022 6:47:05 PM org.apache.fop.events.LoggingEventListener processEvent
WARNUNG: Glyph "t" (0x74, t) not available in font ".SFArabic-Regular".
Apr. 08, 2022 6:47:05 PM org.apache.fop.events.LoggingEventListener processEvent
WARNUNG: Glyph "e" (0x65, e) not available in font ".SFArabic-Regular".
Apr. 08, 2022 6:47:05 PM org.apache.fop.events.LoggingEventListener processEvent
WARNUNG: Glyph "s" (0x73, s) not available in font ".SFArabic-Regular".
Apr. 08, 2022 6:47:05 PM org.apache.fop.events.LoggingEventListener processEvent
WARNUNG: Glyph "2" (0x32, two) not available in font ".SFArabic-Regular".
Apr. 08, 2022 6:47:05 PM org.apache.fop.events.LoggingEventListener processEvent
INFORMATION: Rendered page #1.{code}
My issue is, that I do +*not*+ want to use *SFArabic* at all (it is just a 
system font, which is available by default on an MacOS 12.3 and cannot be 
deleted), which is detected during auto scanning by fop.
So I am not quite sure, if specifying the specific font will help with the 
original issue which occurs during auto-scanning.

Is there a configuration option to exclude fonts from being scanned?

*The good news:* 

I was able to reproduce it on my Ubuntu 20.04 LTS machine by adjusting your 
code snippet (without our complicated EAR / EE setup). Started the code with 
*-ea* via JVM params.

Note: I installed the *SFArabic.ttf* system-wide and re-generated the Ubuntu 
font cache. 

 
{code:java}
import org.apache.fop.apps.FOUserAgent;
import org.apache.fop.apps.Fop;
import org.apache.fop.apps.FopConfParser;
import org.apache.fop.apps.FopFactory;
import org.apache.fop.apps.FopFactoryBuilder;
import javax.xml.transform.Result;
import javax.xml.transform.Source;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.sax.SAXResult;
import javax.xml.transform.stream.StreamSource;
import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.FileOutputStream;
public class ComplexScript {
    public static void main(String[] args) throws Exception {
        String fo = "http://www.w3.org/1999/XSL/Format\"\n; 
+
                "  
xmlns:fox=\"http://xmlgraphics.apache.org/fop/extensions\;>\n" +
                "  \n" +
                "    \n" +
                "      \n" +
                "    \n" +
                "  \n" +
                "  \n" +
                "    \n" +
                " test2  \n" +
                "\n" +
                "  \n" +
                "\n";
        String fopxconf = """
                http://www.w3.org/2001/XMLSchema-instance;
                     
xsi:noNamespaceSchemaLocation="http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/foschema/fop-configuration.xsd?view=co;>
                                
                    
                                
                            
                                
                                    
                            
                                null
                            
                            
                            
                                flate
                                ascii-85
                            
                                
                            
                                       
                               
                            
                                
                        
                    
                    
                      
                    
                \s
                """;
        FopFactoryBuilder builder =
                new FopConfParser(new 
ByteArrayInputStream(fopxconf.getBytes()), new 
File(".").toURI()).getFopFactoryBuilder();
        builder.setComplexScriptFeatures(false);
        FopFactory fopFactory = builder.build();
//disable the font cache on purpose to reproduce the issue
        fopFactory.getFontManager().disableFontCache();
        FOUserAgent foUserAgent = fopFactory.newFOUserAgent();
        FileOutputStream fos = new FileOutputStream("/tmp/out.pdf");
        Fop fop = fopFactory.newFop("application/pdf", foUserAgent, fos);
        TransformerFactory factory = TransformerFactory.newInstance();
        Transformer transformer = factory.newTransformer();
  

[jira] [Comment Edited] (FOP-3062) AssertionError in GlyphPositioningTable$DeviceTable with SFArabic.ttf

2022-04-08 Thread Richard Zowalla (Jira)


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

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

Thanks for updating the documentation as well as your time.

I tested the sample code: If I hard-code the path to SFArabic via  the font is loaded and used (at least no exception / assertion error 
is thrown)
{code:java}
Apr. 08, 2022 6:47:05 PM org.apache.fop.fo.properties.CommonHyphenation 
getHyphChar
WARNUNG: Substituted specified hyphenation character (0x2d) with 0x20 because 
the font doesn't have the specified hyphenation character: SFArabic,normal,400
Apr. 08, 2022 6:47:05 PM org.apache.fop.events.LoggingEventListener processEvent
WARNUNG: Glyph "t" (0x74, t) not available in font ".SFArabic-Regular".
Apr. 08, 2022 6:47:05 PM org.apache.fop.events.LoggingEventListener processEvent
WARNUNG: Glyph "e" (0x65, e) not available in font ".SFArabic-Regular".
Apr. 08, 2022 6:47:05 PM org.apache.fop.events.LoggingEventListener processEvent
WARNUNG: Glyph "s" (0x73, s) not available in font ".SFArabic-Regular".
Apr. 08, 2022 6:47:05 PM org.apache.fop.events.LoggingEventListener processEvent
WARNUNG: Glyph "2" (0x32, two) not available in font ".SFArabic-Regular".
Apr. 08, 2022 6:47:05 PM org.apache.fop.events.LoggingEventListener processEvent
INFORMATION: Rendered page #1.{code}
My issue is, that I do +*not*+ want to use *SFArabic* at all (it is just a 
system font, which is available by default on an MacOS 12.3 and cannot be 
deleted), which is detected during auto scanning by fop.
So I am not quite sure, if specifying the specific font will help with the 
original issue which occurs during auto-scanning.

Is there a configuration option to exclude fonts from being scanned?

*The good news:*

I was able to reproduce it on my Ubuntu 20.04 LTS machine by adjusting your 
code snippet (without our complicated EAR / EE setup). Started the code with 
*-ea* via JVM params. Note: I used Java 17 text blocks for simplicity of XML 
config snippet.

Note: I installed the *SFArabic.ttf* system-wide and re-generated the Ubuntu 
font cache. 

 
{code:java}
import org.apache.fop.apps.FOUserAgent;
import org.apache.fop.apps.Fop;
import org.apache.fop.apps.FopConfParser;
import org.apache.fop.apps.FopFactory;
import org.apache.fop.apps.FopFactoryBuilder;
import javax.xml.transform.Result;
import javax.xml.transform.Source;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.sax.SAXResult;
import javax.xml.transform.stream.StreamSource;
import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.FileOutputStream;
public class ComplexScript {
    public static void main(String[] args) throws Exception {
        String fo = "http://www.w3.org/1999/XSL/Format\"\n; 
+
                "  
xmlns:fox=\"http://xmlgraphics.apache.org/fop/extensions\;>\n" +
                "  \n" +
                "    \n" +
                "      \n" +
                "    \n" +
                "  \n" +
                "  \n" +
                "    \n" +
                " test2  \n" +
                "\n" +
                "  \n" +
                "\n";
        String fopxconf = """
                http://www.w3.org/2001/XMLSchema-instance;
                     
xsi:noNamespaceSchemaLocation="http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/foschema/fop-configuration.xsd?view=co;>
                                
                    
                                
                            
                                
                                    
                            
                                null
                            
                            
                            
                                flate
                                ascii-85
                            
                                
                            
                                       
                               
                            
                                
                        
                    
                    
                      
                    
                \s
                """;
        FopFactoryBuilder builder =
                new FopConfParser(new 
ByteArrayInputStream(fopxconf.getBytes()), new 
File(".").toURI()).getFopFactoryBuilder();
        builder.setComplexScriptFeatures(false);
        FopFactory fopFactory = builder.build();
//disable the font cache on purpose to reproduce the issue
        fopFactory.getFontManager().disableFontCache();
        FOUserAgent foUserAgent = fopFactory.newFOUserAgent();
        FileOutputStream fos = new FileOutputStream("/tmp/out.pdf");
        Fop fop = fopFactory.newFop("application/pdf", foUserAgent, fos);
        TransformerFactory factory = 

[jira] [Comment Edited] (FOP-3062) AssertionError in GlyphPositioningTable$DeviceTable with SFArabic.ttf

2022-04-08 Thread Richard Zowalla (Jira)


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

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

Thanks for updating the documentation as well as your time.

I tested the sample code: If I hard-code the path to SFArabic via  the font is loaded and used (at least no exception / assertion error 
is thrown)
{code:java}
Apr. 08, 2022 6:47:05 PM org.apache.fop.fo.properties.CommonHyphenation 
getHyphChar
WARNUNG: Substituted specified hyphenation character (0x2d) with 0x20 because 
the font doesn't have the specified hyphenation character: SFArabic,normal,400
Apr. 08, 2022 6:47:05 PM org.apache.fop.events.LoggingEventListener processEvent
WARNUNG: Glyph "t" (0x74, t) not available in font ".SFArabic-Regular".
Apr. 08, 2022 6:47:05 PM org.apache.fop.events.LoggingEventListener processEvent
WARNUNG: Glyph "e" (0x65, e) not available in font ".SFArabic-Regular".
Apr. 08, 2022 6:47:05 PM org.apache.fop.events.LoggingEventListener processEvent
WARNUNG: Glyph "s" (0x73, s) not available in font ".SFArabic-Regular".
Apr. 08, 2022 6:47:05 PM org.apache.fop.events.LoggingEventListener processEvent
WARNUNG: Glyph "2" (0x32, two) not available in font ".SFArabic-Regular".
Apr. 08, 2022 6:47:05 PM org.apache.fop.events.LoggingEventListener processEvent
INFORMATION: Rendered page #1.{code}
My issue is, that I do +*not*+ want to use *SFArabic* at all (it is just a 
system font, which is available by default on an MacOS 12.3 and cannot be 
deleted), which is detected during auto scanning by fop.
So I am not quite sure, if specifying the specific font will help with the 
original issue which occurs during auto-scanning.

Is there a configuration option to exclude fonts from being scanned?

The good news: I was able to reproduce it on my Ubuntu 20.04 LTS machine by 
adjusting your code snippet as follows. 

Note: I installed the *SFArabic.ttf* system-wide and re-generated the Ubuntu 
font cache.

 

 
{code:java}
import org.apache.fop.apps.FOUserAgent;
import org.apache.fop.apps.Fop;
import org.apache.fop.apps.FopConfParser;
import org.apache.fop.apps.FopFactory;
import org.apache.fop.apps.FopFactoryBuilder;
import javax.xml.transform.Result;
import javax.xml.transform.Source;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.sax.SAXResult;
import javax.xml.transform.stream.StreamSource;
import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.FileOutputStream;
public class ComplexScript {
    public static void main(String[] args) throws Exception {
        String fo = "http://www.w3.org/1999/XSL/Format\"\n; 
+
                "  
xmlns:fox=\"http://xmlgraphics.apache.org/fop/extensions\;>\n" +
                "  \n" +
                "    \n" +
                "      \n" +
                "    \n" +
                "  \n" +
                "  \n" +
                "    \n" +
                " test2  \n" +
                "\n" +
                "  \n" +
                "\n";
        String fopxconf = """
                http://www.w3.org/2001/XMLSchema-instance;
                     
xsi:noNamespaceSchemaLocation="http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/foschema/fop-configuration.xsd?view=co;>
                                
                    
                                
                            
                                
                                    
                            
                                null
                            
                            
                            
                                flate
                                ascii-85
                            
                                
                            
                                       
                               
                            
                                
                        
                    
                    
                      
                    
                \s
                """;
        FopFactoryBuilder builder =
                new FopConfParser(new 
ByteArrayInputStream(fopxconf.getBytes()), new 
File(".").toURI()).getFopFactoryBuilder();
        builder.setComplexScriptFeatures(false);
        FopFactory fopFactory = builder.build();
//disable the font cache on purpose to reproduce the issue
        fopFactory.getFontManager().disableFontCache();
        FOUserAgent foUserAgent = fopFactory.newFOUserAgent();
        FileOutputStream fos = new FileOutputStream("/tmp/out.pdf");
        Fop fop = fopFactory.newFop("application/pdf", foUserAgent, fos);
        TransformerFactory factory = TransformerFactory.newInstance();
        Transformer transformer = factory.newTransformer();
        Source src = new StreamSource(new 

[jira] [Comment Edited] (FOP-3062) AssertionError in GlyphPositioningTable$DeviceTable with SFArabic.ttf

2022-04-08 Thread Richard Zowalla (Jira)


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

Richard Zowalla edited comment on FOP-3062 at 4/8/22 9:29 AM:
--

>From a Mac OS 12.3: [^SFArabic.ttf]


Or: https://developer.apple.com/fonts/


was (Author: rzo1):
>From a Mac OS 12.3: [^SFArabic.ttf]

> 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
>
>
> 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}
> http://www.w3.org/2001/XMLSchema-instance;
>  
> xsi:noNamespaceSchemaLocation="http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/foschema/fop-configuration.xsd?view=co;>
> 
> 
> 
> 
> null
> 
> 
> 
> flate
> ascii-85
> 
> 
> 
> /Users/abc/uploads/fonts
> 
> 
> 
> 
> 
> /Users/abc/uploads/fonts
> 
>  {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.(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.(RenderPagesModel.java:75) at 
> 

[jira] [Comment Edited] (FOP-3062) AssertionError in GlyphPositioningTable$DeviceTable with SFArabic.ttf

2022-04-08 Thread Simon Steiner (Jira)


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

Simon Steiner edited comment on FOP-3062 at 4/8/22 9:25 AM:


Can you give download url of font file


was (Author: ssteiner1):
Can you give url of font file

> 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
>
> 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}
> http://www.w3.org/2001/XMLSchema-instance;
>  
> xsi:noNamespaceSchemaLocation="http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/foschema/fop-configuration.xsd?view=co;>
> 
> 
> 
> 
> null
> 
> 
> 
> flate
> ascii-85
> 
> 
> 
> /Users/abc/uploads/fonts
> 
> 
> 
> 
> 
> /Users/abc/uploads/fonts
> 
>  {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.(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.(RenderPagesModel.java:75) at 
> org.apache.fop.area.AreaTreeHandler.setupModel(AreaTreeHandler.java:135) at 
> org.apache.fop.area.AreaTreeHandler.(AreaTreeHandler.java:105) at 
> 

[jira] [Comment Edited] (FOP-3062) AssertionError in GlyphPositioningTable$DeviceTable with SFArabic.ttf

2022-04-08 Thread Richard Zowalla (Jira)


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

Richard Zowalla edited comment on FOP-3062 at 4/8/22 9:24 AM:
--

This is a developer machine. We are starting TomEE Maven Plugin, which has 
Assertions enabled by default ;) (and it cannot be disabled easily...) but 
would also impact unit tests, which are using assertions.

I am even not capable of removing / moving this specific Apple system font 
away, so auto detection will always fail with this assertion error in a dev 
setup.


was (Author: rzo1):
This is a developer machine. We are starting TomEE Maven Plugin, which has 
Assertions enabled by default ;) (and it cannot be disabled easily...) but 
would also impact unit tests, which are using assertions.

> 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
>
> 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}
> http://www.w3.org/2001/XMLSchema-instance;
>  
> xsi:noNamespaceSchemaLocation="http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/foschema/fop-configuration.xsd?view=co;>
> 
> 
> 
> 
> null
> 
> 
> 
> flate
> ascii-85
> 
> 
> 
> /Users/abc/uploads/fonts
> 
> 
> 
> 
> 
> /Users/abc/uploads/fonts
> 
>  {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.(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 
>