Arabic font breaks on iOS app - ios

We are working in iOS app and we are using "Adobe Arabic" and "Tahoma" font.
Both fonts in some area break. For example
Tahoma breaks by adding space between in a single word as shown in image below
Not sure why this is happening for some works. We have similar issue for Adobe Arabic for some Arabic text
Mostly font breaks when using verses from quran "بِسْمِ اللَّـهِ الرَّحْمَنِ الرَّحِيمِ" otherwise it is fine... That is when ever we add tajweed font break by adding space.
What could be the possible reason for this

As I see, its failing to render diacritics. Diacritics should be merged to their previous letters in Arabic. In your example, it breaks with the Shada diacritic ّ :
It happens mostly in Quranic verses because they are fully vocalized compared to normal texts.
A solution is to normalize your texts and strip diacritics. The list of diacritcs is:
// Diacritics
'0x64b' // FatHatan
'0x64c' // Dammatan
'0x64d' // Kasratan
'0x64e' // FatHa
'0x64f' // Damma
'0x650' // Kasra
'0x652' // Sukun
'0x651' // Shadda
The normalization is recommended for normal text but not Quran verses since its considered as a holy text and recommended to be written as fully vocalized Uthmani script. You may use pre-rendered images.
A deep solution is to use a rendering engine like harfbuzz. It renders Arabic perfectly.

Try this line in css:
.element {
letter-spacing: -1px;
}
It works with me.

Try these in your css
font-family: "Traditional Arabic", "Montserrat","sans-serif","Times New Roman";

Related

How to replace all native emojis with beautiful ones like apple's in the Electronic app?

In a regular web browser there are such naive emojis as in the photo:
My app runs on Electron and the emojis look exactly like this there. How can this be changed in favor of apple emoji? I can't use emojione and search everywhere for these emojis because there are hundreds of places in my application where users write these emojis themselves and I can't physically search everywhere for these emojis
The "right" solution is to use a font that provides Emojis you think fit your app best, but doesn't include any text so you can use your default font for text. Mind that you cannot just "use" Apple's Emojis because that would bring copyright implications for platforms that don't ship with them (i.e., Windows and Linux).
Thus, I recommend to search for an Emoji font you can redistribute with your application (with proper credit if needed by the font's licence).
If your current font chain is, for example:
* { font-family: "Roboto", "Arial", sans-serif; }
You could just go ahead, load your Emoji font (by using #font-face, for example) and prepend it to your font chain. If that font is loaded using the alias "my-emoji-font", then this would look like:
* { font-family: "my-emoji-font", "Roboto", "Arial", sans-serif; }
However, you will have to make sure that the Emoji font does not include any non-Emoji symbols, as these would then also be taken from the Emoji font. Also, this will replace Emojis for any text in your application (thus the * as the CSS selector; you could of course write a CSS rule for specific elements as usual, but bear in mind that you'll have to copy the font chain).
If your Emoji font should lack any Emoji that is used by your application, Electron will display the corresponding Emoji from Roboto, Arial (in this example) or the system's sans-serif font if it's available there.

MathJax Font Size

In MathJax, I am able to adjust the font size using the answer here (i.e. shown below). Is there a way to adjust the font size of the normal text too without dollar signs around it too? For example, when I type the following: Let $f(x)=x^2$.
The text size around the word "Let" would be small and $f(x)=x^2$ would be much larger. I want to scale the text of the words as well, and I am not sure how to do so.
chtml: {scale: 1.5},
svg: {scale: 1.5},
In regular Latex, you could do Let $f(x)=x^2$.
However remember that, as the name suggests, MathJax doesn't aim to make all of Latex available to the web but focuses on the math part of Latex (and also AsciiMath and MathML of course). A key thing to remember here is that MathJax actually uses the math delimiters to find where there are content to typeset and when you do Let $f(x)=x^2$, MathJax doesn't do anything about the Let since it is outside the math delimiters.
Nonetheless, there are ways to use regular text in Latex math mode too. For example by means of \text{} so in your case, you could accomplish what you want with $\text{Let } f(x)=x^2$
Now, simply setting the text size of the surrounding content will make all of the Latex bigger:
<p style="font-size: 1.5em;">$\text{Let } f(x)=x^2$</p>
<p style="font-size: 2.5em;">$\text{Let } f(x)=x^2$</p>
<p style="font-size: 5em;">$\text{Let } f(x)=x^2$</p>
If you want a bigger horizontal space between the math and the Let, you can add a horizontal spacer:
<p>$\text{Let}\hspace{2mm} f(x)=x^2$</p>
I have prepared a sandbox which you can play around with, also try to uncomment the scale part of the configuration to see this factor in play (however, I usually use font height and not scale to control size): Sandbox
Some things to remember:
Example uses MathJax 3, there might be small differences in comparison to version 2.
Example uses the HTML output processor (as in your example), if you load a different MathJax script, you might be outputting svgs instead and then some options won't have impact, so always check these things thoroughly when something doesn't work.
$...$ is not a standard pair of delimiters so it has to be explicitly configured, otherwise MathJax won't recognize it as inline Latex math.
MathJax automatically does one round of initial typesetting, if you want to update content dynamically, you have to explicitly instruct MathJax to typeset again.
Good luck!

Porting Arabic font to iOS System

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.

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.

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