-
Notifications
You must be signed in to change notification settings - Fork 696
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Generate font subsets #119
Comments
"named" you mean file name? can you provide a set of UI mocks/sketches? :) |
vernon adams notifications@github.com skribis:
Scripting is far better for this than building in a feature. For instance, how should the subset be determined, since encoding is |
Just a head-up; I've already been working on a subsetting script. your own too rather than waiting on me.Deron Meranda |
My idea was that the subsets would be determined by the encoding sets in fontforge's 'Encoding' menu, and therefore could include any user made sets too. |
I you need something right away without waiting on me, you may want to http://code.google.com/p/googlefontdirectory/source/browse/tools/subset/ DeronDeron Meranda |
Deron. Google's subsetting tool is what i am having to use now, and so... it is what brought me here :) |
There's also Tevor King's font-reduce Deron Meranda |
I'm not 100% clear on how FF handled encodings; I believe what Vern means is really handled by 'NameLists,' which have both unicode values and their ascii names and are easily user definable; whereas in FF the concept of an encoding means a well-known platform encoding, which is kind of obsolete today because of Unicode. I think this ought to better surfaced to users; and namelists ought to be stored in /usr/local/share/fontforge/namelists/ and then ~/.FontForge/namelists/
Right, but they always have a name.
I'm not quite sure how this works :-)
I don't understand this
I thought a font in FF can only have one encoding, but FF can re-encode easily.
Right, which won't be part of any pre-defined encoding, but can be part of a namelist.
I think what Vern wants is widgets in the Generate dialog. |
It would be great for a subset feature in FF to subset OT features correctly (as mentioned in https://groups.google.com/d/msg/googlefontdirectory-discuss/XOPxZm_nyE8/G1oFG_QrogYJ) |
Dave Crossland notifications@github.com skribis:
I don’t get that. The encoding or encodings are stored in the font. It I would take the time to get accustomed with the writing of such
If I have a glyph, either unencoded or with an encoding value that
Well, suppose you have a Type 1 or other font with more than one
I know, but this is a sort of thing for which extension languages |
Hi Deron, i would be interested to hear more of the script you are developing; what your aim is, and what functions you had thought to include etc. |
Just for information, another source of potentially useful font http://scripts.sil.org/cms/scripts/page.php?item_id=FontSubsets Also there looks to be a few interesting presentations at next month's subsetting, especially for CJK.Deron Meranda |
Another even simpler condition that can occur, and which the Google The most simple approach to font subsetting (ignoring tables, hints, For example a font might reuse the same glyph for U+0020 (space)
your new subsetted font will NOT have a glyph for U+0020, Deron Meranda |
when a glyph object is reused in multiple encoding slots I thought you might be referring to that, since I recalled you had some It seems to me that allowing a glyph to have multiple encoding values |
On 23 September 2012 00:27, Deron Meranda notifications@github.com wrote:
I will attend and hope to liveblog as much as possible :) |
FontForge already has a mechanism to create subfonts using Here's the man page which defines the format (see page 7): and here you can find Unicode.sfd: Maybe this mechanism can be extended to cover more than 256 characters
|
Yes, that is in fact the one "itch" which brought me into the whole
Just curious, how does one even get a font into that state where Regarding the fonts I was using that had these, I did report them occur elsewhere in other fonts.Deron Meranda |
On 23 September 2012 01:33, Deron Meranda notifications@github.com wrote:
I think it should be treated as a bug. Can you say what the fonts were, and do you know what tools the developers |
On Sun, Sep 23, 2012 at 01:33:08AM -0700, Deron Meranda wrote:
It is handled by special cmap subtable format, but FontForge hides the Regards, |
On Sun, Sep 23, 2012 at 01:49:53AM -0700, Dave Crossland wrote:
It is a feature supported by cmap table, just because you don’t know how Actually, I think most (if not all) MS fonts use it. |
The particular fonts I ran across were the linux Liberation font family. But as Khaled said, it this is permitted by the underlying font However perhaps we want to revisit what the section.invert() function of sets of encoding slots.Deron Meranda |
@dmeranda commented:
It should be able to make non-ASCII subsets (with the |
This is best done with |
Yes, same problem as #3085 . |
It is not very practical with pysubset for about 400 subsets to write for CJK fonts, and one also want to re-encode on the way... |
It would be nice if |
I have recently encountered, and worked around, a problem with re-encoding and subsetting Source CJK for TeXLive . CJK/TeXLive wants it as 400+ subfonts each of 256 glyphs :-). #3080 |
My freetype-py script to fix fontforge's encoding problem is up at https://github.com/HinTak/freetype-py/blob/fontval-diag/examples/subfonts-script-generate.py This is for generating about 400 subfonts from source cjk/noto cjk for TexLive's use, and also fixes the encoding problems on the way. |
@davelab6 : I realized you wrote this some years ago before Adobe Source CJK/ Noto CJK, but they have about 400 glyphs which are multiple-encoded, and hence fontforge cannot cope :-).
|
|
The solution I came up with, for the TeXLive Type 1 subfont generation - a freetype-py python script that gathers font info, then write a fontforge native script for fontforge to run - is probably adaptable to any other subfont generation, if you feel like staying inside fontforge... It is not pretty, but most subfont generation only needs to be done very rarely.
|
I'm glad to see that there's an active discussion on this topic - I actually came here to file a feature request for a font subsetting tool but fortunately I checked whether there was an open issue first. :) The discussion looks like it's gotten a bit bogged down in the 7 years since this issue was opened, so let me summarize it from my perspective: it would be useful, to web developers in particular, to have a script or other built-in feature for generating a font file or a set of font files which are subsets of an existing font, such as creating a new font file with only the ASCII range or creating 26 font files with one capital letter each. This is useful because download sizes and latency are a major barrier to the use of non-system fonts on performant web pages; one or two unusual font choices could easily weigh more than the HTML page itself, and block or disrupt page rendering. In the extreme case, initials for drop cap use, one might be downloading a 700KB file to use on a single letter. Drop caps are a snazzy feature, but that comes at too great a price. One way to largely eliminate that cost is to create subset font files, which contain only the specific letters necessary. In the extreme case of drop caps, you can break out 26 font files from the original initials font, and using CSS, load one for each capital letter; this means only 4-7kb must be downloaded & rendered (rather than anywhere up to 700kb or worse), and it is a near-zero performance hit. For more details, see our feature request upstreaming the subset fonts for Redesigning my site recently to use 5 drop caps as topics/themes, we recently did this for them to eliminate the performance impact, and it works very nicely. We did this manually in FontForge for the first 3, exporting one letter at a time, but that was ridiculous. For the final 2, I hacked up
This is extremely ugly and I assume breaks on a lot of edge-cases, but it kinda mostly worked? At least for the Cheshire & Kanzlei initial fonts I used it on... Apparently, there is no builtin FontForge support for this particular usecase, nothing in the documentation, nor is there any well-known standard tool for doing this? At least, I was unable to find one in a quick search and Obormot didn't know of any in his experience. suspect this might be one reason this particular font+CSS technique is rarely used - aside from its support in Google Fonts where you can include a specific range/subset as part of the URL query parameters to optimize the font (assuming you don't mind using Google Fonts, of course...) I see there is a link in this discusson to some Google tool, but the link seems to be broken. Reading the If this is the case, perhaps this issue can be resolved by adding to the FontForge documentation a section on font subsetting: what it is, why you would want to, and explaining that |
On Wed, Mar 13, 2019, 10:57 AM Gwern Branwen ***@***.***> wrote:
Reading the pyftsubset help documentation in the source file, it looks
like it supports everything necessary for font subsetting? I am not a font
expert and don't understand the objections here about how pyftsubset
"doesn't really" do font subsetting, because it sounds like it does.
It does everything, and does it correctly, afaik.
The fontforge docs are open for pull requests :)
|
There's an another option today --- hb-subset. It only handle font subset task(can't change postscript name, etc. not to be a font edit tool/library), and its performance is 150x better than pyftsubset. If font subset performance is a key point to you, and limited feature is accepted, then hb-subset maybe is your best option. |
Font sub-setting is rarely done, and usually on a one-off basis, so doing it correctly is more important than doing it fast (but wrong/buggy). That said, it is always useful to have alternatives... |
Another vote of confidence for hb-subset. I came here today looking for subsetting advice, and hb-subset worked perfectly. It's part of the HarfBuzz package, which I found I already had installed in homebrew. The command line I used was: |
That may be the case, but may also have more to do with the difficulty of doing so than the need being rare. In our case, we had to do the splitting for each dropcap, and we'd like to add more, so that's 5+ there just for the dropcaps; and we have done so repeatedly for the regular fonts too, for the more conventional usecase of dropping unused glyphs - we do so repeatedly because of course the website has kept changing over the years (as do most websites), and we occasionally need a new letter or symbol. Doing so only on a 'one-off basis' would look bad & be slow as the subset became increasingly out of date and fallbacks were used. |
Another vote from me for |
Feature request - When generating a font from File->Generate Fonts... it would be a helpful feature to be able to generate the font in subsets, based on fontforge's unicode encoding sets.
This could be set up / enabled at 'Generate Fonts...' and / or from the 'Font Info' tables.
So, for example, a font that contains characters from ISO 8859-1 Latin, ISO 8859-5 Cyrillic, and ISO-8859-2 Latin, should be able to generate 3 subset fonts; named for example 'Latin', 'Latin-2', and 'Cyrillic'.
The text was updated successfully, but these errors were encountered: