39aldo39 / klfc

Keyboard Layout Files Creator
GNU General Public License v3.0
215 stars 13 forks source link

"dead key is not defined" when converting from .klc #35

Closed lord-ne closed 3 years ago

lord-ne commented 3 years ago

When converting a certain .klc file (attached), I get the error klfc: warning: dead key ‘ְ’ is not defined., and the converted output files (also attached) do not contain the dead key definition. The dead key is definitely defined, on lines 95-102 of the input. I've attached my input file, as well as all of the output files produced by the conversion (which do not include the dead key).

he_phon.klc.txt (renamed to .txt to attach) output.zip (zipped)

lord-ne commented 3 years ago

Here's the full text of the input file, for easier viewing. The input contains the dead key definition.

KBD he_phon "Phonetic Hebrew"

COPYRIGHT   "(c) 2021 N.E."

COMPANY "N.E."

LOCALENAME  "he-IL"

LOCALEID    "0000040d"

VERSION 1.0

SHIFTSTATE

0   //Column 4
1   //Column 5 : Shft
2   //Column 6 :       Ctrl
6   //Column 7 :       Ctrl Alt
7   //Column 8 : Shft  Ctrl Alt

LAYOUT      ;an extra '@' at the end is a dead key

//SC    VK_     Cap 0   1   2   6   7
//--    ----        ----    ----    ----    ----    ----    ----

