Porting Arabic font to iOS System - ios

I am just looking to get a better look for my iPad using custom font.
The default Arabic font for iOS8 devices is GeezaPro. and it's in .ttc format.
I am trying to replace it with my custom font.
I use DOSBOX to break system font ttc file into ttf files to make them editable.
Then i use FontLab Studio to replace system font glyphs with my custom font glyphs.
I just copy the glyph from custom font and paste them in the system font (using special paste option FontLab provide).
Then i use DOSBOX again to join these ttf files into ttc file.
That's worked for custom English fonts i used. but using it with arabic fonts show some issues.
The text letters appear separated in iOS apps and everywhere.(as you already know that Arabic language use joined letters and sometimes separated letters depending on the context. if the letter is the first letter it will use specific glyph, the same goes if the letter is in the middle or in the end using different glyph. while in English all letters are always remain separated no matter what. except for handwritten scripts.)
any idea how to fix?
some links:
tutorial I followed to port my fonts
the arabic font I am trying to accomplish (it's free and legit)
P.S: some may say use Bytafont library of fonts but i want to use this specific font. and arabic fonts also limited in the library (20 font only available).

Fonts are complex programs that run on embedded hardware interpreters and font engines (the same way game ROMs run on game hardware or in emulators), and don't just contain the pictures for each letter, but also all the instructions on how to position, combine, and substitute those letters based on what sequence of input it's being told to process.
For almost every font, just copying the glyph outlines is not enough, you also need to make sure that:
the original font's glyph ordering is preserved,
the GPOS table gets copied over (which determines mark positioning, kerning, etc), and
the GSUB table gets copied over (which handles glyph substitution, without which you can't even write Arabic. As an example, you need ـب, ـبـ, بـ or ب depending on context for the same "letter" bā’)
So you generally want to unpack the TTC (which as of OpenType 1.7 can be either truetype or postscript/type2, so that's a thing to remember for the future), then perform the replacements of glyphs (with order-preservation), as well as replacing the GPOS and GSUB tables (using FontForge or TTX) and then pack it back up into the TTC.

Related

Multiple fonts on a single line of an eps file?

I'm trying to manipulate and modify a large number of eps files output by a web service. I have the code in python to interface with the server, and to edit the images to within about 99% of where I want them.
My issue deals with trying to display special characters. I've tried outputting the desired unicode character, Ψ, directly into the eps file, but this is displayed as different characters in both Preview for Mac and Adobe Illustrator. From some googling, it seems like eps doesn't accept unicode characters. Fair enough...
My current solution is to try to change the font in the eps files. This works when I want to display the Ψ as a single character. I just switch the font, and then switch back. As below:
/Symbol findfont 10.5 scalefont setfont
-9.1 36.1557 moveto (Y) show
/Helvetica-Bold findfont 10.5 scalefont setfont
Where I'm having a problem is when I want to display a title on each image. The title would include a mix of Helvetica-Light and Symbol fonts, I would want it to display as ABC1-Ψ123. I can't figure out how to switch the font of a single character within a larger block of text. Currently the eps files are written as shown:
/Helvetica-Light findfont 12 scalefont setfont
-43.093 304.224 moveto (ABC1-Y123) show
I'd appreciate any help.

MathJax overarrow too short

I am trying to place an overarrow over a piece of text in MathJax.
I am using a custom font that I declare in the code-
\(\overrightarrow{\style{font-family: mysans, TeX, Arial, sans-serif;}{\text{" + tString + "}}}\)"
It works ok for most letters- for capital W or M , using a couple in a row like "WWW" the overbar is too short.
For lowercase i , using a couple in a row, ie "iii" it is too long. My hunch is that MathJax is using a standard character width size to figure out the length of the overarrow and when the character is much longer or shorter than that size, it calculates the overarrow incorrectly. Is there any way around this?
Thanks!
First off, you generally cannot use custom fonts with MathJax. As the documentation says
Since browsers do not provide APIs to access font metrics, MathJax has to ship with the necessary font data; this font data is generated during development and cannot be generated on the fly. In addition, most fonts do not cover the relevant characters for mathematical layout. Finally, some fonts (e.g. Cambria Math) store important glyphs outside the Unicode range, making them inaccessible to JavaScript.
However, if you are only looking to use custom fonts in text elements, then there is a way to work around this: style the surrounding context and set mtextFontInherit:true for the output jax, cf. e.g. here for HTML-CSS.
Unfortunately, this won't actually help you right now. There's a minor regression in MathJax 2.5 (see this discussion leading to the result you describe). This will be fixed in 2.5.1 and in the mean time you could set noReflows:false for the HTML-CSS output.

Why the display of Unicode characters for superscripted digits are not at the same height?

Why the display of Unicodes for superscripts of digits are not at the same height? This is specially noticeable if you make two digit numbers out of the superscript digits. Some of them look fine but the rest look out of the place with respect to each other. Am I missing something? Or is this how it is?
Like jrturton mentions, ¹, ² and ³ were from a legacy character set (Latin 1) and therefore included in a different place. This also means that lots of fonts don't have support for more superscript numbers, as many only strive for Latin, Greek and Cyrillic with a few punctuation symbols thrown in. So the remaining ones are taken from a different font over which you as an author have little to no control.
As an example:
Those are the superscript numerals from 1 to 9 and 0. The run of text was formatted in Arial in Word. You see what happened to the rest of them. Contrary to what jrturton believes, there is no reshaping of existing glyphs involved. This is just font substitution.
The out of place ones (1,2 and 3) were added before the rest (see wikipedia: http://en.wikipedia.org/wiki/Unicode_superscripts_and_subscripts), and are from a different unicode block. That doesn't explain why they look different but it may be that those ones are actual characters in most fonts, and the remaining ones are just adjusted versions of the standard glyphs.
This appears to be how it is and you are right, it looks terrible when you are trying to make multi digit superscript numbers. I don't know if it applies to all fonts but it is very noticeable on the iOS system font.
If anyone has a way to make this work, I will put a bounty up on this question.
UPDATE
I knocked up a little program to cycle through all fonts on the phone and display the superscript numerals from 0 to 9. The following fonts had a consistent appearance across all digits:
Zapfino
Courier-Bold
AmericanTypewriter (also -Bold)
HiraKakuProN-W6 (also -W3)
Noteworthy-Bold (also -Light)

How to display Greek symbols in a TMenuOption

In Delphi 2010, I want to display the Greek symbols (alpha, beta, etc.) in TMenuOption and other types of VCL controls.
Assigning
TEdit.Text or TMenuItem.Caption := 'Hydrogen ' + chr(945) + ' More Text'
seems to work fine.
I'm worried that this might won't work on all machines. TEdit has a font property, TMenuItem doesn't, so I'm guessing it uses some default system font.
Should chr(945) always show as the Greek alpha character regardless of font? If not, is there some way for me to assure that the chr(945) always appears on the screen as the alpha character other than hard-wiring the font (which would be tough to do for the system font...)
TIA
You can also use constants. The source files are unicode too so you can add any kind of constant. Just remember to save the source as unicode.
const
alpha = 'α';
beta = 'β';
gamma = 'γ';
Since Delphi 2010 is unicode, chr(945) always point to the same character, in this case Greek Alpha. This character will display correctly if the font that is used to draw the menu item contains that character. There is no risk of another character being drawn, except maybe for the question mark, which is usually used by Windows if a font doesn't contain a specific character.
Most Windows fonts do contain common unicode characters (including Greek). The user might however be able to select a different font that doesn't. You can draw the menu yourself using a different font that is installed on the system, but this might be an awful lot of work for something that will normally work out of the box.

Font wont export out

I can get sIFR to work but it will only display the bold version of the font I have exported. I checked the report and it seems to be stripping out any font weight that is not bolded in flash. I exported two different files to test, the first with regular and bold and the second with medium and semibold in both cases only the bolded weights were exported. Any ideas on how to fix this?
When exporting the Flash movie, make sure at least one character in the text field has the styles applied to it. Then it should export fine.
I had a similar problem - could not make the font 'bold' style work, and I even whanted my fonts BlackItalic to work. Messing around and reading your post and Marks answer made me try to apply the BlackItalic style to the very first word in the provided fla file. Keeping the css style 'font-weight: normal;' in the config java code was successful!
Until I read some new posts about this I will follow the work flow making individual swf files for every font style - normally I only want to use one or to styles anyway.

Resources