Julow / Unexpected-Keyboard

A lightweight virtual keyboard for developers.
GNU General Public License v3.0
1.25k stars 167 forks source link

Central kurdish layout design bugs #541

Open anaskaejdar opened 4 months ago

anaskaejdar commented 4 months ago

Firstly, there is no period, nor colon.

Secondly, the key for ـہ types a keshideh (ـ) in front of the letter automatically, which seems like it'd pretty much never be the desired behaviour. Look what happens if you type three in a row: ـہـہـہ ... as opposed to what it should look like ہہہ

Thirdly, dotless-qaf (ٯ) is on the keyboard by default. I don't know what is the purpose of this letter, but maybe the intent was dotless-feh (ڡ) instead, as they look similar, and dotless-feh would actually make sense: it is an optional member of the kurdish sorani alphabet— one which I'd rather have than not. But if dotless-feh is included, dotless-beh (ٮ) and this other waw variants— ۊ ۉ — should be included also for the same reason.

Fourthly, alef with standard hamzeh above (أ) is on the keyboard, but this letter is arabic and not kurdish. If such a thing is included, it should rather be the persian long initial alef (آ), as other letters seem to have been included for reasonable compatibility with persian (ط ص ض ظ ث ذ)

Fifthly, it makes sense that the two ھ symbols would be switched: that ھ (ھھھ) would be the default and ه (ههه) would be the alternate: Screenshot_۲۰۲۴۰۲۰۳_۰۹۴۵۵۰_Brave - Nightly

So these problems, except for the second and fifth ones, can be solved easily through user customization (because this keyboard is most rad in all the land). But of course, it would be best for these changes to occur upstream, because if I add these as custom letters, they also appear on my latin keyboard layout, and that's pretty messy.

Julow commented 4 months ago

The Kurdish (کوردی) layout was made by @GoRaN909 in https://github.com/Julow/Unexpected-Keyboard/pull/353, https://github.com/Julow/Unexpected-Keyboard/pull/407

@GoRaN909 Are you using this layout often ? Is it possible that you are both using slightly different dialects ?

Adding a new layout might be a good solution, if they can be given different names.

anaskaejdar commented 4 months ago

@Julow Certainly! A person could certainly use this keyboard to type central kurdish without issue. I would not be surprised to hear that @GoRaN909 has been happily using this for a very long time. I mean the fact that there is no period symbol nor colon would present a difficulty, but not a serious difficulty, considering you can go into the symbol keyboard and find those symbols there. And if that is too cumbersome, you can add period and colon as custom symbols and they will appear on the keyboard. So that takes care of issue number one.

For issue number two, that's merely a stylistic variant of another letter (ه/ههه or ھ/ھھھ) that's already on the keyboard. It is never necessary within the kurdish or persian languages to use that specific symbol ہ/ہہہ. It's just nice to have, because it looks more like how people actually hand write that letter sometimes. That specific shape only becomes necessary in languages like Urdu, wherein it is understood as a fully separate letter in its own right, rather than a stylish version of any other letter.

For issue number three, someone might use that dotless-qaf as though it were actually dotless-feh for a while without realizing it, especially considering that this letter is optional... You don't actually need it to type central kurdish, but rather it just disambiguates the letter vav (و ـو) which otherwise could be either vowel or consonant. Anyway here's what dotless-qaf looks like: ٯ/ٯٯٯ ... Now compare it with dotless-feh: ڡ/ڡڡڡ. They look almost the same. In fact it's probably mostly okay to use the former in place of the latter. The issue really arises when you try to Ctrl+F someone else's text.

But different people disambiguate the letter vav differently, as it turns out. Some would do it like this: و/ۆ/وو/ڡ, and some would do it like و/ۆ/ۊ/ۉ and others would do و/ۆ/وُ and the more normal way is to only do و/ۆ/وو. I guess this is the part where I confess i'm not really a kurdish speaker; I just like the kurdish keyboard way way better for typing persian than I like the persian keyboard itself. This letter alone is sixty percent of the reason why I favor the kurdish keyboard: even with diacritics and everything, there is no possibility to disambiguate vav in persian. The kurdish keyboard, however, allows me to do that if ever need should arise.

For issue number four, neither of those letters are useful for typing kurdish. I'm merely pointing out that a bunch of letters which appear in persian, but which do not ever occur in kurdish, have been included in this kurdish keyboard nonetheless, presumably for compatibility with persian. And so, naturally, if we're going to include a variant of the letter alef which has a hamzeh over it, it should be the hamzeh that is used in persian, which is shaped like a tilde~ rather than the standard arabic hamzeh.

