Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
readme.md
.DS_Store
build/
.DS_Store
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "pebble-firmware-utils"]
path = pebble-firmware-utils
url = https://github.com/MarSoft/pebble-firmware-utils.git
48 changes: 48 additions & 0 deletions autogen/generate_fonts.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
#!/usr/bin/env python3

import os
import json
import glob
import shutil
from PIL import Image

outputs = [
{ "name": "emoji_14", "suffix": "sm", "size": 14, "top": 0 },
{ "name": "emoji_18", "suffix": "sm", "size": 18, "top": 2 },
{ "name": "emoji_24", "suffix": "lg", "size": 24, "top": 0 },
{ "name": "emoji_28", "suffix": "lg", "size": 28, "top": 2 }
]

if not os.path.exists("emoji.json"):
print("You are in a wrong directory to build the fonts")
quit()

os.makedirs("build", exist_ok=True)
emojis_file = open("emoji.json")
emojis_json = json.load(emojis_file)
for folder in ["sm", "lg"]:
files = glob.glob("emoji/*-%s.png" % folder)
os.makedirs("build/%s" % folder, exist_ok=True)
for file in files:
shutil.copyfile(file, "build/%s/%05X.png" % (folder, int(file[file.find('/')+1 : file.find('-')], 16)))
for output in outputs:
output_json = {}
output_json['metadata'] = []
suffix = output["suffix"]
for emoji in emojis_json:
image = Image.open("build/%s/%05X.png" % (suffix, ord(emoji["character"])))
metrics = emoji[suffix]
width, height = image.size
output_json['metadata'].append({
'codepoint': ord(emoji["character"]),
'advance': width + 2, # 1 padding on left and right side
'top': metrics["top"] + output["top"],
'left': 1
})
with open('build/%s.json' % output["name"], 'w') as f:
json.dump(output_json, f)
os.system("cd build && python2 ../pebble-firmware-utils/fontgen.py pfo %d %s %s.pfo --list %s.json && cd .." % (output['size'], suffix, output['name'], output["name"]))
print("Generated build/%s.pfo" % output['name'])
os.remove('build/%s.json' % output["name"])
for folder in ["sm", "lg"]:
shutil.rmtree("build/%s" % folder)
30 changes: 30 additions & 0 deletions autogen/generate_pbl.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/usr/bin/env python3

import os
import shutil

outputs = [
{ "name": "emoji_14", "export": ["001", "002"] },
{ "name": "emoji_18", "export": ["003", "004"] },
{ "name": "emoji_24", "export": ["005", "006"] },
{ "name": "emoji_28", "export": ["007", "008"] }
]

for output in outputs:
if not os.path.exists("build/%s.pfo" % output["name"]):
print("You are in a wrong directory to build the pbl. build/%s.pfo is missing" % output["name"])
quit()

os.makedirs("build/resources/", exist_ok=True)
for output in outputs:
for export in output["export"]:
shutil.copyfile("build/%s.pfo" % output["name"], "build/resources/%s" % export)
if not os.path.exists("build/resources/000"):
os.mknod("build/resources/000")
for n in range(10):
filepath = "build/resources/%03d" % (n + 9)
if not os.path.exists(filepath):
os.mknod(filepath)
os.system("cd build && python2 ../pebble-firmware-utils/pbpack.py resources/ emoji.pbl && cd ..")
print("Generated build/emoji.pbl")
shutil.rmtree("build/resources/")
236 changes: 236 additions & 0 deletions emoji.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,236 @@
[
{
"character": "\u3456",
"lg": {
"top": 1
},
"sm": {
"top": 1
}
},
{
"character": "\uD83E\uDD29",
"lg": {
"top": 1
},
"sm": {
"top": 1
}
},
{
"character": "\ud83d\ude43",
"lg": {
"top": 1
},
"sm": {
"top": 1
}
},
{
"character": "\ud83d\ude44",
"lg": {
"top": 1
},
"sm": {
"top": 1
}
},
{
"character": "\ud83e\udd23",
"lg": {
"top": 1
},
"sm": {
"top": 1
}
},
{
"character": "\ud83e\udd24",
"lg": {
"top": 1
},
"sm": {
"top": 1
}
},
{
"character": "\ud83e\udd7a",
"lg": {
"top": 1
},
"sm": {
"top": 1
}
},
{
"character": "\ud83e\udd70",
"lg": {
"top": 1
},
"sm": {
"top": 1
}
},
{
"character": "\u26a7",
"lg": {
"top": 1
},
"sm": {
"top": 1
}
},
{
"character": "\u2705",
"lg": {
"top": 1
},
"sm": {
"top": 1
}
},
{
"character": "\u274e",
"lg": {
"top": 1
},
"sm": {
"top": 1
}
},
{
"character": "\u2728",
"lg": {
"top": 1
},
"sm": {
"top": 1
}
},
{
"character": "\u2757",
"lg": {
"top": 1
},
"sm": {
"top": 1
}
},
{
"character": "\u2763",
"lg": {
"top": 1
},
"sm": {
"top": 1
}
},
{
"character": "\u2b50",
"lg": {
"top": 1
},
"sm": {
"top": 1
}
},
{
"character": "\ud83c\udf1f",
"lg": {
"top": 1
},
"sm": {
"top": 1
}
},
{
"character": "\ud83d\udcaf",
"lg": {
"top": 1
},
"sm": {
"top": 1
}
},
{
"character": "\ud83c\udfb6",
"lg": {
"top": 1
},
"sm": {
"top": 1
}
},
{
"character": "\ud83c\udff3",
"lg": {
"top": 1
},
"sm": {
"top": 1
}
},
{
"character": "\u231a",
"lg": {
"top": 1
},
"sm": {
"top": 1
}
},
{
"character": "\ud83e\udd18",
"lg": {
"top": 1
},
"sm": {
"top": 1
}
},
{
"character": "\ud83e\udd1d",
"lg": {
"top": 1
},
"sm": {
"top": 1
}
},
{
"character": "\ud83e\udd2a",
"lg": {
"top": 1
},
"sm": {
"top": 1
}
},
{
"character": "\ud83c\udf40",
"lg": {
"top": 1
},
"sm": {
"top": 1
}
},
{
"character": "\ud83e\udd17",
"lg": {
"top": 1
},
"sm": {
"top": 1
}
},
{
"character": "\ud83d\udca5",
"lg": {
"top": 1
},
"sm": {
"top": 1
}
}
]
Binary file modified emoji/1f3b6-lg.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified emoji/2728-lg.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified emoji/2728-sm.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified emoji/2757-lg.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified emoji/2757-sm.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added emoji/3456-lg.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added emoji/3456-sm.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions pebble-firmware-utils
Submodule pebble-firmware-utils added at c3271e