Why I get squares instead of text?
Asked Answered
B

1

7

I tried to install and use a font in my WPF application, but all I get is like this: enter image description here

Here is the code I tried to use the font:

richtext1.FontFamily = "SH_Roq'a";

The expected result is: ( snap shot from MS Word ) enter image description here

If I try to add the font file to the project folder, and use it as a resource, like this:

richtext1.FontFamily = "./#SH_Roq'a";

I won't get the square results, but, I won't have the expected font either! What I get is Tahoma font:

enter image description here

which is not the targeted font, please download the targeted font file here for experiments

Any help is appreciated!

EDIT

The plain text for the above captured text is:

تفاح احمر

So for those who are experts with using fonts, they can experiment with.

Balzac answered 12/6, 2012 at 14:27 Comment(7)
Is the word version bolded? The font looks very similar. If you view the .ttf of your font, does it contain the specified characters?Conakry
My personal impression is that the word version could hardly look more different from the current WPF result (miters instead of square caps, a calligraphic pen rather than a fixed stroke width etc.), but could the OP please write the text in plain text in his question, too? This would give those of us who know about fonts, Unicode and related issues but don't know how to write Arabic a chance to exactly reproduce what you're seeing.Rackrent
My guess is that the font renderer in Word is able to follow kerning hints in the font file that the renderer in WPF can not do. Have you seen the font used correctly in the browser?Pasteurize
A reach but see if FlowDocumentViewer will display it correctly. You will need to pack the text in a FlowDocument.Savonarola
:Tejs => {the word document is not bolded, the result we get is tahoma font instead of the targeted font, or just squares like above}Balzac
:O. R. Mapper => {no its different, its another font, as for the plain text of my question, please see edit above }Balzac
:antlesoft => {How would I see the font used correctly in the browser ?}Balzac
W
3

There are several problems with the font:

  1. it is not Unicode-encoded: it uses a Platform ID 3, Encoding ID 0 cmap subtable, also known as a "Symbol" table. These do not generally work well outside of old-style Windows desktop applications.

  2. there are no OpenType Layout features (GSUB, GPOS, etc.) which are essential for correct shaping (initial, medial, final, isolated forms; lam-alef ligatures, etc.) of Arabic/Urdu/Farsi writing.

  3. it uses a very, very old OS/2 table (version 0). Some Microsoft technologies require version 1 at minimum. There are also reserved bits set in the fsSelection field of this table and a number of other suspect settings.

I stopped looking there. This font appears to have been built with very old tools, using outdated knowledge of font construction. It needs significant updating in order to work correctly in modern environments.

Weingarten answered 14/6, 2012 at 14:25 Comment(2)
Thanks very much for detailed answer, can you please tell us if there is a tool that we can use to polish such an old font ? a tool that will migrate the font file to work in modern environments ?Balzac
There are some font tools around (for example FontForge), but a tool alone is probably not going to help you much. The font needs the attention of someone who understands this writing system as well as has knowledge of modern font creation/editing/development.Weingarten

© 2022 - 2024 — McMap. All rights reserved.