mergehex script that remove duplicate glyphs

This commit is contained in:
emile 2024-10-31 12:53:40 +01:00
parent 5c028afc72
commit b6166d9eb6
2 changed files with 38 additions and 12 deletions

View File

@ -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
Run `mergehex.sh` to convert `qunifont.txt` (uniascii) to unihex and merge it with the `unfont-base.hex` 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
???
./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

20
mergehex.sh Executable file
View File

@ -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