add some more layouts

This commit is contained in:
Helium314 2023-11-28 21:27:29 +01:00
parent 26c890a3e2
commit 38d8365e5b
13 changed files with 408 additions and 12 deletions

View file

@ -1,2 +1,11 @@
[morekeys]
ε έ %
υ ύ % ϋ ΰ
ι ί % ϊ ΐ
ο ό %
α ά
η ή
ω ώ
[labels]
alphabet: ΑΒΓ

View file

@ -1,4 +1,15 @@
[morekeys]
ე ჱ
ი ჲ
ა ჺ
ფ ჶ
გ ჹ
ჰ ჵ
ჯ ჷ
ხ ჴ
ვ ჳ
ნ ჼ
'
" ” „ “

View file

@ -1,4 +1,23 @@
[morekeys]
و ؤ
ر ڑ
ت ٹ
ے ۓ
ی ئ
ہ ۂ ۃ
ا آ أ ٰ ٖ
س ص
د ڈ
گ غ
ح ھ
ج ض
ک خ
َ ُ ِ ٗ ْ ً ٌ ٍ ّ
ز ذ
ش ژ
چ ث
ط ظ
ن ں
punctuation ؟ ، ! . -
[labels]

View file

@ -0,0 +1,41 @@
է
թ
փ
ձ
ջ
ր
չ
ճ
ժ
ծ
ք
ո
ե և
ռ
տ
ը
ւ
ի
օ
պ
ա
ս
դ $$$
ֆ
գ
հ
յ
կ
լ
խ
զ
ղ
ց
վ
բ
ն
մ
շ

View file

@ -0,0 +1,112 @@
[
[
{ "$": "shift_state_selector",
"manualOrLocked": { "label": "q" },
"default": { "label": "ქ" }
},
{ "$": "shift_state_selector",
"manualOrLocked": { "label": "ჭ" },
"default": { "label": "წ" }
},
{ "$": "shift_state_selector",
"manualOrLocked": { "label": "e" },
"default": { "label": "ე" }
},
{ "$": "shift_state_selector",
"manualOrLocked": { "label": "ღ" },
"default": { "label": "რ" }
},
{ "$": "shift_state_selector",
"manualOrLocked": { "label": "თ" },
"default": { "label": "ტ" }
},
{ "$": "shift_state_selector",
"manualOrLocked": { "label": "y" },
"default": { "label": "" }
},
{ "$": "shift_state_selector",
"manualOrLocked": { "label": "u" },
"default": { "label": "უ" }
},
{ "$": "shift_state_selector",
"manualOrLocked": { "label": "i" },
"default": { "label": "ი" }
},
{ "$": "shift_state_selector",
"manualOrLocked": { "label": "o" },
"default": { "label": "ო" }
},
{ "$": "shift_state_selector",
"manualOrLocked": { "label": "p" },
"default": { "label": "პ" }
}
],
[
{ "$": "shift_state_selector",
"manualOrLocked": { "label": "a" },
"default": { "label": "ა" }
},
{ "$": "shift_state_selector",
"manualOrLocked": { "label": "შ" },
"default": { "label": "ს" }
},
{ "$": "shift_state_selector",
"manualOrLocked": { "label": "d" },
"default": { "label": "დ" }
},
{ "$": "shift_state_selector",
"manualOrLocked": { "label": "f" },
"default": { "label": "ფ" }
},
{ "$": "shift_state_selector",
"manualOrLocked": { "label": "g" },
"default": { "label": "გ" }
},
{ "$": "shift_state_selector",
"manualOrLocked": { "label": "h" },
"default": { "label": "ჰ" }
},
{ "$": "shift_state_selector",
"manualOrLocked": { "label": "ჟ" },
"default": { "label": "ჯ" }
},
{ "$": "shift_state_selector",
"manualOrLocked": { "label": "k" },
"default": { "label": "კ" }
},
{ "$": "shift_state_selector",
"manualOrLocked": { "label": "l" },
"default": { "label": "ლ" }
}
],
[
{ "$": "shift_state_selector",
"manualOrLocked": { "label": "ძ" },
"default": { "label": "ზ" }
},
{ "$": "shift_state_selector",
"manualOrLocked": { "label": "x" },
"default": { "label": "ხ" }
},
{ "$": "shift_state_selector",
"manualOrLocked": { "label": "ჩ" },
"default": { "label": "ც" }
},
{ "$": "shift_state_selector",
"manualOrLocked": { "label": "v" },
"default": { "label": "ვ" }
},
{ "$": "shift_state_selector",
"manualOrLocked": { "label": "b" },
"default": { "label": "ბ" }
},
{ "$": "shift_state_selector",
"manualOrLocked": { "label": "n" },
"default": { "label": "ნ" }
},
{ "$": "shift_state_selector",
"manualOrLocked": { "label": "m" },
"default": { "label": "მ" }
}
]
]

