spiegel-keyman/android/docs/engine/KMManager/getKeyboardTextFontFilename.md
Eberhard Beilharz 1191e4387f
fix(android): fix setting font
PR #16146 introduced a problem with selecting a different font as
display font 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,
which only works for local paths.

This PR modifies and simplifies `KMKeyboard.getFontFilename` to return the
full path, renames `KMKeyboard.txtFont` and `KMKeyboard.oskFont` to make
it clearer that they contain a path and not a URL.

Also initialize `KMKeyboard.oskFontPath` with empty string instead of
`null`. This makes it consistent with` txtFontPath` and with the
documented behavior of `KMManager.getKeyboardOskFontFilename()` (which
returns `KMKeyboard.oskFontPath`).

Follows: #16146
Fixes: #16187
Build-bot: release:android
2026-07-02 19:52:35 +02:00

41 lines
942 B
Markdown

---
title: KMManager.getKeyboardTextFontFilename()
---
## Summary
The **`getKeyboardTextFontFilename()`** method returns the selected
keyboard's text font filename and full path.
## Syntax
``` java
KMManager.getKeyboardTextFontFilename()
```
### Returns
Returns the selected keyboard's text font filename and full path as
`String` if it has any, empty string otherwise.
## Description
Use this method to get the text font filename of the selected keyboard.
## Examples
### Example: Using `getKeyboardTextFontFilename()`
The following script illustrate the use of
`getKeyboardTextFontFilename()`:
``` java
String textFontFilename = KMManager.getKeyboardTextFontFilename();
```
## See also
- [`getKeyboardOskFontFilename()`](getKeyboardOskFontFilename)
- [`getKeyboardTextFontTypeface()`](getKeyboardTextFontTypeface)
- [`getKeyboardOskFontTypeface()`](getKeyboardOskFontTypeface)
- [`getFontTypeface()`](getFontTypeface)