Reputation: 69
I have an app which must convert strings out of rtf files to be rendered in pdf. I have a problem with Simplified Arabic Bold, it works in Windows 7, but fails in Windows 10 or W.Srv 2012.
A very simple word in Arabic: غ، دهو
I select the "simplified Arabic" font as returned by GDI+ ToNative() method. ScriptShape return the correct glyph Ids in Win7, but in Win10 the glyphIds returned are not in the CMAP table. For instance GlyphId 678 cannot be found, so i cannot add the character in the rendering of the PDF.
A more detailed explanation:
Here is the RTF reduced to the minimal expression to reproduce the problem:
{\rtf1\fbidis\ansi\ansicpg1252\deff0\nouicompat\deflang1033
{\fonttbl{\f0\froman\fprq2\fcharset178 Simplified Arabic;}{\f1\fnil Source Sans Pro;}}
\pard\ltrpar\cf1\b\f0\rtlch\fs32\lang1025\'db\'a1 \'cf\'e5\'e6 \cf0\b0\f1\ltrch\fs18\lang1033\par
}
In order to generate the atoms for PDF, I first get the System.Drawing.Font("Simplified Arabic", 16, bold).
Then I call GetFontData(hDC, 0,0, buffer, length)
and get the table TagGlyf data, constructing a dictionary <ushort, chart>
from the GlyphIdArray[] of the tableCMap.Win (i can provide my code if you need it)
Then i call
Uniscribe.ScriptItemize(text, text.Length, items.Length, ref scriptControl, ref scriptState, items, ref itemsCount);
After getting the items, i call Uniscribe.ScriptLayout()
to order the runs according to BiDi levels.
Then I select the Font in the current hDc and for each run call ScriptShape()
which return the GlyphIds of the runs.
Using the Win7 Simplified Arabic (even in Win10) i get the following glyphs: glyphs
{ushort[9]}
[0]: 3
[1]: 194
[2]: 395
[3]: 174
[4]: 3
[5]: 157
[6]: 185
and all are correctly matching a char that can i send to the PDF. However, when i replace and use the SimplifiedArabic Bold from W10 or WinSvr 2012, I get
glyphs {
ushort[9]}
[0]: 3
**[1]: 678**
[2]: 395
[3]: 174
[4]: 3
[5]: 157
[6]: 185
[7]: 0
[8]: 0
You can see that the glyphs[1] in Win10 font is 678, but I cant find that Id in my dictionary from the CMap Table.
If I manually set the glyphs[1] to 194, it works ok rendering the correct character. So I don't know why ScriptShape gets confused about which GlyphId use with the new font.
(Of course if i install manually the old Win7 font in the Win10 box, it works perfectly)
Any suggestions?
thanks. df
Upvotes: 1
Views: 167