View file

@ -0,0 +1,37 @@
[
[
{ "$": "shift_state_selector",
"shiftedManual": { "label": ":", "popup": { "main": { "label": ";" } } },
"default": { "label": ";", "popup": { "main": { "label": ":" } } }
},
{ "label": "ς", "labelFlags": 65536 },
{ "label": "ε" },
{ "label": "ρ" },
{ "label": "τ" },
{ "label": "υ" },
{ "label": "θ" },
{ "label": "ι" },
{ "label": "ο" },
{ "label": "π" }
],
[
{ "label": "α", "popup": { "main": { "label": "@" } } },
{ "label": "σ", "popup": { "main": { "label": "#" } } },
{ "label": "δ", "popup": { "main": { "label": "$$$" } } },
{ "label": "φ", "popup": { "main": { "label": "%" } } },
{ "label": "γ", "popup": { "main": { "label": "&" } } },
{ "label": "η", "popup": { "main": { "label": "-" } } },
{ "label": "ξ", "popup": { "main": { "label": "+" } } },
{ "label": "κ", "popup": { "main": { "label": "(" } } },
{ "label": "λ", "popup": { "main": { "label": ")" } } }
],
[
{ "label": "ζ", "popup": { "main": { "label": "*" } } },
{ "label": "χ", "popup": { "main": { "label": "\"" } } },
{ "label": "ψ", "popup": { "main": { "label": "'" } } },
{ "label": "ω", "popup": { "main": { "label": ":" } } },
{ "label": "β", "popup": { "main": { "label": ";" } } },
{ "label": "ν", "popup": { "main": { "label": "!" } } },
{ "label": "μ", "popup": { "main": { "label": "?" } } }
]
]

View file

