Change font direction of latin letters

Hello there, I really do hope that I am not repeating a closed case but I could not find anything similar. I am using the Schehrazade New font and replaced the glyphs of the latin letters with their arabic equivalent - as in when you type an “A” on the keyboard an arabic “ا” appears for “B” → “ب” and so on.

The originally latin letters which are now arabic do appear from left to right though, which is the issue I am trying to change. The original code line which I think dictates the direction of the letters is the following:

Lookup: 1 8 0 "'rtlm' Rechts nach links gespiegelte Formen Nachschlagetabelle 0" { "'rtlm' Rechts nach links gespiegelte Formen Nachschlagetabelle 0 Subtabelle" } ['rtlm' ('arab' <'KIR ' 'KUR ' 'RHG ' 'SND ' 'URD ' 'WLF ' 'dflt' > 'latn' <'dflt' > ) ]

I tried to change it several times to for example:

Lookup: 1 8 0 "'rtlm' Rechts nach links gespiegelte Formen Nachschlagetabelle 0" { "'rtlm' Rechts nach links gespiegelte Formen Nachschlagetabelle 0 Subtabelle" } ['rtlm' ('arab' <'KIR ' 'KUR ' 'RHG ' 'SND ' 'URD ' 'WLF ' 'dflt' 'latn' > ) ]

Or:

Lookup: 1 8 0 "'rtlm' Rechts nach links gespiegelte Formen Nachschlagetabelle 0" { "'rtlm' Rechts nach links gespiegelte Formen Nachschlagetabelle 0 Subtabelle" } ['rtlm' ('arab' 'dflt' 'latn' <'KIR ' 'KUR ' 'RHG ' 'SND ' 'URD ' 'WLF ' > ) ]

but unfortunately nothing seems to be working. I would appreciate your help on this very much!

Hello Mohamed, and welcome to the community. It sounds like what you need is to create a keyboard which outputs the correct Arabic script characters when you type the corresponding keys on the keyboard, and NOT to change the font by replacing glyphs. If you just replace glyphs in the font, then the programs that you use (Word, etc.) will think that the “A” character that you typed is LTR, even though the glyph it now displays is “ا” (Alif). The better route is to create a keyboard that when you type an “A”, it outputs the real Unicode “ا” (Alif), which is code U+0627. When your programs see that character, they know that it is an RTL character, so it will be displayed properly (if you have a decent font, have set the paragraph direction, etc.).

I’m impressed that you were able to replace glyphs in a font, so I will assume that you are quite competent technically, and will just give you a couple of links for you to do more research. The main information source you need is here: http://help.keyman.com/. You will need to use Keyman Developer to create a keyboard which has all of the characters mapped the way you want them. There is a tutorial here: Keyboard Tutorial. If you just want a one-to-one mapping of keys to output characters, you may be able to use the simple visual keyboard mapping. Otherwise you might need to write some “code” to specify what is output for each key combination. There are many open source keyboards that you can get ideas from here: GitHub - keymanapp/keyboards: Open Source Keyman keyboards.

With a well-designed keyboard created and installed, you should be able to type BAB and get “بلب”, with all the characters properly linked.

Hopefully that responds to your question, and gets you moving in the right direction.
Jeff

Keyman does have a repository of existing keyboards that are publicly available for download. You can go to keyman.com and search for Arabic. If you do that, you’ll see the keyboards listed for “Arabic”: Keyboard Search

If you click on one of these keyboards, for example, “Arabic Phonetic (SIL)” (Arabic Phonetic (SIL) keyboard), you’ll see a description of the keyboard. In that information, there should be a “Documentation” heading with a “Keyboard help” link. If you click on that link, it should show you the documentation, which usually includes a keyboard layout.

If you find a keyboard that suits your needs, you can download and use it with Keyman. If none fits your needs, you might still be able to find one that is close that you could use as a starting point for developing the keyboard you want.

Hi there @jheath and @drowe thanks for your answers that was very helpful - that Arabic Phonetic Keyboard is basically exactly what I need - typing in an english “A” and “B” and getting the respective Arabic letters “Alif” and “Ba” RTL - but and here is why I wanted to go for creating a font - I need to integrate that feature on a website so that everybody who lands on that website and does not have that Keyman Keyboard installed can type in “A” and “B” on his standard english keyboard and get the respective Arabic letters “Alif” and “Ba” RTL as an output. I have a Plugin on that website allowing me only to upload a font for this option. What do you think could be suitable solution here?

I basically need to somehow (not sure if this even makes sense or is possible) extract a .ttf file from the Arabic Phonetic Keyboard.

Thanks in advance

Sorry, that doesn’t make sense and it isn’t possible… :slight_smile:
Keyboards are only a means of producing Unicode characters (entering Unicode code points into a field or document). The choice of font is what turns those code points into some graphic representation on the screen. So keyboards don’t have any font (.ttf file) associated with them. It’s up to the user to select the appropriate font for the code points that the keyboard generates.

What it sounds like you need is KeymanWeb. I don’t really have much experience with it myself, but if you go to this web page:
https://keymanweb.com/?tier=stable#ar,Keyboard_sil_arabic_phonetic
you can see that it is possible to embed the “Arabic Phonetic (SIL)” keyboard directly into a web page, so that the web page user can type using the desired keyboard.

This web page:
https://keyman.com/developer/keymanweb/
Gives detailed instructions how “with just a few lines of code” a Keyman keyboard can be integrated into your website. Give it a try and let us know how it goes.