From b6166d9eb67e10bbfc5508027a57abc75bdae3c4 Mon Sep 17 00:00:00 2001 From: emile Date: Thu, 31 Oct 2024 12:53:40 +0100 Subject: [PATCH] mergehex script that remove duplicate glyphs --- README.md | 30 ++++++++++++++++++------------ mergehex.sh | 20 ++++++++++++++++++++ 2 files changed, 38 insertions(+), 12 deletions(-) create mode 100755 mergehex.sh diff --git a/README.md b/README.md index b9427c7..bacd6f1 100644 --- a/README.md +++ b/README.md @@ -14,6 +14,10 @@ Change the GLYPH_MAX_WIDTH variable from hex2otf.c to 64 and compile it with `gc #define GLYPH_MAX_WIDTH 64 ///< Maximum glyph width, in pixels. +TODO: change metadata + + see unifont/src/hex2otf + Draw glyphs in a pad following this format (hexadecimal identifier): F4910: @@ -34,21 +38,13 @@ Draw glyphs in a pad following this format (hexadecimal identifier): ---------------- ---------------- -Run `padascii2uniascii` to download the pad's content and format it for the Unifont utilities (uniascii) +Run `padascii2uniascii.sh` to download the pad's content and format it for the Unifont utilities (uniascii) ./padascii2uniascii.sh http://88.127.187.90:9001/p/qunifont > qunifont.txt -Use the Unifont hex glyphs as a base file - - cp unifont/font/planee00/unifont-base.hex qunifont.hex - -Convert uniascii to unihex and add them to the base file - - ./unifont/src/hexdraw qunifont.txt >> qunifont.hex - -TODO: remove duplicate id +Run `mergehex.sh` to convert `qunifont.txt` (uniascii) to unihex and merge it with the `unfont-base.hex` file - ??? + ./mergehex.sh Convert unihex to bdf @@ -58,10 +54,16 @@ Convert unihex to otf, --help for format list ./unifont/src/hex2otf hex=qunifont.hex out=qunifont.otf format=truetype -TODO: add OpenType features, change metadata +TODO: add OpenType features + + see https://gitlab.com/bye-bye-binary/typotheque/-/raw/master/features-samples/features_exemple_long.fea ## Other useful commands +Convert uniascii to unihex + + ./unifont/src/hexdraw qunifont.txt > qunifont.hex + Convert unihex to png preview table (-p for plage) ./unifont/src/unihex2png -i qunifont.hex -o qunifont.png -p 0 @@ -80,3 +82,7 @@ Print specific glyph in terminal from hexcode printf %b\\n \\U1F480 💀 + +Download .fea from BBB + + wget https://gitlab.com/bye-bye-binary/typotheque/-/raw/master/features-samples/features_exemple_long.fea diff --git a/mergehex.sh b/mergehex.sh new file mode 100755 index 0000000..20eaf00 --- /dev/null +++ b/mergehex.sh @@ -0,0 +1,20 @@ +#!/bin/bash + +# convert qunifont uniascii to unihex +./unifont/src/hexdraw qunifont.txt > qunifont.hex + +# get new glyphs ids +ids=(); +for i in `cat qunifont.hex`; do + ids+=($(echo "$i" | cut -d : -f 1):) +done; + +# remove duplicate ids from unifont.hex +cp unifont/font/plane00/unifont-base.hex unifont.hex +for i in "${ids[@]}"; do + echo $i; + sed -i "/^$i/d" unifont.hex +done; + +# concat qunifont.hex to cleaned unifont.hex +cat qunifont.hex >> unifont.hex && cp unifont.hex qunifont.hex