Issue number five is a matter of preference, because both symbols are already available. However, the symbol which is currently default on that key (ه ههه) will be indistinguishable from the vowel a (ە ـە) both in the isolated and final positions, whereas the other one (ھ ھھھ) will always have a distinct shape from the vowel a. On wikipedia, the latter, rather than the former, is listed as a member of the central kurdish alphabet. With that said, i know that the former is used by some people—probably because it's the standard version of that letter and as typically typed in persian, and thus some central kurdish keyboards (including the one for xorg on linux) use it rather than the latter.

Edit: As a side note, I would not expect that @GoRaN909 uses this keyboard regularly. Why do I say that? Well I just took a look at his bio page from his profile. And it looks like this is not the only kurdish keyboard that he has personally programmed for the android platform. There are two kurdish keyboards listed on his page, developed by him, and neither of them are this one. I hope i'm not saying anything hurtful. On the contrary, I think it's wonderful how accomplished he is. Screenshot_۲۰۲۴۰۲۰۵_۲۳۰۵۵۲_Brave - Nightly

anaskaejdar commented 4 months ago

IF a new, separate layout is the best route, then look here, I designed a new one. Based on standard persian keyboard, and modified for compatibility with kurdish. Notes_240206_130829_1

I don't know how to code this. I will try to figure it out.

Julow commented 4 months ago

Thanks for all the information !

The kurdish layout is defined like this: arab_pc_ckb. You might be able to change it with the "edit in place" button. I'd be glad if you could improve it :)

I just like the kurdish keyboard way way better for typing persian than I like the persian keyboard itself.

The app can automatically add symbols to the layout depending on the language you have installed. For example, I see the symbols specified after extra_keys= at this line in any latin layout. The QWERTY layout that I use specifies a location for many keys that are normally not visible, unless specified as an extra_keys.

Do you think you could benefit from this system ?

Your new layout seems really nice! There's no compose key yet but the dead-keys diacritics could be added. If needed, the shift modifier can be changed here. Note that you could also make a Persian layout with optional Kurdish letters using the above system.

By ZWSP, do you mean ZWNJ ? It could be added to Shift+Space if needed, perhaps depending on the script.

anaskaejdar commented 4 months ago

That's a really cool feature! I had no idea that it could do that! Before I saw your message though, i had already mostly finished coding this keyboard. Check it out: it seems to work pretty well! Of course I will test it and refine it before submitting it properly. Behold, a keyboard equally equipped for both persian and kurdish:

<?xml version="1.0" encoding="utf-8"?>
<keyboard name="Persian and Kurdish (فارسی و کوردی)" script="arabic" numpad_script="hindu-arabic">
  <row>
    <key key0="." key1="esc" key2="&lt;" key4="delete" />
    <key key0="،" key2="&gt;" />
    <key key0="ە" key2="ۀ" />
    <key key0="ق" key2=":" />
    <key key0="ف" key2="؟" />
    <key key0="ۆ" key1="!" />
    <key key0="ع" key1="غ" key4="ٕ" />
    <key key0="ھ" key1="ہ" />
    <key key0="خ" key1="ة" />
    <key key0="ح" key1="{" />
    <key key0="ج" key1="}" key3="backspace" />
  </row>
  <row>
    <key key0="ش" key1="۱" key2="ض" key3="tab" key4="=" />
    <key key0="س" key1="۲" key2="ص" key4="-" />
    <key key0="ی" key1="۳" key2="ؽ" key4="*" />
    <key key0="ب" key1="۴" key2="&#1563;" key3="^" key4="﷼" />
    <key key0="ل" key1="۵" key2="ڵ" key3="ٚ" key4="٪" />
    <key key0="ا" key2="۶" key1="آ" key4="ٓ" key3="+" />
    <key key0="ت" key2="۷" key1="ط" key3="_"/>
    <key key0="ن" key2="۸" key1="(" key3="ً" />
    <key key0="م" key2="۹" key1=")" />
    <key key0="ک" key2="۰" key1="[" />
    <key key0="گ" key2="f11_placeholder" key1="]" />
  </row>
  <row>
    <key key0="ڡ" key2="ۉ" key3="ٛ" />
    <key key0="ژ" key2="ـ" />
    <key key0="ز" key2="ظ" />
    <key key0="ر" key2="ڕ" />
    <key key0="ڤ" key2="‍" key3="ْ" />
    <key key0="د" key1="ذ" key4="ّ" />
    <key key0="پ" key1="ث" />
    <key key0="و" key1="ۊ" key4="ࣳ" />
    <key key0="ێ" key1="ٮ" key4="ِ" />
    <key key0="ئ" key1="ء" key4="ٔ" />
    <key key0="چ" key2="f12_placeholder" key1="ه" />
  </row>
</keyboard>