02  1       0   1   0021    -1  -1  -1      // DIGIT ONE, EXCLAMATION MARK, <none>, <none>, <none>
03  2       0   2   0040    -1  -1  -1      // DIGIT TWO, COMMERCIAL AT, <none>, <none>, <none>
04  3       0   3   0023    -1  20ac    -1      // DIGIT THREE, NUMBER SIGN, <none>, EURO SIGN, <none>
05  4       0   4   0024    -1  20aa    -1      // DIGIT FOUR, DOLLAR SIGN, <none>, NEW SHEQEL SIGN, <none>
06  5       0   5   0025    -1  00b0    -1      // DIGIT FIVE, PERCENT SIGN, <none>, DEGREE SIGN, <none>
07  6       0   6   005e    -1  -1  -1      // DIGIT SIX, CIRCUMFLEX ACCENT, <none>, <none>, <none>
08  7       0   7   0026    -1  -1  -1      // DIGIT SEVEN, AMPERSAND, <none>, <none>, <none>
09  8       0   8   002a    -1  00d7    -1      // DIGIT EIGHT, ASTERISK, <none>, MULTIPLICATION SIGN, <none>
0a  9       0   9   0028    -1  -1  -1      // DIGIT NINE, LEFT PARENTHESIS, <none>, <none>, <none>
0b  0       0   0   0029    -1  -1  -1      // DIGIT ZERO, RIGHT PARENTHESIS, <none>, <none>, <none>
0c  OEM_MINUS   0   002d    005f    -1  200c    -1      // HYPHEN-MINUS, LOW LINE, <none>, ZERO WIDTH NON-JOINER, <none>
0d  OEM_PLUS    0   003d    002b    -1  200d    -1      // EQUALS SIGN, PLUS SIGN, <none>, ZERO WIDTH JOINER, <none>
10  Q       0   05e7    -1  -1  05b8    05c7        // HEBREW LETTER QOF, <none>, <none>, HEBREW POINT QAMATS, HEBREW POINT QAMATS QATAN
11  W       0   05e9    05e1    -1  %%  %%      // HEBREW LETTER SHIN, HEBREW LETTER SAMEKH, <none>, <null>, <null>
12  E       0   05e2    -1  -1  05b6    -1      // HEBREW LETTER AYIN, <none>, <none>, HEBREW POINT SEGOL, <none>
13  R       0   05e8    -1  -1  -1  -1      // HEBREW LETTER RESH, <none>, <none>, <none>, <none>
14  T       0   05ea    05d8    -1  %%  -1      // HEBREW LETTER TAV, HEBREW LETTER TET, <none>, <null>, <none>
15  Y       0   05d9    -1  -1  05b5    -1      // HEBREW LETTER YOD, <none>, <none>, HEBREW POINT TSERE, <none>
16  U       0   05d5    %%  -1  05bb    -1      // HEBREW LETTER VAV, <null>, <none>, HEBREW POINT QUBUTS, <none>
17  I       0   05d9    -1  -1  05b4    -1      // HEBREW LETTER YOD, <none>, <none>, HEBREW POINT HIRIQ, <none>
18  O       0   05d5    %%  -1  05b9    05c7        // HEBREW LETTER VAV, <null>, <none>, HEBREW POINT HOLAM, HEBREW POINT QAMATS QATAN
19  P       0   05e4    05e3    -1  %%  %%      // HEBREW LETTER PE, HEBREW LETTER FINAL PE, <none>, <null>, <null>
1a  OEM_4       0   005b    007b    -1  200e    -1      // LEFT SQUARE BRACKET, LEFT CURLY BRACKET, <none>, LEFT-TO-RIGHT MARK, <none>
1b  OEM_6       0   005d    007d    -1  200f    -1      // RIGHT SQUARE BRACKET, RIGHT CURLY BRACKET, <none>, RIGHT-TO-LEFT MARK, <none>
1e  A       0   05d0    -1  -1  05b7    05b8        // HEBREW LETTER ALEF, <none>, <none>, HEBREW POINT PATAH, HEBREW POINT QAMATS
1f  S       0   05e1    05e9    -1  -1  -1      // HEBREW LETTER SAMEKH, HEBREW LETTER SHIN, <none>, <none>, <none>
20  D       0   05d3    -1  -1  -1  -1      // HEBREW LETTER DALET, <none>, <none>, <none>, <none>
21  F       0   05e4    05e3    -1  %%  %%      // HEBREW LETTER PE, HEBREW LETTER FINAL PE, <none>, <null>, <null>
22  G       0   05d2    -1  -1  -1  -1      // HEBREW LETTER GIMEL, <none>, <none>, <none>, <none>
23  H       0   05d4    -1  -1  -1  -1      // HEBREW LETTER HE, <none>, <none>, <none>, <none>
24  J       0   05d8    05ea    -1  -1  -1      // HEBREW LETTER TET, HEBREW LETTER TAV, <none>, <none>, <none>
25  K       0   05db    05da    -1  %%  %%      // HEBREW LETTER KAF, HEBREW LETTER FINAL KAF, <none>, <null>, <null>
26  L       0   05dc    -1  -1  -1  -1      // HEBREW LETTER LAMED, <none>, <none>, <none>, <none>
27  OEM_1       0   003b    003a    -1  -1  -1      // SEMICOLON, COLON, <none>, <none>, <none>
28  OEM_7       0   0027    0022    -1  05b0    05b0@       // APOSTROPHE, QUOTATION MARK, <none>, HEBREW POINT SHEVA, HEBREW POINT SHEVA
29  OEM_3       0   0060    007e    -1  -1  -1      // GRAVE ACCENT, TILDE, <none>, <none>, <none>
2b  OEM_5       0   005c    007c    -1  -1  -1      // REVERSE SOLIDUS, VERTICAL LINE, <none>, <none>, <none>
2c  Z       0   05d6    -1  -1  -1  -1      // HEBREW LETTER ZAYIN, <none>, <none>, <none>, <none>
2d  X       0   05d7    -1  -1  -1  -1      // HEBREW LETTER HET, <none>, <none>, <none>, <none>
2e  C       0   05e6    05e5    -1  -1  -1      // HEBREW LETTER TSADI, HEBREW LETTER FINAL TSADI, <none>, <none>, <none>
2f  V       0   05d5    -1  -1  -1  -1      // HEBREW LETTER VAV, <none>, <none>, <none>, <none>
30  B       0   05d1    -1  -1  %%  -1      // HEBREW LETTER BET, <none>, <none>, <null>, <none>
31  N       0   05e0    05df    -1  -1  -1      // HEBREW LETTER NUN, HEBREW LETTER FINAL NUN, <none>, <none>, <none>
32  M       0   05de    05dd    -1  -1  -1      // HEBREW LETTER MEM, HEBREW LETTER FINAL MEM, <none>, <none>, <none>
33  OEM_COMMA   0   002c    003c    -1  -1  -1      // COMMA, LESS-THAN SIGN, <none>, <none>, <none>
34  OEM_PERIOD  0   002e    003e    -1  05bc    -1      // FULL STOP, GREATER-THAN SIGN, <none>, HEBREW POINT DAGESH OR MAPIQ (or shuruq), <none>
35  OEM_2       0   002f    003f    -1  00f7    -1      // SOLIDUS, QUESTION MARK, <none>, DIVISION SIGN, <none>
39  SPACE       0   0020    0020    -1  -1  -1      // SPACE, SPACE, <none>, <none>, <none>
56  OEM_102 0   005c    007c    -1  -1  -1      // REVERSE SOLIDUS, VERTICAL LINE, <none>, <none>, <none>
53  DECIMAL 0   002e    002e    -1  -1  -1      // FULL STOP, FULL STOP, , , 

