Browse Source

mergehex script that remove duplicate glyphs

main
emile 3 weeks ago
parent
commit
b6166d9eb6
  1. 30
      README.md
  2. 20
      mergehex.sh

30
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. #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): Draw glyphs in a pad following this format (hexadecimal identifier):
F4910: 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 ./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 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 ./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 ## Other useful commands
Convert uniascii to unihex
./unifont/src/hexdraw qunifont.txt > qunifont.hex
Convert unihex to png preview table (-p for plage) Convert unihex to png preview table (-p for plage)
./unifont/src/unihex2png -i qunifont.hex -o qunifont.png -p 0 ./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 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

@ -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
Loading…
Cancel
Save