diff --git a/Makefile b/Makefile
index 72edb5b..a213088 100644
--- a/Makefile
+++ b/Makefile
@@ -6,7 +6,6 @@ ANDROID_PLATFORM_VERSION = android-30
JAVA_VERSION = 1.8
SRC_DIR = srcs
-ASSETS_DIR = assets
RES_DIR = res
EXTRA_JARS =
@@ -46,7 +45,6 @@ JAVAC_FLAGS = -source $(JAVA_VERSION) -target $(JAVA_VERSION) -encoding utf8
MANIFEST_FILE = AndroidManifest.xml
JAVA_FILES = $(shell find $(SRC_DIR) -name '*.java')
RES_FILES = $(shell find $(RES_DIR) -type f)
-ASSETS_FILES = $(shell find $(ASSETS_DIR) -type f 2>/dev/null)
# Debug signing
@@ -80,11 +78,12 @@ _build/%.apk: _build/%.unsigned-apk %-keystore.conf
_build/%.unsigned-apk: _build/%.unaligned-apk
$(ANDROID_BUILD_TOOLS)/zipalign -fp 4 "$<" "$@"
-_build/%.unaligned-apk: _build/classes.dex $(MANIFEST_FILE) $(ASSETS_FILES)
+APK_EXTRA_FILES = classes.dex assets/special_font.ttf
+
+_build/%.unaligned-apk: $(addprefix _build/,$(APK_EXTRA_FILES)) $(MANIFEST_FILE)
$(ANDROID_BUILD_TOOLS)/aapt package -f -M $(MANIFEST_FILE) -S $(RES_DIR) \
-I $(ANDROID_PLATFORM)/android.jar -F "$@" $(AAPT_PACKAGE_FLAGS)
- [ -z "$(ASSETS_FILES)" ] || $(ANDROID_BUILD_TOOLS)/aapt add "$@" $(ASSETS_FILES)
- cd $(@D) && $(ANDROID_BUILD_TOOLS)/aapt add $(@F) classes.dex
+ cd $(@D) && $(ANDROID_BUILD_TOOLS)/aapt add $(@F) $(APK_EXTRA_FILES)
# R.java
@@ -96,6 +95,16 @@ $(R_FILE): $(RES_FILES) $(MANIFEST_FILE)
$(ANDROID_BUILD_TOOLS)/aapt package -f -m -S $(RES_DIR) -J $(GEN_DIR) \
-M $(MANIFEST_FILE) -I $(ANDROID_PLATFORM)/android.jar
+# Special font
+
+SPECIAL_FONT_BASE_FONT = srcs/special_font/base_font.ttf
+SPECIAL_FONT_GLYPHS = $(wildcard srcs/special_font/*.svg)
+SPECIAL_FONT_SCRIPT = srcs/special_font/build.pe
+
+_build/assets/special_font.ttf: $(SPECIAL_FONT_SCRIPT) $(SPECIAL_FONT_BASE_FONT) $(SPECIAL_FONT_GLYPHS)
+ mkdir -p $(@D)
+ fontforge -lang=ff -script $(SPECIAL_FONT_SCRIPT) $@ $(SPECIAL_FONT_BASE_FONT) $(SPECIAL_FONT_GLYPHS)
+
# Compile java classes and build classes.dex
OBJ_DIR = _build/class
diff --git a/assets/fonts/README.md b/assets/fonts/README.md
deleted file mode 100644
index ba0ff7c..0000000
--- a/assets/fonts/README.md
+++ /dev/null
@@ -1,15 +0,0 @@
-# Fonts
-
-The glyphs from this font are made by:
-
-- Home and End
- Author: @sdrapha
-
-- Cog
- Copyright (C) 2016 by Dave Gandy
- Author: Dave Gandy
- License: SIL ()
-
-- Emoticon, PageUp and PageDown
- IcoMoon-Free is a free vector icon pack by Keyamoon.
- License: Attribution 4.0 International (CC BY 4.0)
diff --git a/shell.nix b/shell.nix
index 76ee98e..8036a5e 100644
--- a/shell.nix
+++ b/shell.nix
@@ -14,6 +14,6 @@ let
in
pkgs.mkShell {
- buildInputs = [ pkgs.findutils jdk android.androidsdk ];
+ buildInputs = [ pkgs.findutils jdk android.androidsdk pkgs.fontforge ];
ANDROID_HOME = "${android.androidsdk}/libexec/android-sdk";
}
diff --git a/srcs/juloo.keyboard2/KeyValue.java b/srcs/juloo.keyboard2/KeyValue.java
index 9cee797..9c0c080 100644
--- a/srcs/juloo.keyboard2/KeyValue.java
+++ b/srcs/juloo.keyboard2/KeyValue.java
@@ -228,10 +228,10 @@ class KeyValue
addCharKey('€', EVENT_NONE, FLAG_LOCALIZED);
addCharKey('£', EVENT_NONE, FLAG_LOCALIZED);
- addSpecialKey("config", "\uE806", EVENT_CONFIG, FLAG_KEY_FONT | FLAG_SMALLER_FONT);
+ addSpecialKey("config", "\u0004", EVENT_CONFIG, FLAG_KEY_FONT | FLAG_SMALLER_FONT);
addSpecialKey("switch_text", "ABC", EVENT_SWITCH_TEXT);
addSpecialKey("switch_numeric", "123+", EVENT_SWITCH_NUMERIC);
- addSpecialKey("switch_emoji", "\uE812" , EVENT_SWITCH_EMOJI, FLAG_KEY_FONT | FLAG_SMALLER_FONT);
+ addSpecialKey("switch_emoji", "\u0001" , EVENT_SWITCH_EMOJI, FLAG_KEY_FONT | FLAG_SMALLER_FONT);
addSpecialKey("switch_back_emoji", "ABC", EVENT_SWITCH_BACK_EMOJI);
addSpecialKey("change_method", "\ue807", EVENT_CHANGE_METHOD, FLAG_KEY_FONT | FLAG_SMALLER_FONT);
addSpecialKey("action", "Action", EVENT_ACTION, FLAG_SMALLER_FONT); // Will always be replaced
@@ -242,8 +242,8 @@ class KeyValue
addEventKey("right", "\uE80C", KeyEvent.KEYCODE_DPAD_RIGHT, FLAG_KEY_FONT | FLAG_PRECISE_REPEAT);
addEventKey("down", "\uE809", KeyEvent.KEYCODE_DPAD_DOWN, FLAG_KEY_FONT | FLAG_PRECISE_REPEAT);
addEventKey("left", "\uE80A", KeyEvent.KEYCODE_DPAD_LEFT, FLAG_KEY_FONT | FLAG_PRECISE_REPEAT);
- addEventKey("page_up", "\uE810", KeyEvent.KEYCODE_PAGE_UP, FLAG_KEY_FONT);
- addEventKey("page_down", "\uE811", KeyEvent.KEYCODE_PAGE_DOWN, FLAG_KEY_FONT);
+ addEventKey("page_up", "\u0002", KeyEvent.KEYCODE_PAGE_UP, FLAG_KEY_FONT);
+ addEventKey("page_down", "\u0003", KeyEvent.KEYCODE_PAGE_DOWN, FLAG_KEY_FONT);
addEventKey("home", "\uE80E", KeyEvent.KEYCODE_MOVE_HOME, FLAG_KEY_FONT);
addEventKey("end", "\uE80F", KeyEvent.KEYCODE_MOVE_END, FLAG_KEY_FONT);
addEventKey("backspace", "⌫", KeyEvent.KEYCODE_DEL, FLAG_SMALLER_FONT);
diff --git a/srcs/juloo.keyboard2/Theme.java b/srcs/juloo.keyboard2/Theme.java
index 3d57fe7..548e291 100644
--- a/srcs/juloo.keyboard2/Theme.java
+++ b/srcs/juloo.keyboard2/Theme.java
@@ -70,7 +70,7 @@ public class Theme
{
if (_specialKeyFont == null)
{
- _specialKeyFont = Typeface.createFromAsset(context.getAssets(), "fonts/keys.ttf");
+ _specialKeyFont = Typeface.createFromAsset(context.getAssets(), "special_font.ttf");
}
return _specialKeyFont;
}
diff --git a/srcs/special_font/01.svg b/srcs/special_font/01.svg
new file mode 100644
index 0000000..86169a4
--- /dev/null
+++ b/srcs/special_font/01.svg
@@ -0,0 +1,7 @@
+
+
+
+
+
diff --git a/srcs/special_font/02.svg b/srcs/special_font/02.svg
new file mode 100644
index 0000000..3eab9dc
--- /dev/null
+++ b/srcs/special_font/02.svg
@@ -0,0 +1,16 @@
+
+
+
+
+
diff --git a/srcs/special_font/03.svg b/srcs/special_font/03.svg
new file mode 100644
index 0000000..a4140eb
--- /dev/null
+++ b/srcs/special_font/03.svg
@@ -0,0 +1,16 @@
+
+
+
+
+
diff --git a/srcs/special_font/04.svg b/srcs/special_font/04.svg
new file mode 100644
index 0000000..2a52ef7
--- /dev/null
+++ b/srcs/special_font/04.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/srcs/special_font/README.md b/srcs/special_font/README.md
new file mode 100644
index 0000000..baa8bb6
--- /dev/null
+++ b/srcs/special_font/README.md
@@ -0,0 +1,8 @@
+# Fonts
+
+See copyright notice in each SVG files.
+
+The glyphs in `base_font.ttf` are made by:
+
+- Home and End
+ Author: @sdrapha
diff --git a/assets/fonts/keys.ttf b/srcs/special_font/base_font.ttf
similarity index 57%
rename from assets/fonts/keys.ttf
rename to srcs/special_font/base_font.ttf
index aa5cf8c..2bfd130 100644
Binary files a/assets/fonts/keys.ttf and b/srcs/special_font/base_font.ttf differ
diff --git a/srcs/special_font/build.pe b/srcs/special_font/build.pe
new file mode 100644
index 0000000..fab828b
--- /dev/null
+++ b/srcs/special_font/build.pe
@@ -0,0 +1,15 @@
+# The special font is used for the symbols of some keys. It is built from SVG
+# files, one for each glyph.
+
+# Starts from an existing font file for glyphs that don't have SVG sources yet.
+Open($2)
+
+# Imports glyphs, file name is position in the font.
+i = 3
+while (i < $argc)
+ Select(Strtol($argv[i]:t:r))
+ Import($argv[i])
+ i++
+endloop
+
+Generate($1)