LIGATURE

//VK_   Mod#    Char0   Char1   Char2   Char3
//----      ----    ----    ----    ----    ----

B       3   05d1    05bc        // HEBREW LETTER BET + HEBREW POINT DAGESH OR MAPIQ (or shuruq)
F       3   05e4    05bc        // HEBREW LETTER PE + HEBREW POINT DAGESH OR MAPIQ (or shuruq)
F       4   05e3    05bc        // HEBREW LETTER FINAL PE + HEBREW POINT DAGESH OR MAPIQ (or shuruq)
K       3   05db    05bc        // HEBREW LETTER KAF + HEBREW POINT DAGESH OR MAPIQ (or shuruq)
K       4   05da    05bc        // HEBREW LETTER FINAL KAF + HEBREW POINT DAGESH OR MAPIQ (or shuruq)
O       1   05d5    05b9        // HEBREW LETTER VAV + HEBREW POINT HOLAM
P       3   05e4    05bc        // HEBREW LETTER PE + HEBREW POINT DAGESH OR MAPIQ (or shuruq)
P       4   05e3    05bc        // HEBREW LETTER FINAL PE + HEBREW POINT DAGESH OR MAPIQ (or shuruq)
T       3   05ea    05bc        // HEBREW LETTER TAV + HEBREW POINT DAGESH OR MAPIQ (or shuruq)
U       1   05d5    05bc        // HEBREW LETTER VAV + HEBREW POINT DAGESH OR MAPIQ (or shuruq)
W       3   05e9    05c1        // HEBREW LETTER SHIN + HEBREW POINT SHIN DOT
W       4   05e9    05c2        // HEBREW LETTER SHIN + HEBREW POINT SIN DOT

DEADKEY 05b0

05b6    05b1    // ֶ -> ֱ
05b7    05b2    // ַ -> ֲ
05b8    05b3    // ָ -> ֳ
05e2    05b1    // ע -> ֱ
05d0    05b2    // א -> ֲ
05e7    05b3    // ק -> ֳ

KEYNAME

