Re: FOP issue with Cyrillic in Arial

Hussein Shafie <[email protected]> Sun, 18 Aug 2024 10:21:36 +0200
Newsgroups gmane.editors.xxe.general
Message-ID <[email protected]>
On 8/18/24 00:37, Leif Halvard Silli wrote:
> I try to use DITA for a work in Russian. I am using MacOS Sonoma 14.5 on 
> M1 MacBook.
> 
> Problem: The chapter titles/headings contains Cyrillic. But, when 
> converting to PDF using the built in converter in XMLmind, the Cyrillic 
> is output as #####.

That's right and this is a FAQ.

"When I convert documents written in Russian (or Polish or Czech or any 
non-western language) to PDF, almost all characters are replaced by the 
"#" character. Is there a workaround for this problem?"

See https://www.xmlmind.com/xmleditor/faq.html#custom_pdf_fonts




> 
> When I investigate the PDF output, it seems to be the case that 
> 'ArialMT' (also known as just 'Arial') is used for the headings.

Without any specific configuration, Apache FOP is free to use any 
default sans-serif font it wants, provided it works in the generated PDF.

RenderX XEP does the same.




> 
> I get the same result if I create a HTML page with Cyrillic text and set 
> the font to Arial.
> 
> I think the problem somehow must be with the FOP converter. The problem 
> could also be with the Arial fonts. However, whenever I use Arial in a 
> regular word processor, the Arial clearly **does** contain Cyrillic 
> glyphs. Hence I am tempted to think that it is not the font.

Sorry no clue about this.




> 
> Workaround:
> 
> Inside the FOP settings, for the fonts Arial.ttf, Arial Bold.ttf, Arial 
> Italic.ttf and Arial Bold Italic.ttf, I made sure to define aliases. 
> Thus for 'Arial Bold.ttf' I defined 'sans-serif' 'bold' as an alias. 
> Having done that, I stopped getting '####' substitutes for the Cyrillic 
> letters.

Indeed.

Defining sans-serif, serif, monospace, etc, aliases is *really* *needed* 
as the XSLT stylesheets almost always generate XSL-FO referring to 
generic font families (like "sans-serif bold") and not to actual font 
families (like "Arial Bold").

This font alias step is explained in "Apache FOP options", "Procedure 
9.2. How to choose specific fonts (for example, you want to replace 
Times fonts by Georgia fonts)", 
https://www.xmlmind.com/xmleditor/_distrib/doc/help/addonOptions.html#d0e14951




> 
> However, when I inspected the used font in the PDF out, I noticed that a 
> new font, namely 'ArialUnicodeMS', had been embedded into the PDF.
> 
> Thus, it seems that, for some reason, FOP thinks that 'Arial Bold.ttf' 
> does not contain Cyrillic characters.
> 

Sorry again no clue about this.

On my Linux box, when I map "Arial Bold" to "sans-serif bold", its 
Arial-BoldMT which is embedded in the PDF. See attached screenshots.


--
XMLmind XML Editor Support List
[email protected]
http://www.xmlmind.com/mailman/listinfo/xmleditor-support
ArialBold.png (image/png, 39.2 KB) - not displayed
EmbeddedArialBoldMT.png (image/png, 107 KB) - not displayed