Closed antfu closed 4 years ago
Thanks for the feedback!
The font name is not specified
Hmmm... I did set it to QIJI
in fontforge (workflow/forge_font.py
) and it shows up correctly on Font Book (mac's built-in font manager). Which software you're using shows it as Untitled1
?
ttf, otf, woff, woff2, etc
Definitely going to build them! Currently I'm remaking the ttf all the time for fixing/testing, so I don't want to complicate it by building all the other formats. I believe fontforge which I'm using to generate TTF is also capable of writing other formats. But thanks for the resources! Glad to know more ways.
Maybe it's better to attach the compiled font file to releases instead of source control
Yeah you're right, I'm just being lazy :P
Would play with it and make some feedback when I finished the toolings.
(Supposing you haven't got your new macbook yet), I'm using mac's built-in Automator to generate images of pages from PDF (workflow/split_pdf.workflow
). If you have to use a different software to split the pages, the naming and the output dimension may be different, potentially breaking all other scripts. Let me know which one of the following do you prefer:
Anyways, take your time, and thanks a lot for your feed back :D
Which software you're using shows it as Untitled1?
The built-in font view of Windows.
And as I am trying to install it:
This may because Windows uses different filed for font name than Mac
Wait till you get a Mac
Yeah, actually I am done with Python on Windows, it's really a mess XD. Please wait :)
I upload everything as a zip to a cloud service (Google Drive, Dropbox, Baidu Yun, ...) of your choice. Maybe this will be most convenient, since you won't need to build from scratch all the other stuff (Some process are actually slow).
I think it's better to provide those files to help people better contribute to this project eventually. But do it when you feel good about it, no hurry.
Update: Windows seem to read the Title props of the file
~I am not familiar with fontforge thing, but I can dig into later.~ Have read the doc a little, wonder if this changes will fix that
font = fontforge.font()
font.familyname = "QIJI"
+ font.fontname = "QIJI"
+ font.fullname= "QIJI"
Thanks for looking into this! Font name should be fixed in these commits: efacd12fdd20062f3394ef8df72933982d127cc2 8a7bae699eb32a5883ba14a1f1b8557745aeb76d
I also noticed the "Copyright (c) 2020, admin" in your screenshot, seems like it is automatically inferred from my laptop username, so fixed that too :)
Cool, It works now :)
attach the compiled font file to releases instead of source control
As I am trying clone it to my local machine, it now takes about 88MB to download.(and sry I have really poor network, ~250kb/s π). It's not a big deal right now, but I think it's better to do it earlier.
If you are ok with it, I can peel off the QIJI.ttf from the git history and make a script that make Github release automaticly. The site/qiji.ttf
and be automaticly copied as well.
That would be great, thanks a lot!
However the font is generated from SVG's (50MB), which are generated from BMP's(1GB), which are generated from high-res scans (15GB). Wondering if it is still possible to have Github release automatically? Otherwise I guess manual isn't too bad.
The large size is also likely because at one point I accidentally pushed a fallback font (called QIJIFALLBACK.ttf, which is 55MB) to the repo, so if you can peel that off too that would be awesome. BTW, I'm generating the fallback font by adding distortion and noise to a regular font (SourceHan), still experimenting with that.
In image above, εη½η₯ζ² are from the fallback font. Perhaps they can be slightly thicker and bigger, but I think they blend in kinda well :)
the font is generated from SVG's (50MB), which are generated from BMP's(1GB), which are generated from high-res scans (15GB).
That was crazy π Hope I will get enough disk space for that.
Wondering if it is still possible to have Github release automatically?
Definitely NO haha. But what I mean is something like bash publish.sh
that create Github Release and uploads font files to it automatilcly (or semi-auto XD) making life a little bit easier. What do you think?
In image above, εη½η₯ζ² are from the fallback font.
It's hard to identify which are fallback without telling. Good job. The dimension is kinda wired (look more rectanglar than square). but I believe you already spot that too.
BTW, I am working on the site for this to see if I can make the font loading experience better, will make PR later :)
I used fontforge to convert ttf to woff2, I was really surprised about how much the size reduced (14MB -> 4.8MB) and maybe it can be optimized even more from the source.
bash publish.sh
Sounds great!
look more rectanglar than square
The real font is actually also taller than they are wide, but I guess I overdid it, will dial back a little.
make the font loading experience better
Thanks for the PR!
14MB -> 4.8MB
Amazing :D
@antfu , how did you manage to get woff2 so small? 'cause this is what I'm getting XD:
My code:
import fontforge
font = fontforge.open("../qiji.ttf")
font.generate("../qiji.woff2")
@LingDong- I am using the FontForge GUI, I just simpliy open the ttf file and output as woff2. That's it. Not sure how to work with python, maybe there are some options for compressing or optimizing?
peel off the QIJI.ttf from the git history
This will rewrite the git history, so I want to make sure you have your unsaved works committed and pushed. Let me know when you are ok with it, after I finished(it would not take long), I will share you some simple commands to pull the changes. :)
I've made a backup, feel free to do the git surgery, thanks :)
@LingDong- The process is finished :) You can either reclone it or run the following command to pull
git fetch --all
git reset --hard origin/master
git pull origin master
I have removed QIJI.ttf
, qiji-fallback.ttf
, site
, __pycache__
from the history
Cool, I ran the commands and it seems to be working fine. Thanks a lot for doing this!
I am using the FontForge GUI
Tried out some online converters, found out the similar result https://cloudconvert.com/ttf-to-woff2
Source: Qiji.ttf | 14.1MB |
---|---|
woff | 7.32MB |
woff2 | 4.78MB |
otf | 50MB (wtf?) |
If we can not make fontforge optimize it, maybe we can use some other font tools to do the convertion in sh scripts? (have to say docs for fontfoge python is really... not too friendly)
Yeah FontForge python's documentation is non-existent XD. I basically go dir(fontforge)
and then dir(fontforge.font())
to see what it has to offer...
https://fontforge.org/en-US/documentation/scripting/python/ here is an inaccurate and outdated doc which I also use as reference.
I'm switching to this tool for conversion:
https://www.npmjs.com/package/ttf2woff2
Commit: af5a229ad30f8a7b57e8b7b170f97ae36594206f
Result: QIJI.woff2 is 5.2MB, so I guess that's acceptable(?)
ttf2woff2 has a CLI, wondering if installing it globally and use it in a shell script is better, thus avoiding cluttering package.json.
Oh, I didn't expect the solution to be that simple - just a js package!
I guess 5.2MB is already a big optimization compare to 14.1MB for now. We can try to find ways to squeeze its size (maybe gzip or svg optimizing), but I think let's for later.
if installing it globally and use it in a shell script is better
I was trying to say maybe npx ttf2woff2
but I just quick peeked its document, not sure if npx works with bash pipeline (it does not support argv parsing)
Can you upload the woff2s to the release(no need to create a new one I think) so that I can help to switch to woff2 for site?
I added qiji.woff2
to the release. qiji-combo.woff2
is taking forever to generate, not sure why. Every tool has to break in its particular fashion π€¦ββοΈ
EDIT: all three woffs are uploaded to the release.
For many characters, the Korean version of Source Han Serif would be more suitable for the fallback since it uses θεε½’. Also, I think GenWan would work nicely. E.g. η₯ from left to right: Source Han Serif SC, Source Han Serif K, GenWan.
@lapomme , Good call, Thanks a lot!
Now the fallback font and the combined font are generated with the Korean version SouceHanSerifK-SemiBold
, and are published on the Releases page.
P.S. GenWan looks nice, but I think since we're adding a lot more distortion & weight variations to the glyphs, the subtle variation from GenWan might not be very visible. But nevertheless I might give it a try later.
Wow! I didn't expect to see it get such a high level of completeness and I am very surprised how wide range it already covered. Great job! π
I haven't got the build tools ready and run by myself (I am having poor network recently, will definitely try later). Here are some quick thoughts/ideas about this with my superficial view.
Maybe it's better to attach the compiled font file to releases instead of source control. I think it's indeed easier and straightforward for people to find the font on early-stage, but since the Chinese font is huge (14MB currently). It's not very ideal to keep it in the source control.
The font name is not specified. (
Untitled1
currently)Consider compile to different font formats (ttf, otf, woff, woff2, etc) by using fontmake. woff is optimized for the web with smaller file sizes which is useful for web display. Here is the build script of FiraCode for reference.
The characters selecting things look very interesting too! Would play with it and make some feedback when I finished the toolings.