From 2dbd18c1e85defb0eec444303016c13b120bb9e4 Mon Sep 17 00:00:00 2001 From: neodarz Date: Sat, 21 Nov 2020 19:07:47 +0100 Subject: Make the font more lighter --- README.md | 19 +++++++++ index.html | 2 +- letters-in-ascii.txt | 112 +++++++++++++++++++++++++++++++++++++++++++++++++ letters-in-unicode.txt | 56 +++++++++++++++++++++++++ 4 files changed, 188 insertions(+), 1 deletion(-) create mode 100644 letters-in-ascii.txt create mode 100644 letters-in-unicode.txt diff --git a/README.md b/README.md index e466991..e8f8b72 100644 --- a/README.md +++ b/README.md @@ -9,3 +9,22 @@ website elsewhere. For keeping this repo light, the font unifont_jp-13.0.03.ttf is not commited. The official website is: http://unifoundry.com/unifont/index.html + +*BUT* the font is overweight (11MB!) for reduce it one can use the following +command to generate the ascii list of used char (don't forget to update it +if needed). The unicode list aswell the unicode list is commited for simplicity. + +``` +python -c 'import sys; print("\n".join(["u+%04x" % (ord(c)) for c in sys.stdin.read()]))' < letters-in-unicode.txt > letters-in-ascii.txt +``` + +Then you need to generated the lightened font based on the official you need +to install [fonttools](https://github.com/fonttools/fonttools) and use the +following command: + +``` +pyftsubset unifont_jp-13.0.03.ttf --output-file=unifont_jp-13.0.03_custom.ttf --unicodes-file=letters-in-ascii.txt +``` + +The file `unifont_jp-13.0.03_custom.ttf` *IS* the font name hardcoded in the +page style! diff --git a/index.html b/index.html index 87a438b..255a62b 100644 --- a/index.html +++ b/index.html @@ -7,7 +7,7 @@ @font-face { font-family: "unifont_jp"; - src: url("/unifont_jp-13.0.03.ttf") format("truetype"); + src: url("/unifont_jp-13.0.03_custom.ttf") format("truetype"); } html { diff --git a/letters-in-ascii.txt b/letters-in-ascii.txt new file mode 100644 index 0000000..b2fc1fe --- /dev/null +++ b/letters-in-ascii.txt @@ -0,0 +1,112 @@ +u+003d +u+000a +u+0020 +u+000a +u+0027 +u+000a +u+0040 +u+000a +u+005f +u+000a +u+0029 +u+000a +u+006f +u+000a +u+003a +u+000a +u+003c +u+000a +u+002e +u+000a +u+003b +u+000a +u+0027 +u+000a +u+003e +u+000a +u+002f +u+000a +u+0060 +u+000a +u+005f +u+000a +u+007c +u+000a +u+0028 +u+000a +u+002c +u+000a +u+005c +u+000a +u+007e +u+000a +u+0050 +u+000a +u+0041 +u+000a +u+0043 +u+000a +u+0045 +u+000a +u+004e +u+000a +u+0045 +u+000a +u+0054 +u+000a +u+002d +u+000a +u+0053 +u+000a +u+0070 +u+000a +u+0061 +u+000a +u+0063 +u+000a +u+0065 +u+000a +u+0041 +u+000a +u+006c +u+000a +u+0069 +u+000a +u+0063 +u+000a +u+006f +u+000a +u+0072 +u+000a +u+006e +u+000a +u+2588 +u+000a +u+2593 +u+000a +u+2591 +u+000a +u+30bb +u+000a +u+30eb +u+000a +u+30d5 +u+000a +u+30db +u+000a +u+30b9 +u+000a +u+30c8 +u+000a +u+30cd +u+000a +u+30c3 +u+000a +u+30c8 +u+000a +u+30ef +u+000a +u+30fc +u+000a +u+30af +u+000a diff --git a/letters-in-unicode.txt b/letters-in-unicode.txt new file mode 100644 index 0000000..f6c1f9d --- /dev/null +++ b/letters-in-unicode.txt @@ -0,0 +1,56 @@ += + +' +@ +_ +) +o +: +< +. +; +' +> +/ +` +_ +| +( +, +\ +~ +P +A +C +E +N +E +T +- +S +p +a +c +e +A +l +i +c +o +r +n +█ +▓ +░ +セ +ル +フ +ホ +ス +ト +ネ +ッ +ト +ワ +ー +ク -- cgit v1.2.1