Guide: build an in-app keyboard

I’m trying to add font to kMsample as guide point 5 but it’s not working?
I add font file to assets and add name of font to build custom keyboard can you see what the wrong?

// Add a custom keyboard
    Keyboard kbInfo = new Keyboard(
      "himyarit_musnad", // Package ID - filename of the .kmp file
      "himyarit_musnad", // Keyboard ID
      "Himyarit musnad", // Keyboard Name
      "Xsa",             // Language ID
      "Sabaean",          // Language Name
      "1.2",            // Keyboard Version
      null,             // URL to help documentation if available
      "",               // URL to latest .kmp file
      true,             // Boolean to show this is a new keyboard in the keyboard picker

      // Font information of the .ttf font to use in KMSample1 (for example "aava1.ttf").
      // basic_kbdtam99 doesn't include a font. Can set blank "" or KMManager.KMDefault_KeyboardFont
      KMManager.KMDefault_KeyboardFont,  // "AF_Najed.ttf")
      KMManager.KMDefault_KeyboardFont); // Font for OSK
    KMManager.addKeyboard(this, kbInfo"

Guide: build an in-app keyboard

Can you be a little more specific? Are you getting compile errors, or what exactly is not working as you expect?

1 Like

No errors but the font didn’t change when i test keyboard with android studio.
Kmp for my keyboard is working good with keyman app .

The himyarit_musnad keyboard includes the SultanMusnad-Normal.ttf. You need to specify this in the last parameter of new Keyboard():

Keyboard kbInfo = new Keyboard(
  "himyarit_musnad", // Package ID - filename of the .kmp file
  ... // unchanged parameters snipped here
  "SultanMusnad-Normal.ttf"); // Font for OSK

What about this point (didn’t change anything)
KMManager.KMDefault_KeyboardFont, // " for KMSample1 text field
KMManager.KMDefault_KeyboardFont); // Font for OSK

"SultanMusnad-Normal.ttf" is not a font we include by default.

You’ll want to replace the // "AF_Najed.ttf") line’s entry with this filename, and possibly the second one as well. So, delete KMManager.KMDefault_KeyboardFont and replace it with "SultanMusnad-Normal.ttf".

1 Like

Thanks joshua its done :+1:

Thanks all its done as