The Work Has Begun…

Screenshot of font info windowBut it isn’t going to be as simple as I had hoped.

Google Fonts doesn’t just do one family per CSS file, it lets you specify several delimited by a |.

Anyway, the work has begun, but I can’t just do static CSS as I had hoped I could, I have to custom build the CSS depending on what families are present in the GET request.

I think I can just ignore the requested weights and just send a generated CSS that covers them all, the browser will only actually download the fonts it actually needs. Sure that makes the CSS a little larger but meh. Once it is working I can use JSqueeze to minify on the fly as served.

If they are being dynamically created I will need to make sure there is a way to let browsers know that their cached copy is just fine.

I have a plan for how to handle that. What I’ll probably do is parse the request extracting the family names, sort them alphabetically leaving out what the server doesn’t have, and make a hash of that. If a cached copy that matches the hash exists then it serves that file or uses that file to respond to browsers asking if their cached copy is okay. If the file doesn’t exist, it will then create it.

But for initial testing I will be pretending that only one family is served per request.

The project is at https://github.com/AliceWonderMiscreations/FlossWoff2.

Leave a Reply

Your email address will not be published. Required fields are marked *

Anonymity protected with AWM Pluggable Unplugged