Skip to content

Instantly share code, notes, and snippets.

@jedireza
Last active August 29, 2015 14:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jedireza/c78209d2b4554de5d59e to your computer and use it in GitHub Desktop.
Save jedireza/c78209d2b4554de5d59e to your computer and use it in GitHub Desktop.
Let's land the native FirefoxOS emoji keyboard

Missing

The current font distribution seems to be missing some emojis.

https://github.com/mozilla/fxemoji/blob/gh-pages/dist/all/all.ttf

Strange ascii smiley

This is on the first smiley tab. I don't see an emoji on my mac, just the ascii smiley.

☺

Missing emoji

These emoji display in the keyboard as solid square characters.

πŸ›πŸπŸœπŸžπŸšπŸ πŸŸπŸ‘

πŸŒšπŸŒ‘πŸŒ’πŸŒ“πŸŒ”πŸŒ•πŸŒ–πŸŒ—πŸŒ˜

πŸŒœπŸŒ›πŸŒ™β­

πŸ’ΎπŸ“žπŸ”‰β³β°πŸ’‘

πŸŒ‡πŸ—½

Dev notes

Enable emoji keyboard in build via GAIA_KEYBOARD_LAYOUTS https://github.com/mozilla-b2g/gaia/blob/master/Makefile#L449

Use $ APP=keyboard make install-gaia to only build+install Keyboard app

If you get "failed to copy" messages like these...

failed to copy '/projects/gaia/profile/webapps/keyboard.gaiamobile.org/manifest.webapp' to '//system/b2g/webapps/keyboard.gaiamobile.org/manifest.webapp': Read-only file system

failed to copy '/projects/gaia/profile/webapps/keyboard.gaiamobile.org/application.zip' to '//system/b2g/webapps/keyboard.gaiamobile.org/application.zip': Read-only file system

… then you need to remount via $ adb remount

If remounting doesn’t do the trick you’ll need to $ adb reboot and then $ adb remount

You should see the emoji keyboard item and checkbox under "Settings > Keyboards > Select Keyboards"

If it’s not there but it is listed under "Settings > Keyboards > Built-in Keyboard | Installed Keyboards" … the mozApp API may need refreshing.

To refresh the mozApp API we want to invalidate the device profile's prefs.js gecko.buildID by pulling prefs.js from the device profile, editing it, and pushing it back.

$ adb shell stop b2g # to stop b2g process
$ adb shell ls /data/b2g/mozilla/ # find the profile dictionary
$ adb pull /data/b2g/mozilla/XXXX.default/prefs.js # get the js file locally

Then edit it (we simply changed 2015 to 2099) and push it back with

$ adb push /local/path/to/prefs.js /data/b2g/mozilla/XXXX.default/prefs.js

Restart b2g:

$ adb shell start b2g

If our custom emoji font isn’t on the device image yet. You need to remove the current emoji font and install ours.

$ adb pull /system/fonts/NotoColorEmoji.ttf # backup the device font
$ adb shell # enter device shell
$ rm /system/fonts/NotoColorEmoji.ttf # delete emoji font
$ exit # exit device shell

Download our font and rename it something better like FirefoxEmoji.ttf.

Now we just need to push it to the device:

$ adb push /local/path/to/FirefoxEmoji.ttf /system/fonts/ # push new emoji font

Restart b2g:

$ adb shell stop b2g
$ adb shell start b2g
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment