Repository navigation
input/osk: add Chinese keyboard pages (pinyin initial index) - #19735
Open
metahubaifeel wants to merge 1 commit into
Open
metahubaifeel wants to merge 1 commit into
metahubaifeel wants to merge 1 commit into
Conversation
The on-screen keyboard behind the menu's text entries has pages for
Japanese kana and Korean since the extended-IME work, but nothing for
Chinese - which needs a different shape, since 3500+ common characters
cannot fit a 4x11 grid the way 24 jamo or 92 kana can.
Rather than a pinyin IME, this adds a two-level layout:
* an index page holding a-z, and
* 63 character pages, one per pinyin initial (a, b1-b3, c1-c3, ...),
each holding 30 of the most common characters for that initial
The character set is not guesswork: it is counted from the game titles
that appear in playlists (8171 titles, 1515 distinct hanzi, 21521
occurrences), ordered by frequency, so the first page of each initial
holds the characters people look for most.
Tapping an initial on the index jumps to that initial's first page,
tapping a character appends it to the line, and the house key returns
to the index. Characters are whole UTF-8 codepoints, so unlike Korean
no composition step is needed.
Gated behind HAVE_LANGEXTRA like the other extra pages, so builds
without it are unaffected.
Verified: compiles, and all 1515 characters are present in the
resulting library by byte comparison. No on-device run - the test
device's ROM blocks adb input injection.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this does
Adds a Chinese key page set to the on-screen keyboard used by menu text
entries (load-content search, playlist search, file browser filters, ...).
The OSK already has pages for Japanese kana and Korean (added with the
extended-IME work), and those work because their inventories are small —
24 jamo, 92 kana. Chinese is not: 3500+ common characters cannot be laid
out as a 4x11 grid the way those can.
So instead of trying to, this adds a two-level layout:
a–z, anda,b1–b3,c1–c3, …),each holding 30 of the most common characters for that initial.
Tapping an initial on the index jumps to that initial's first page.
Tapping a character appends it to the line. The house key returns to the index.
Why the character set is what it is
Rather than a hand-picked "top 1000 hanzi" list, the table is counted from
game titles that actually occur in playlists:
Characters are grouped by pinyin initial, sorted by frequency within each
group, and cut into pages of 30. So the first page of each initial carries
the characters people are most likely to be looking for, and later pages
carry the long tail.
The generator that produces
input/chinese_osk_pages.his included in thecommit that adds the table — the table is generated, not maintained by hand.
Notes
HAVE_LANGEXTRAwith the other extra pages, so builds withoutit are byte-for-byte unaffected (
OSK_TYPE_LASTstays where it was).composition step —
input_keyboard_line_append()takes them directly.for the 30-per-page figure (11 columns, 4 rows, one row of functions and
one key reserved on the last three rows).
Testing
arm64-v8a(Android).libretroarch-activity.soby byte comparison, against the source table.OSK_TYPE_LASTand the enum/switch/table three-way consistency assertedby a script.
No on-device run. The test device is a vendor ROM that blocks adb input
injection (
INJECT_EVENTS), so tapping through the keyboard could not beautomated. Reviewing the page layout on a device is welcome if you want it
before merge.
Related
If a platform already has a working system IME, that path is preferable and
still wins — this is for when there is none, or when the user is driving the
menu with a gamepad. On Android,
input_android_system_keyboard(1.22+)already covers the IME case, so this is complementary rather than a
replacement: a native panel takes priority when it is available, and these
pages cover the rest.