Skip to content

fix(android): fix setting font#16178

Draft
ermshiperete wants to merge 1 commit into
masterfrom
fix/android/16096_followup
Draft

fix(android): fix setting font#16178
ermshiperete wants to merge 1 commit into
masterfrom
fix/android/16096_followup

Conversation

@ermshiperete

@ermshiperete ermshiperete commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

The previous PR introduced a problem with selecting a different font for a keyboard so that we always ended up with not setting the font. This was caused by the font filenames now being a URL (which is necessary because they get processed by the web engine). However, the Android code checks for the existence of the font in order to create the typeface. This only works with local paths. This change checks if a filename is a URL and converts to a local path, thus allowing File.exists() to succeed.

Follows: #16146
Fixes: #16187
Build-bot: release:android

User Testing

TEST_FONT:

  • install the KeyboardHarness apk from this PR
  • Switch to the "longpress '"|5% +" keyboard
  • type some text and verify that the Code2001 font is used (this can be easily seen with some characters, e.g. "g" or "J"; the OSK is displaying the correct font)

@github-project-automation github-project-automation Bot moved this to Todo in Keyman Jul 1, 2026
@keymanapp-test-bot keymanapp-test-bot Bot added the user-test-missing User tests have not yet been defined for the PR label Jul 1, 2026
@keymanapp-test-bot

keymanapp-test-bot Bot commented Jul 1, 2026

Copy link
Copy Markdown

User Test Results

Test specification and instructions

  • TEST_FONT (OPEN)
Results Template
# Test Results

* **TEST_FONT (OPEN):** notes

Test Artifacts

@mcdurdin

mcdurdin commented Jul 2, 2026

Copy link
Copy Markdown
Member

Does this resolve the crash in Sample1 (#16180) or is it a separate issue?

@ermshiperete ermshiperete force-pushed the fix/android/16096_followup branch from eb809e5 to 12cda26 Compare July 2, 2026 09:46
The previous PR (#16146) introduced a problem with selecting a different
font for a keyboard so that we always ended up with not setting the font.
This was caused by the font filenames now being a URL (which is necessary
because they get processed by the web engine). However, the Android code
checks for the existence of the font in order to create the typeface.
This only works for local paths. This change checks if a filename is a
URL and converts to a local path, thus allowing `File.exists()` to
succeed.

Follows: #16146
Build-bot: release:android
@ermshiperete ermshiperete force-pushed the fix/android/16096_followup branch from 12cda26 to 035af3c Compare July 2, 2026 09:47
@ermshiperete

Copy link
Copy Markdown
Contributor Author

Does this resolve the crash in Sample1 (#16180) or is it a separate issue?

That's separate, although #16180 likely has a similar cause.

@ermshiperete

ermshiperete commented Jul 2, 2026

Copy link
Copy Markdown
Contributor Author

Hmm, I'm not sure that my analysis "we always ended up with not setting the font" is correct. I can see in the debugger that without the changes in this PR KMManager.getFontTypeface will always return null. However, I don't see a difference in the UI when testing this PR vs master, i.e. I don't see that it is wrong in master 😕

@keymanapp-test-bot keymanapp-test-bot Bot added has-user-test user-test-required User tests have not been completed and removed user-test-missing User tests have not yet been defined for the PR labels Jul 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Todo

Development

Successfully merging this pull request may close these issues.

bug(android): KeyboardHarness uses wrong font after #16146

2 participants