Screenshot_۲۰۲۴۰۲۰۶_۲۳۲۳۳۴_Brave - Nightly

Well this was a lot of fun! I'm glad that i took the time to try to figure out how this works. I wanna do polytonic greek next, because the existing greek keyboard is monotonic, which is fine especially because a few decades ago modern greek abolished all the other accent marks. But the form of greek that still used in the church services is polytonic, and full of lots of diverse accent marks. Furthermore, i don't think the existing greek keyboard can handle dialects like cypriot which uses modified forms of letters to make sounds that don't occur in typical modern greek. A foss keyboard exists already, called “Hoplite,” which enables us to type polytonic greek, but it is cumbersome to use and it's a whole separate program. I would love to try to make something a wee bit nicer.

But to make a keyboard for polytonic greek will be a much bigger task than it was to make this one. For one, I have to figure out how to create accent mark toggles, or basically keyboard layers. Is this software able to support custom keyboard layers? So that I can toggle the rough breathing mark, and then every vowel on the keyboard will be replaced by a different version of itself, which has the rough breathing mark attached to it? And if this software is able to do that, would you mind pointing me in the right direction?

anaskaejdar commented 4 months ago

@Julow

By ZWSP, do you mean [ZWNJ]

Yeah, I suppose so. I think that's what shift space does on the persian keyboard on linux. From what I remember, there are two different unicode points the basically do the exact same thing. One of them is called zero width space, and the other is called as you say zero width non joiner. The former used to be used for arabic, and then some time later, everyone was told instead to use the latter. I forgot to include either of them in the code above, though. So in this keyboard, there is no shift key; the next available option is the function key. How can I specify in the xml file that when the function key is activated, space should be replaced with ZWNJ?

Also on a related note, I did include a similar symbol called zero width joiner (ZWJ). It sits in the north east corner of the ڤ key. But, since it is invisible, one cannot tell from looking at the keyboard that anything is up in that corner. Is there a way to specify something different to be displayed on the keyboard than the character that would actually be typed?

anaskaejdar commented 4 months ago

@Julow We're now just talking about something else besides the issue at hand. I apologize. Is there a more appropriate place where I can ask questions like these? Anyway, while we're here, I have another question.

I tried to investigate how the accent keys are defined. This seems like a reasonable approach, because the existing greek keyboard already has the oxeia (aigu, sometimes called tonos) and vareia (grave) accents working. Basically, the psili and daseia are missing, as well as the perispomeni (circumflex) and iota subscript. Anyway, I am kind of stuck in srcs/juloo.keyboard2/KeyValue.java trying to figure out how this all works, with the diacritic(...) command. I am having a hard time understanding how it decides to change a letter to its accented form, and how therefore to add new definitions for it to work with.

So I tried adding the circonflexe accent to the greek keyboard. Unfortunately, it doesn't change any of the greek letters. I'm trying to figure out how I could change that.

I saw in res/xml/method.xml, there in the french azerty part, there is, for example accent_trema:ë:ï:ü:ÿ@l, which seems promising, but if I enable the french azerty keyboard, and then activate the trema, it does not change the l key at all.

Also, how trivial is it to define a new accent mark? The psili and dasia are not already defined in UnexpectedKeyboard, and they are not analogous to anything that is defined.

Julow commented 4 months ago

The layout looks nice :) Could you add it to the app ? I'd be happy to do it otherwise.

Defining new dead-key (a key that enables a layer for the time of typing one other key) is easy. First the key is defined with the diacritic function: KeyValue The first argument (for example 0xE062 for the last one) correspond to the glyph in the embedded font: https://github.com/Julow/Unexpected-Keyboard/tree/master/srcs/special_font (with 0xE000 added to it). The second argument is the Modifier, for which a new one must be defined in KeyValue.Modifier The modifier is handled in KeyModifier in different ways: hardcoded correspondance, a unicode combining diacritic is added or using map_dead_char, which adds a diacritics but do not work every time. See map_char_aigu, which has all three cases. The correspondance between a Modifier and a map is written in modify.

The Fn key is also defied in this module, apply_fn_char

The KeyValue module can defines keys that type a character but is rendered as an other on the keyboard (for example, nbsp).

The existing dead-keys can be extended when it makes sense but I'd prefer to define new ones if they have a different name or purpose.

Happy to help!

Julow commented 4 months ago

Any progress on this? I would be happy to implement the diacritics, which ones do you need?

anaskaejdar commented 4 months ago

Yes! I'm going through a cycle of using and refining it.

As for the greek diacritics, I will prepare a list! I didn't realize you were offering to implement it; that's very kind. I intended to do it myself, but it would take an awfully long time for me to figure it out, I expect.

anaskaejdar commented 4 months ago

