canonical / Ubuntu-Sans-fonts

Other
54 stars 4 forks source link

Create a new latin subset #51

Closed ClementChaumel closed 1 year ago

ClementChaumel commented 1 year ago

With the previous font we used to have an option to only use a subset of latin for performance's sake. Would it be possible to recreate it under something like latin-minimal or optimised Here is the unicode range for the subset

unicode-range: U+0-FF, U+131, U+152, U+153, U+2BB, U+2BC, U+2C6, U+2DA, U+2DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;

please let me know if that's enough information to create it

djrrb commented 1 year ago

Hi @ClementChaumel,

I added latin-minimal to the build process using the unicode range you specified:

https://github.com/djrrb/Ubuntu-fonts/blob/25b5fb68e6f541ca090613b5f0807500649f4394/scripts/makeWebfonts.py#L52

However I do want to point out that this seems to be very similar in filesize and character count to the latin unicode range that’s already in there:

https://github.com/djrrb/Ubuntu-fonts/blob/25b5fb68e6f541ca090613b5f0807500649f4394/scripts/makeWebfonts.py#L50

You can see the new files here: https://github.com/djrrb/Ubuntu-fonts/tree/main/fonts/webfont-subsets

Example filesizes:

Filename Size
Ubuntu-Regular.woff2 74kb
Ubuntu-Regular-latin-extended.woff2 27kb
Ubuntu-Regular-latin.woff2 24kb
Ubuntu-Regular-latin-minimal.woff2 23kb

Let me know if you think that these two latin subsets are redundant, or if you’d like to change them in any way. (Also just to note that I’m aware that these are not currently available in the UbuntuMono repo and they will be soon.)

ClementChaumel commented 1 year ago

Oh thanks for adding this so quickly I thought the difference in size would have been much bigger than this. My calculations must have been off. Let me get back to you but I don't think the added complexity is needed for such a small optimisation.

ClementChaumel commented 1 year ago

Hey, sorry but you're right, it turns out we won't need it. Thanks for helping me with this!

djrrb commented 1 year ago

Okay, I’ve removed it from the build process.

It’s easy enough to add other subsets if/when they become necessary, and is also possible to subset the variable axes in addition to the character set if that is ever useful. Feel free to make an issue if you ever want to add others! :-)