From 39952f8bdf2ee77e32152bf67df456a83e3e03fe Mon Sep 17 00:00:00 2001 From: Jules Aguillon Date: Sun, 24 Apr 2022 20:52:36 +0200 Subject: [PATCH] Remove build dependency on Fontforge The required version of fontforge (from 2020!) is not available in many distros. This is an annoying for contributors and greatly complicated the CI and F-Droid scripts. The generated font file is now included in the sources. Fontforge is still needed when adding new glyphs but this is not a common operation. --- .github/workflows/make-apk.yml | 17 ++--------------- CONTRIBUTING.md | 10 +++------- Makefile | 19 +++++++++---------- srcs/special_font/build.pe | 4 ++-- srcs/special_font/result.ttf | Bin 0 -> 6260 bytes 5 files changed, 16 insertions(+), 34 deletions(-) create mode 100644 srcs/special_font/result.ttf diff --git a/.github/workflows/make-apk.yml b/.github/workflows/make-apk.yml index 6457576..3f872ba 100644 --- a/.github/workflows/make-apk.yml +++ b/.github/workflows/make-apk.yml @@ -9,19 +9,6 @@ jobs: Build-Apk: runs-on: ubuntu-latest steps: - - name: Cache fontforge and extra dependencies - uses: actions/cache@v2 - with: - path: /usr/local/bin - key: usr-local-bin - - name: Install latest FontForge version (using AppImage) - run: | - # Get most recent version of FontForge - # Using AppImage there is no dependecy problem, it is the latest version and it's easier to cache - cd /usr/local/bin - sudo wget -c -N https://github.com/fontforge/fontforge/releases/download/20220308/FontForge-2022-03-08-582bd41-x86_64.AppImage - sudo chmod +x ./FontForge-2022-03-08-582bd41-x86_64.AppImage - sudo ln --symbolic --force /usr/local/bin/FontForge-2022-03-08-582bd41-x86_64.AppImage /usr/local/bin/fontforge - uses: actions/setup-java@v2 with: distribution: 'zulu' # See 'Supported distributions' for available options @@ -36,11 +23,11 @@ jobs: - name: Restore debug keystore from github Secrets run: | mkdir -p _build - cd "$GITHUB_WORKSPACE/_build" + cd "_build" # Check if exist and use the secret named DEBUG_KEYSTORE # The contents of the secret can be obtained - # from the debug.keystore.asc from you local _build folder - if [[ ! "${{ secrets.DEBUG_KEYSTORE }}" == "" ]]; then + if [[ ! "${{ secrets.DEBUG_KEYSTORE }}" = "" ]]; then echo "${{ secrets.DEBUG_KEYSTORE }}" > "debug.keystore.asc" if [[ -s "debug.keystore.asc" ]]; then gpg -d --passphrase "debug0" --batch "debug.keystore.asc" > "debug.keystore" diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index bc4b288..4a107b1 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -11,9 +11,9 @@ Fortunately, there's not many dependencies: - OpenJDK 8 - Android SDK: build tools (minimum `28.0.1`), platform `30` - Make sure to have the `$ANDROID_HOME` environment variable set. -- FontForge version >= 20201107 -For Nix users, there's a `shell.nix` for setting-up the right environment. +For Nix users, the right environment can be obtained with `nix-shell ./shell.nix`. +Instructions to install Nix are [here](https://nixos.wiki/wiki/Nix_Installation_Guide). Building the debug apk: @@ -21,11 +21,7 @@ Building the debug apk: make ``` -If the build succeed, the debug apk is located in -`_build/juloo.keyboard2.debug.apk`. - -If the build doesn't succeeded check the FontForge version, the version needed is 20201107. -Try to use the nix-shell, instructions to install [here](https://nixos.wiki/wiki/Nix_Installation_Guide) +If the build succeed, the debug apk is located in `_build/juloo.keyboard2.debug.apk`. ## Using the local debug.keystore on the Github CI actions diff --git a/Makefile b/Makefile index a606299..a731a0b 100644 --- a/Makefile +++ b/Makefile @@ -22,7 +22,10 @@ clean: rm -rf _build/*.dex _build/class _build/gen _build/*.apk _build/*.unsigned-apk \ _build/*.idsig _build/assets -.PHONY: release debug installd clean +rebuild_special_font: + cd srcs/special_font && fontforge -lang=ff -script build.pe *.svg + +.PHONY: release debug installd clean rebuild_special_font $(shell mkdir -p _build) @@ -85,6 +88,11 @@ _build/%.unaligned-apk: $(addprefix _build/,$(APK_EXTRA_FILES)) $(MANIFEST_FILE) -I $(ANDROID_PLATFORM)/android.jar -F "$@" $(AAPT_PACKAGE_FLAGS) cd $(@D) && $(ANDROID_BUILD_TOOLS)/aapt add $(@F) $(APK_EXTRA_FILES) +# Copy the special font file into _build because aapt requires relative paths +_build/assets/special_font.ttf: srcs/special_font/result.ttf + mkdir -p $(@D) + cp "$<" "$@" + # R.java GEN_DIR = _build/gen @@ -95,15 +103,6 @@ $(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_GLYPHS = $(wildcard $(CURDIR)/srcs/special_font/*.svg) -SPECIAL_FONT_SCRIPT = $(CURDIR)/srcs/special_font/build.pe - -_build/assets/special_font.ttf: $(SPECIAL_FONT_SCRIPT) $(SPECIAL_FONT_GLYPHS) - mkdir -p $(@D) - fontforge -lang=ff -script $(SPECIAL_FONT_SCRIPT) $(CURDIR)/$@ $(SPECIAL_FONT_GLYPHS) - # Compile java classes and build classes.dex OBJ_DIR = _build/class diff --git a/srcs/special_font/build.pe b/srcs/special_font/build.pe index 4e2754d..962917f 100644 --- a/srcs/special_font/build.pe +++ b/srcs/special_font/build.pe @@ -3,7 +3,7 @@ New() # Imports glyphs, file name is position in the font. -i = 2 +i = 1 while (i < $argc) Select(Strtol($argv[i]:t:r, 16)) Import($argv[i], 0, 0, 4.0, 0.1) @@ -11,4 +11,4 @@ while (i < $argc) i++ endloop -Generate($1) +Generate("result.ttf") diff --git a/srcs/special_font/result.ttf b/srcs/special_font/result.ttf new file mode 100644 index 0000000000000000000000000000000000000000..8434a3f15095267e5bdb06c8920893b03cbb1878 GIT binary patch literal 6260 zcmc&&du&tZ6+h>@_Pue4lQ@ojlaPn)oA{Ct5O%p+MomPYT}M(GB&UEnE850$?XepXwj!8$0mg-X8$4 zN|Fut?~mEQ&c*?_lT@!8>f1XuH%C38Xqd`bL&M|S--*pofA04Hrq^~1_6m@ctl9!Vd{|s)V)(rGCPg+v#oKNevw++zzBW&etstsh@G*xPCI1BMMKpY0U z+J$pNmo5hF+;v#Zy$j8{AcQ$1v~VKHk~FM40$rS! z+7o$FqYKNbY@wWZRjrmwHM_QxM76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