I don't know if redundancy is desirable with these diacritics. Probably, there is an order of operations and thus this list could be smaller, but here are the letters that should be changed if accent_aigu is activated:

α → ά ὰ → ᾶ ἀ → ἄ ἁ → ἅ ἂ → ἆ ἃ → ἇ ᾳ → ᾴ ᾲ → ᾷ ᾀ → ᾄ ᾁ → ᾅ ᾂ → ᾆ ᾃ → ᾇ ᾰ → ᾰ́ ᾰ̀ → ᾰ͂ ᾰ̓ → ᾰ̓́ ᾰ̔ → ᾰ̔́ ᾰ̓̀ → ᾰ̓͂ ᾰ̔̀ → ᾰ̔͂ ᾱ → ᾱ́ ᾱ̓ → ᾱ̓́ ᾱ̔ → ᾱ̔́

ε → έ ἐ → ἔ ἑ → ἕ

υ → ύ ὺ → ῦ ὐ → ὔ ὑ → ὕ ὒ → ὖ ὓ → ὗ ϋ → ΰ ῢ → ῧ ῡ → ῡ́ ῡ̓ → ῡ̓́ ῡ̔ → ῡ̔́ ῡ̈ → ῡ̈́ ῠ → ῠ́ ῠ̀ → ῠ͂ ῠ̓ → ῠ̓́ ῠ̔ → ῠ̔́ ῠ̓̀ → ῠ̓͂ ῠ̔̀ → ῠ̔͂ ῠ̈ → ῠ̈́ ῠ̈̀ → ῠ̈͂

ι → ί ὶ → ῖ ἰ → ἴ ἱ → ἵ ἲ → ἶ ἳ → ἷ ῑ → ῑ́ ῑ̓ → ῑ̓́ ῑ̔ → ῑ̔́ ῐ → ῐ́ ῐ̀ → ῐ͂ ῐ̓ → ῐ̓́ ῐ̔ → ῐ̔́ ῐ̓̀ → ῐ̓͂ ῐ̔̀ → ῐ̔͂

ο → ό ὀ → ὄ ὁ → ὅ

η → ή ὴ → ῆ ἠ → ἤ ἡ → ἥ ἢ → ἦ ἣ → ἧ ῃ → ῄ ῂ → ῇ ᾐ → ᾔ ᾑ → ᾕ ᾒ → ᾖ ᾓ → ᾗ

ω → ώ ὼ → ῶ ὠ → ὤ ὡ → ὥ ὢ → ὦ ὣ → ὧ ῳ → ῴ ῲ → ῷ ᾠ → ᾤ ᾡ → ᾥ ᾢ → ᾦ ᾣ → ᾧ

Notice the letters that have perispomeni (\~) on top of it. When people talk about greek orthography in english, that accent is usually called circumflex, so it would make sense that those letters could alternatively be activated by the accent_circonflexe. If it's no problem, both options should be available, because in theory, the perispomeni represents a combination of oxeia and vareia (aigu and grave). So if both aigu and grave are active, the letter will have a perispomeni (\~).

Julow commented 4 months ago

Thanks for providing the list! Many of these accents are represented as combining diacritics, which is something the keyboard can and should do but is currently implemented only for a few letters.

I initially didn't want to implement combining diacritics for every keys as I didn't want to risk people using combined diacritics when they expected one-code-point letters. For example, several of the letters in your list are one-code-point and do not contain a combining diacritic. Though, that might not be a concern if map_dead_char is considered first and the combining diacritic is used only if that didn't work.

To avoid any confusion and allow future changes, perispomeni should probably be a new dead-key. Though I don't see an inconvenient in overloading the circonflexe dead-key, if the glyph is ok.

To have proper support, you'd need a dedicated layout. What variant of Greek are you writing ? Could you please open a new issue to separate the two discussions ?

GoRaN909 commented 3 months ago

Hi @anaskaejdar Idk why you focused into this layout that a standard way to writing in Central Kurdish and I made this specially for write down in Kurdish language not Persian because that two languages are totally different from each other!

If you wana type in Farsi you should take a look into Persian layouts not the Kurdish one and please don't change any part from my layout if you wana new persian layout you may open an PR for it.

anaskaejdar commented 3 months ago

@GoRaN909 I am aware it is designed for kurdish. It has a couple significant problems as a central-kurdish keyboard, and a few more problems, if (as I suspect) you wanted to support the reformed orthography. And yet another problem if it should be used for the southern sorani dialect. Thus, it should be updated. Forgive me, friend; I believe you are being needlessly defensive. I already did design a new keyboard, which will have its own PR when it is ready.

See above for the details, but I'll say it briefly:

None of those problems have anything to do with farsi. I have addressed all of those problems in my own layout design.