Reputation: 2303
i created one form in html and i wrote CSS to text fields. I set font family ARIAL to text boxes. Now i need to set Arabic Font as default particular text boxes. Not in all text boxes.
i used the following code
@font-face {
font-family:'Traditional Arabic';
src: url('trado.ttf');
src: local('trado Regular'), local('trado'), url('trado.ttf') format('truetype');
}
input[type=text].firstnamearabic, input[type=text].secondnamearabic, input[type=text].familynamearabic {
border-bottom: 1px solid #000;
font-family:"Traditional Arabic" !important;
}
But, when i will typing, default english letters only coming. Arabic letters are not coming.
I am seeing different font style in that particular text boxes. But it not coming in ARABIC Caption.
Upvotes: 1
Views: 596
Reputation: 2255
the css format the output, not the input.
To write in Arabic alphabet or whatever alphabet in a webpage or whatever software you need your keyboard set for utf-8 Arabic output.
don't use fonts that convert latin alphabet; those are clumsy and not reliable if your users type in Arabic the chances are real high (99%) that their OS is set with Arabic keyboard input & therefore the font used in css absolutely does not matter (i believe Arial is safe for use for any utf-8 alphabet input)
So basically what you need is your html & your db to be set to receive utf-8 so that whatever the user input it will be recorded as such by your app.
Although since Arabic is right to left I think, you also need to set text-direction accordingly for your input. However i do not not know how you can detect whether the user is inputing in Arabic/latin (that is if you want the flexibility to allow user any of the two)
NB: if you're inputting with your keyboard set for Arabic, then do remove the Arabic font from css, if you had, then add the text-direction correct, if you had then well sorry for not appropriate answer!
Upvotes: 1
Reputation: 201538
Setting font family is not supposed to change the identity of characters or keyboard functionality. An “A” is still an A, a Latin letter, independently of font. So everything should work as it does when using Arial, just with different style for letters (Latin and Arabic). This is what seems to happen.
You can e.g. select an Arabic keyboard layout in Windows, and then the keys will produce Arabic letters – quite independently of font settings.
Normally, it is best to use the same font for texts in different languages, especially if the texts appear as comparable like here. Since Arial covers Arabic letters too, it is a good start.
Upvotes: 0