01  Esc
0e  Backspace
0f  Tab
1c  Enter
1d  Ctrl
2a  Shift
36  "Right Shift"
37  "Num *"
38  Alt
39  Space
3a  "Caps Lock"
3b  F1
3c  F2
3d  F3
3e  F4
3f  F5
40  F6
41  F7
42  F8
43  F9
44  F10
45  Pause
46  "Scroll Lock"
47  "Num 7"
48  "Num 8"
49  "Num 9"
4a  "Num -"
4b  "Num 4"
4c  "Num 5"
4d  "Num 6"
4e  "Num +"
4f  "Num 1"
50  "Num 2"
51  "Num 3"
52  "Num 0"
53  "Num Del"
54  "Sys Req"
57  F11
58  F12
7c  F13
7d  F14
7e  F15
7f  F16
80  F17
81  F18
82  F19
83  F20
84  F21
85  F22
86  F23
87  F24

KEYNAME_EXT

1c  "Num Enter"
1d  "Right Ctrl"
35  "Num /"
37  "Prnt Scrn"
38  "Right Alt"
45  "Num Lock"
46  Break
47  Home
48  Up
49  "Page Up"
4b  Left
4d  Right
4f  End
50  Down
51  "Page Down"
52  Insert
53  Delete
54  <00>
56  Help
5b  "Left Windows"
5c  "Right Windows"
5d  Application

KEYNAME_DEAD

05b0    "HEBREW POINT SHEVA"

DESCRIPTIONS

0409    Phonetic Hebrew

LANGUAGENAMES

0409    Hebrew (Israel)

ENDKBD
lord-ne commented 3 years ago

And here's the output json file. The output does not contain the dead key definition.

