Frage

I have a web application with embedded fonts. There is a small problem. Language of my web application is Persian and English but all numbers in the web page are shown in Persian even the numbers in the English content. This is the screenshot of web application.

Web application in English Web application in Persian

Is there any way to show numbers like Microsoft Word (use Persian numbers in Persian text and English numbers in English text)?

War es hilfreich?

Lösung

Technically, you could put both common European digits 0, 1, 2… and Arabic digits ٠‎‎, ١‎‎‎, ٢‎‎, … as alternative glyphs for the characters U+0030 DIGIT ZERO, U+0031 DIGIT ONE, U+0032 DIGIT TWO, etc.,into the same font, using OpenType features, and you could use CSS tools for selecting between (though this is not yet supported by all browsers). But then you would need to be a font designer, or at least know how to edit a font.

The normal way, however, is to treat European digits and Arabic digits as distinct characters, i.e. make the difference at the character level. So the code that generates the calendar should take care of the issue. And then you just need a font that has both sets of digits, properly assigned to the separate characters.

Andere Tipps

Its quite easy if you use lang attribute inside the parent div of your calendar:

<div lang="en" style="font-family:Tahoma"> <!--Calendar code here --> </div>

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top