@ -0,0 +1,116 @@
[
[
{ "$": "shift_state_selector",
"manualOrLocked": { "label": "ٔ" },
"default": { "label": "ق" }
},
{ "$": "shift_state_selector",
"manualOrLocked": { "label": "ْ" },
"default": { "label": "و" }
},
{ "$": "shift_state_selector",
"manualOrLocked": { "label": "ّ" },
"default": { "label": "ع" }
},
{ "$": "shift_state_selector",
"manualOrLocked": { "label": "ً" },
"default": { "label": "ر" }
},
{ "$": "shift_state_selector",
"manualOrLocked": { "label": "ٗ" },
"default": { "label": "ت" }
},
{ "$": "shift_state_selector",
"manualOrLocked": { "label": "ٖ" },
"default": { "label": "ے" }
},
{ "$": "shift_state_selector",
"manualOrLocked": { "label": "ٰ" },
"default": { "label": "ء" }
},
{ "$": "shift_state_selector",
"manualOrLocked": { "label": "ُ" },
"default": { "label": "ی" }
},
{ "$": "shift_state_selector",
"manualOrLocked": { "label": "ِ" },
"default": { "label": "ہ" }
},
{ "$": "shift_state_selector",
"manualOrLocked": { "label": "َ" },
"default": { "label": "پ" }
}
],
[
{ "$": "shift_state_selector",
"manualOrLocked": { "label": "؏" },
"default": { "label": "ا" }
},
{ "$": "shift_state_selector",
"manualOrLocked": { "label": "؎" },
"default": { "label": "س" }
},
{ "$": "shift_state_selector",
"manualOrLocked": { "label": "ؔ" },
"default": { "label": "د" }
},
{ "$": "shift_state_selector",
"manualOrLocked": { "label": "ؒ" },
"default": { "label": "ف" }
},
{ "$": "shift_state_selector",
"manualOrLocked": { "label": "ؓ" },
"default": { "label": "گ" }
},
{ "$": "shift_state_selector",
"manualOrLocked": { "label": "ؑ" },
"default": { "label": "ح" }
},
{ "$": "shift_state_selector",
"manualOrLocked": { "label": "ؐ" },
"default": { "label": "ج" }
},
{ "$": "shift_state_selector",
"manualOrLocked": { "label": "ﷺ" },
"default": { "label": "ک" }
},
{ "$": "shift_state_selector",
"manualOrLocked": { "label": "ﷻ" },
"default": { "label": "ل" }
}
],
[
{ "$": "shift_state_selector",
"manualOrLocked": { "label": "ﷲ" },
"default": { "label": "َ" }
},
{ "$": "shift_state_selector",
"manualOrLocked": { "label": "؀" },
"default": { "label": "ز" }
},
{ "$": "shift_state_selector",
"manualOrLocked": { "label": "؂" },
"default": { "label": "ش" }
},
{ "$": "shift_state_selector",
"manualOrLocked": { "label": "؃" },
"default": { "label": "چ" }
},
{ "$": "shift_state_selector",
"manualOrLocked": { "label": "؍" },
"default": { "label": "ط" }
},
{ "$": "shift_state_selector",
"manualOrLocked": { "label": "٘" },
"default": { "label": "ب", "popup": { "main": { "label": "(" } } }
},
{ "$": "shift_state_selector",
"manualOrLocked": { "label": "؟" },
"default": { "label": "ن" }
},
{ "$": "shift_state_selector",
"manualOrLocked": { "label": "٫" },
"default": { "label": "م", "popup": { "main": { "label": ")" } } }
}
]
]

View file

@ -0,0 +1,37 @@
[
[
{ "label": "q", "popup": { "main": { "label": "%" } } },
{ "label": "w", "popup": { "main": { "label": "\\" } } },
{ "label": "e", "popup": { "main": { "label": "|" } } },
{ "label": "r", "popup": { "main": { "label": "=" } } },
{ "label": "t", "popup": { "main": { "label": "[" } } },
{ "label": "y", "popup": { "main": { "label": "]" } } },
{ "label": "u", "popup": { "main": { "label": "<" } } },
{ "label": "i", "popup": { "main": { "label": ">" } } },
{ "label": "o", "popup": { "main": { "label": "{" } } },
{ "label": "p", "popup": { "main": { "label": "}" } } },
{ "label": "oʻ", "labelFlags": 128 }
],
[
{ "label": "a", "popup": { "main": { "label": "@" } } },
{ "label": "s", "popup": { "main": { "label": "#" } } },
{ "label": "d", "popup": { "main": { "label": "$$$" } } },
{ "label": "f", "popup": { "main": { "label": "_" } } },
{ "label": "g", "popup": { "main": { "label": "&" } } },
{ "label": "h", "popup": { "main": { "label": "-" } } },
{ "label": "j", "popup": { "main": { "label": "+" } } },
{ "label": "k", "popup": { "main": { "label": "(" } } },
{ "label": "l", "popup": { "main": { "label": ")" } } },
{ "label": "gʻ", "labelFlags": 128 },
{ "label": "'" }
],
[
{ "label": "z", "popup": { "main": { "label": "*" } } },
{ "label": "x", "popup": { "main": { "label": "\"" } } },
{ "label": "c", "popup": { "main": { "label": "'" } } },
{ "label": "v", "popup": { "main": { "label": ":" } } },
{ "label": "b", "popup": { "main": { "label": ";" } } },
{ "label": "n", "popup": { "main": { "label": "!" } } },
{ "label": "m", "popup": { "main": { "label": "?" } } }
]
]

View file