{
  "fullName": "Phonetic Hebrew",
  "name": "he_phon",
  "copyright": "(c) 2021 N.E.",
  "company": "N.E.",
  "localeId": "0000040d",
  "version": "1.0",
  "shiftlevels": [ "None", "Shift", "Control", "Alt+Control", "Shift+Alt+Control" ],
  "keys": [
    { "pos": "1", "shortcutPos": "1", "letters": [ "1", "!", "", "", "" ], "capslock": false },
    { "pos": "2", "shortcutPos": "2", "letters": [ "2", "@", "", "", "" ], "capslock": false },
    { "pos": "3", "shortcutPos": "3", "letters": [ "3", "#", "", "€", "" ], "capslock": false },
    { "pos": "4", "shortcutPos": "4", "letters": [ "4", "$", "", "₪", "" ], "capslock": false },
    { "pos": "5", "shortcutPos": "5", "letters": [ "5", "%", "", "°", "" ], "capslock": false },
    { "pos": "6", "shortcutPos": "6", "letters": [ "6", "^", "", "", "" ], "capslock": false },
    { "pos": "7", "shortcutPos": "7", "letters": [ "7", "&", "", "", "" ], "capslock": false },
    { "pos": "8", "shortcutPos": "8", "letters": [ "8", "*", "", "×", "" ], "capslock": false },
    { "pos": "9", "shortcutPos": "9", "letters": [ "9", "(", "", "", "" ], "capslock": false },
    { "pos": "0", "shortcutPos": "0", "letters": [ "0", ")", "", "", "" ], "capslock": false },
    { "pos": "-", "shortcutPos": "-", "letters": [ "-", "_", "", "‌", "" ], "capslock": false },
    { "pos": "+", "shortcutPos": "+", "letters": [ "=", "+", "", "‍", "" ], "capslock": false },
    { "pos": "Q", "shortcutPos": "Q", "letters": [ "ק", "", "", "ָ", "ׇ" ], "capslock": false },
    { "pos": "W", "shortcutPos": "W", "letters": [ "ש", "ס", "", "lig:שׁ", "lig:שׂ" ], "capslock": false },
    { "pos": "E", "shortcutPos": "E", "letters": [ "ע", "", "", "ֶ", "" ], "capslock": false },
    { "pos": "R", "shortcutPos": "R", "letters": [ "ר", "", "", "", "" ], "capslock": false },
    { "pos": "T", "shortcutPos": "T", "letters": [ "ת", "ט", "", "lig:תּ", "" ], "capslock": false },
    { "pos": "Y", "shortcutPos": "Y", "letters": [ "י", "", "", "ֵ", "" ], "capslock": false },
    { "pos": "U", "shortcutPos": "U", "letters": [ "ו", "lig:וּ", "", "ֻ", "" ], "capslock": false },
    { "pos": "I", "shortcutPos": "I", "letters": [ "י", "", "", "ִ", "" ], "capslock": false },
    { "pos": "O", "shortcutPos": "O", "letters": [ "ו", "lig:וֹ", "", "ֹ", "ׇ" ], "capslock": false },
    { "pos": "P", "shortcutPos": "P", "letters": [ "פ", "ף", "", "lig:פּ", "lig:ףּ" ], "capslock": false },
    { "pos": "[", "shortcutPos": "[", "letters": [ "[", "{", "", "‎", "" ], "capslock": false },
    { "pos": "]", "shortcutPos": "]", "letters": [ "]", "}", "", "‏", "" ], "capslock": false },
    { "pos": "A", "shortcutPos": "A", "letters": [ "א", "", "", "ַ", "ָ" ], "capslock": false },
    { "pos": "S", "shortcutPos": "S", "letters": [ "ס", "ש", "", "", "" ], "capslock": false },
    { "pos": "D", "shortcutPos": "D", "letters": [ "ד", "", "", "", "" ], "capslock": false },
    { "pos": "F", "shortcutPos": "F", "letters": [ "פ", "ף", "", "lig:פּ", "lig:ףּ" ], "capslock": false },
    { "pos": "G", "shortcutPos": "G", "letters": [ "ג", "", "", "", "" ], "capslock": false },
    { "pos": "H", "shortcutPos": "H", "letters": [ "ה", "", "", "", "" ], "capslock": false },
    { "pos": "J", "shortcutPos": "J", "letters": [ "ט", "ת", "", "", "" ], "capslock": false },
    { "pos": "K", "shortcutPos": "K", "letters": [ "כ", "ך", "", "lig:כּ", "lig:ךּ" ], "capslock": false },
    { "pos": "L", "shortcutPos": "L", "letters": [ "ל", "", "", "", "" ], "capslock": false },
    { "pos": ";", "shortcutPos": ";", "letters": [ ";", ":", "", "", "" ], "capslock": false },
    { "pos": "'", "shortcutPos": "'", "letters": [ "'", "\"", "", "ְ", "cdk:ְ" ], "capslock": false },
    { "pos": "~", "shortcutPos": "~", "letters": [ "`", "~", "", "", "" ], "capslock": false },
    { "pos": "\\", "shortcutPos": "\\", "letters": [ "\\", "|", "", "", "" ], "capslock": false },
    { "pos": "Z", "shortcutPos": "Z", "letters": [ "ז", "", "", "", "" ], "capslock": false },
    { "pos": "X", "shortcutPos": "X", "letters": [ "ח", "", "", "", "" ], "capslock": false },
    { "pos": "C", "shortcutPos": "C", "letters": [ "צ", "ץ", "", "", "" ], "capslock": false },
    { "pos": "V", "shortcutPos": "V", "letters": [ "ו", "", "", "", "" ], "capslock": false },
    { "pos": "B", "shortcutPos": "B", "letters": [ "ב", "", "", "lig:בּ", "" ], "capslock": false },
    { "pos": "N", "shortcutPos": "N", "letters": [ "נ", "ן", "", "", "" ], "capslock": false },
    { "pos": "M", "shortcutPos": "M", "letters": [ "מ", "ם", "", "", "" ], "capslock": false },
    { "pos": ",", "shortcutPos": ",", "letters": [ ",", "<", "", "", "" ], "capslock": false },
    { "pos": ".", "shortcutPos": ".", "letters": [ ".", ">", "", "ּ", "" ], "capslock": false },
    { "pos": "/", "shortcutPos": "/", "letters": [ "/", "?", "", "÷", "" ], "capslock": false },
    { "pos": "Space", "shortcutPos": "Space", "letters": [ " ", " ", "", "", "" ], "capslock": false },
    { "pos": "Iso", "shortcutPos": "Iso", "letters": [ "\\", "|", "", "", "" ], "capslock": false },
    { "pos": "KP_Dec", "shortcutPos": "KP_Dec", "letters": [ ".", ".", "", "", "" ], "capslock": false }
  ],
  "customDeadKeys": [
    {
      "name": "ְ",
      "baseChar": "ְ",
      "stringMap": []
    }
  ]
}
DreymaR commented 3 years ago

28 OEM_7 0 0027 0022 -1 05b0 05b0@

That line if where the magic's supposed to happen, right? AltGr+Shift+Apostrophe should produce the Sheva dead key.

I've experienced that you cannot always use non-ASCII marks for dead key names. Maybe that's your problem. Try calling your dead key period instead of sheva. You can still have it output exactly the same symbols as it does now!

Oh, and while I have your attention: Could you please take the time to swing by my EPKL repo and tell me what you think of the phonetic Colemak layout there? I'm a bit stoked about inventing those dead keys on O and Y for writing niqqud and so much more.

https://github.com/DreymaR/BigBagKbdTrixPKL/tree/master/Layouts/Colemak/Cmk-eD-Heb

lord-ne commented 3 years ago

How do I change the "name" of a dead key without changing the actual definition? (Note that in many word processors, pressing the dead key and then pressing any character other than those the dead key maps will send the actual character of the dead key, followed by the character you typed.)

Your keyboard layout is definitely interesting, although I'm not that familiar with Colemak in general. I would say that I definitely prefer using AltGr and AltGr+Shift for nikud as opposed to dead keys, but that's just my personal preference. I find that the segregation of anything nikud-related to the AltGr key makes my life easier because 99% of the time I'm not using nikud.

DreymaR commented 3 years ago

Change the 05b0@ entry to, e.g., 002e@, and accordingly change the KEYNAME_DEAD 05b0 "HEBREW POINT SHEVA" and DEADKEY 05b0 below from 05b0 to 002e. That should work I think. You should specify a space release (a 0020 entry) for the dead key at the end of its table, that's tradition. I'm not sure, but that entry may be the one the dead key releases on untabulated releases as well. If not, maybe you have to live with imperfection. I seem to remember having similar problems with MSKLC and Greek character dead keys.

Niqqudot is a conundrum, for sure. Most people nearly never use it, but I think that if you are to use them then AltGr mappings would make that very uncomfortable. For a "1%" use case that's okay but for a scholar it wouldn't be cool. The dead keys, furthermore, can release a lot more than just niqqud including special Hebrew characters and Yiddish. I'm taking that further now by including a Compose method so you could for instance compose a yod-yod bigram to a yod-yod digraph. EPKL is a fun project!

lord-ne commented 3 years ago

The dead key works properly on Windows, so this isn't a problem with MSKLC, it's a problem with this conversion tool. I think I'll leave it as-is for now, I'm not really using any of the other platform formats right now anyway. Maybe I'll add something to my conversion script to make a copy with the sheva dead key replaced with a period, and convert from that.

DreymaR commented 3 years ago

Yeah, I'm just guessing at why Aldo's tool might have a problem with that DK.

I'd still recommend that you follow the convention of including a space release for your dead key. All standard DKs have that, ttbomk. An example from my own layout, where I also made a NBSP release for the combining accent:

0067    011f    // g -> ğ
00a0    0306    //   -> ̆
0020    02d8    //   -> ˘
lord-ne commented 3 years ago

I'll add it in

39aldo39 commented 3 years ago

There was an issue with the KLC parsing: it behaved like the ligature part extended to the end of the file (with most having no values of course). I have pushed a fix, but as a workaround you can simply put the DEADKEY 05b0 section above the LIGATURE section if you want to use the current version.