Amiri seems like a pretty nice font for Arabic, because it
has bold/italic support, neither of which are really common in Arabic fonts or usual in Arabic writing, but make it simpler for us (we would have only used the bold support, because the Arabic italics run the opposite direction of the Western ones which can look odd when mixed)
includes Western letters from the Crimson font
For whatever reason, however, FOP will not work correctly with Amiri, and produces ligature-free Arabic content (i.e. letters are not joined and instead have gaps between them). This sort of output cannot be used.
Using e.g. Droid Arabic Naskh, documents get proper ligatures (letters are joined and the gaps are between words). However, Droid Arabic Naskh does not include Latin letters.
This could be worked around with the a font-family setting like font-family="'Arabic Font', 'Latin Font'". But then FOP creates output that looks like this:
Arabic text
Latin text that should be on the same line
Not helpful.
Wrapping all Latin letters, Western numbers and punctuation in <fo:inline font-family="'Latin Font'"/> seems to work around this issue. However, from my limited testing, it seems to create line breaks in unexpected places. (Will need to check again.)
Doing this may actually be feasible... given the fact that we only need to replace [a-zA-Z0-9], maybe [äöüßÄÖÜ] and punctuation [.,-=] etc.
Another avenue might be Droid Naskh Shift Alt which combines a Naskh (=Arabic ~serif) typeface with a Western sans-serif (Droid Sans). If this font proves to be available enough, it might just be the way to go. However, like most Arabic fonts, it does not offer bold/italic versions.
Testing...
A very simple FO document containing some Arabic text:
<?xml version="1.0"?>
<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format" font-family="'Droid Naskh Shift Alt', serif" direction="left" line-height="1.3em" text-align="right">
<fo:layout-master-set>
<fo:simple-page-master master-name="A4-portrait"
page-height="29.7cm" page-width="21.0cm" margin="2cm">
<fo:region-body/>
</fo:simple-page-master>
</fo:layout-master-set>
<fo:page-sequence master-reference="A4-portrait">
<fo:flow flow-name="xsl-region-body">
<fo:block script="arab">
البداية السريعة للتثبي
SUSE Linux Enterpriseبنجاح في مركز عملاء SUSE, فسيُطلب منك تثبيت آخر التحديثات المتوفرة على الإنترنت أثناء التثبيت. في حالة تحديد نعم، سيتم تثبيت النظام بأحدث الحزم دون الحاجة لتطبيق التحديثات بعد التثبيت. يُوصى بتنشيط هذا الخيار.الالعثور على الأنظمة الأخرى المثبتة. إذا تعذر تكوين الشبكة تلقائيًا عند بدء نظام التثبيت، يظهر حواربداية السريعة للتثبييعرض متطلباتالنظام ويرشدك خطوة بخطوة خلال تثبيت
</fo:block>
</fo:flow>
</fo:page-sequence>
</fo:root>
Use fop input.fo output.pdf to transform. No other options necessary.
Amiri seems like a pretty nice font for Arabic, because it
For whatever reason, however, FOP will not work correctly with Amiri, and produces ligature-free Arabic content (i.e. letters are not joined and instead have gaps between them). This sort of output cannot be used.
Using e.g. Droid Arabic Naskh, documents get proper ligatures (letters are joined and the gaps are between words). However, Droid Arabic Naskh does not include Latin letters.
This could be worked around with the a font-family setting like
font-family="'Arabic Font', 'Latin Font'"
. But then FOP creates output that looks like this:Not helpful.
Wrapping all Latin letters, Western numbers and punctuation in
<fo:inline font-family="'Latin Font'"/>
seems to work around this issue. However, from my limited testing, it seems to create line breaks in unexpected places. (Will need to check again.) Doing this may actually be feasible... given the fact that we only need to replace [a-zA-Z0-9], maybe [äöüßÄÖÜ] and punctuation [.,-=] etc.Another avenue might be Droid Naskh Shift Alt which combines a Naskh (=Arabic ~serif) typeface with a Western sans-serif (Droid Sans). If this font proves to be available enough, it might just be the way to go. However, like most Arabic fonts, it does not offer bold/italic versions.
Testing...
A very simple FO document containing some Arabic text:
Use
fop input.fo output.pdf
to transform. No other options necessary.