@ -71,6 +71,13 @@ open class KeyboardBuilder<KP : KeyboardParams>(protected val mContext: Context,
// label flags: some should be set by keyboard, not by row/letter
// e.g. arabic looks weird with number row in holo being bold, but all other letters normal
// careful with korean, iirc the layouts are copied somewhere in the code -> try reading them instead of having them duplicate hardcoded
// check the kbd_files for thing like touchPositionCorrectionData
// issues:
// armenian has label flag fontNormal on all keys -> how to do? define on every letter, or have some other way of doing this?
// add such a label flag to languageKeyTexts (apply only to alphabet layouts)
// fontNormal: armenian, urdu, thai, ...
// armenian bottom row: functional keys should be narrower
// urdu: no labels because the moreKeys are languageMoreKeys -> need the moreKeys setting soon (at least setting to show first language moreKey if no symbol)
// migrate pcqwerty to this style
// this will be more complicated...
// linked shift keys might be easy
@ -156,7 +163,7 @@ open class KeyboardBuilder<KP : KeyboardParams>(protected val mContext: Context,
fun loadFromXml(xmlId: Int, id: KeyboardId): KeyboardBuilder<KP> {
if (Settings.getInstance().current.mUseNewKeyboardParsing
// && id.mElementId != KeyboardId.ELEMENT_ALPHABET_MANUAL_SHIFTED && id.mElementId != KeyboardId.ELEMENT_SYMBOLS_SHIFTED
&& id.mElementId != KeyboardId.ELEMENT_ALPHABET_MANUAL_SHIFTED && id.mElementId != KeyboardId.ELEMENT_SYMBOLS_SHIFTED
&& this::class == KeyboardBuilder::class // otherwise this will apply to moreKeys and moreSuggestions, and then some parameters are off
) {
if (loadFromAssets(id) != null)

View file

@ -240,7 +240,7 @@ abstract class KeyboardParser(private val params: KeyboardParams, private val co
private fun getNumberRow(): ArrayList<KeyParams> =
params.mLocaleKeyTexts.getNumberRow().mapTo(ArrayList()) {
it.toKeyParams(params, labelFlags = Key.LABEL_FLAGS_DISABLE_HINT_LABEL or defaultLabelFlags)
it.toKeyParams(params, additionalLabelFlags = Key.LABEL_FLAGS_DISABLE_HINT_LABEL or defaultLabelFlags)
}
private fun getFunctionalKeyParams(def: String, label: String? = null, moreKeys: Array<String>? = null): KeyParams {

View file

@ -20,6 +20,8 @@ import org.dslul.openboard.inputmethod.latin.common.StringUtils
// added toKeyParams for non-abstract KeyData
// compute is using KeyboardParams (for shift state and variation)
// char_width_selector and kana_selector throw an error (not yet supported)
// added labelFlags to keyDate
// added manualOrLocked for shift_state_selector
/**
* Basic interface for a key data object. Base for all key data objects across the IME, such as text, emojis and
* selectors. The implementation is as abstract as possible, as different features require different implementations.
@ -65,6 +67,7 @@ interface KeyData : AbstractKeyData {
val label: String
val groupId: Int
val popup: PopupSet<AbstractKeyData> // not nullable because can't add number otherwise
val labelFlags: Int
// groups (currently) not supported
companion object {
@ -107,7 +110,7 @@ interface KeyData : AbstractKeyData {
|| code == KeyCode.HALF_SPACE || code == KeyCode.KESHIDA)
}
fun toKeyParams(params: KeyboardParams, width: Float = params.mDefaultRelativeKeyWidth, labelFlags: Int = 0): KeyParams {
fun toKeyParams(params: KeyboardParams, width: Float = params.mDefaultRelativeKeyWidth, additionalLabelFlags: Int = 0): KeyParams {
require(type == KeyType.CHARACTER) { "currently only KeyType.CHARACTER is supported" }
require(groupId == GROUP_DEFAULT) { "currently only KeyData.GROUP_DEFAULT is supported" }
require(code >= 0) { "functional codes ($code) not (yet) supported" }
@ -120,7 +123,7 @@ interface KeyData : AbstractKeyData {
label.rtlLabel(params), // todo (when supported): convert special labels to keySpec
params,
width,
labelFlags, // todo (non-latin): label flags... maybe relevant for some languages
labelFlags or additionalLabelFlags,
Key.BACKGROUND_TYPE_NORMAL, // todo (when supported): determine type
popup.toMoreKeys(params),
)
@ -130,7 +133,7 @@ interface KeyData : AbstractKeyData {
code, // todo (when supported): convert codes < 0, because florisboard layouts should still be usable
params,
width,
labelFlags,
labelFlags or additionalLabelFlags,
Key.BACKGROUND_TYPE_NORMAL,
popup.toMoreKeys(params),
)
@ -204,13 +207,14 @@ class ShiftStateSelector(
val shiftedAutomatic: AbstractKeyData? = null,
val capsLock: AbstractKeyData? = null,
val default: AbstractKeyData? = null,
val manualOrLocked: AbstractKeyData? = null,
) : AbstractKeyData {
override fun compute(params: KeyboardParams): KeyData? {
return when (params.mId.mElementId) {
KeyboardId.ELEMENT_ALPHABET, KeyboardId.ELEMENT_SYMBOLS -> unshifted ?: default
KeyboardId.ELEMENT_ALPHABET_MANUAL_SHIFTED -> shiftedManual ?: shifted ?: default
KeyboardId.ELEMENT_ALPHABET_MANUAL_SHIFTED -> shiftedManual ?: manualOrLocked ?: shifted ?: default
KeyboardId.ELEMENT_ALPHABET_AUTOMATIC_SHIFTED -> shiftedAutomatic ?: shifted ?: default
KeyboardId.ELEMENT_ALPHABET_SHIFT_LOCKED, KeyboardId.ELEMENT_ALPHABET_SHIFT_LOCK_SHIFTED -> capsLock ?: shifted ?: default
KeyboardId.ELEMENT_ALPHABET_SHIFT_LOCKED, KeyboardId.ELEMENT_ALPHABET_SHIFT_LOCK_SHIFTED -> capsLock ?: manualOrLocked ?: shifted ?: default
else -> default // or rather unshifted?
}?.compute(params)
}

View file

@ -32,7 +32,8 @@ class TextKeyData(
override val code: Int = KeyCode.UNSPECIFIED,
override val label: String = "",
override val groupId: Int = KeyData.GROUP_DEFAULT,
override val popup: PopupSet<AbstractKeyData> = PopupSet()
override val popup: PopupSet<AbstractKeyData> = PopupSet(),
override val labelFlags: Int = 0
) : KeyData {
override fun compute(params: KeyboardParams): KeyData {
// if (evaluator.isSlot(this)) { // todo: currency key stuff probably should be taken from florisboard too
@ -75,7 +76,8 @@ class AutoTextKeyData(
override val code: Int = KeyCode.UNSPECIFIED,
override val label: String = "",
override val groupId: Int = KeyData.GROUP_DEFAULT,
override val popup: PopupSet<AbstractKeyData> = PopupSet()
override val popup: PopupSet<AbstractKeyData> = PopupSet(),
override val labelFlags: Int = 0
) : KeyData {
// state and recompute not needed, as upcasing is done when creating KeyParams
@ -113,7 +115,8 @@ class MultiTextKeyData(
val codePoints: IntArray = intArrayOf(),
override val label: String = "",
override val groupId: Int = KeyData.GROUP_DEFAULT,
override val popup: PopupSet<AbstractKeyData> = PopupSet()
override val popup: PopupSet<AbstractKeyData> = PopupSet(),
override val labelFlags: Int = 0
) : KeyData {
@Transient override val code: Int = KeyCode.MULTIPLE_CODE_POINTS

View file

@ -224,7 +224,7 @@ def get_morekeys_texts(write=False):
if script is None:
raise ValueError("undefined script")
if script != "Latn":
continue # skip non-latin scripts for now
continue # skip non-latin scripts
print(file)
keys = read_keys(f"{file}/donottranslate-more-keys.xml")
val.append(keys)
@ -269,7 +269,7 @@ def main():
# k = read_keys(default_file)
# write_keys(pathlib.Path(__file__).parent / f"defaultkeys.txt", k)
keys = get_morekeys_texts(False)
write_combined_lists(keys)
# write_combined_lists(keys)
# need to check strings: