Autoselect internal WOFF2 format#5346
Conversation
|
@skef, if I understand correctly, WOFF2 support is determined at compile time, so the user who installed an official package without WOFF2 has no choice but to recompile it locally if they want this capability. That is the case in Ubuntu 22, for example. What do you think about replacing the current mechanism with dynamic library loading, so that the user will just have to install libwoff, and then FontForge would detect it and enable the support? Or maybe I'm missing some point there... |
Not impossible, but also not easy to do in a cross-platform way and potentially fragile. Also - most Linux users probably get FontForge via their distro, and users who compile it for themselves can usually be considered "experts", who shouldn't be phased by having to recompile after adding a library to their system. |
|
That's exactly the problem with distro packages. The package comes without WOFF2 support (in Ubuntu or Debian for example), and 90% of users would be just frustrated by grayed-out option which they have no knowledge to enable. Regarding cross-platform loading, libltdl (https://www.gnu.org/software/libtool/manual/html_node/Using-libltdl.html) looks promising. It wouldn't even need a new dependency, as it's a part of libtool which is already a dependency. But anyway, that's for another PR. |
|
If that's true it's a documentation problem (which is entirely plausible). The way it's supposed to work is that the distros build with all the core features enabled and then use package dependencies to ensure the needed libraries are present. We just aren't currently making it clear what the core libraries are. We probably just need to add a readme at the top clearly labeled for distros to look at indicating what features should be enabled if possible and then note that addition in the changelog. They're usually pretty good about taking care of that stuff if they have the relevant information. |
|
Found distribution-specific package scripts, hopefully that would be enough. |
|
We could go this direction, but it seems kind of mysterious and different from how the rest of the exports work (other than WOFF, but that was a short-lived thing in terms of use). Might it be preferable to just have WOFF2 TTF and WOFF2 CFF options in the UI, with corresponding separate enum values? |
|
Do you mean options in outline drop-down list:
Sounds good to me. |
|
Yes, but only bother with WOFF if you feel like it. There's very little use of WOFF (1) at this point. |
I would recommend to avoid distro specific if you can.
There is a lot of code you can look at in 20120731 that implements dynamic load. You can look at startnoui.c, gif, png, jpg, spiro for code that loads or grays-out features. I see this question as a bit of a yo-yo we are going through (it came out, it comes back in). George Williams had it in his original code, then we came along and there were those that wanted to simplify and pull-out that code, and pretty much lock-in the code during the build, so the code as you see it, the dynamic load code isn't here anymore. - from a linux, or distro point of view, it does help reduce the problem questions of: It's grayed-out, I can't do gif, I can't do png, I can't do WOFF, etc. This was the main benefit of removing the code. If the build system advertises what's loaded or missing, it could help the distro builder. Using Debian as a core distro, it can also be useful to look at what's happening here: |
|
@JoesCat I think mostly what happened here was that we have lists of needed dependencies in various places and we weren't including woff2 in those lists because it was niche at that time. Now it's not niche and @iorsh added it to the various lists that appear in scripts and documentation, and if we say something in the release notes as well (I forgot that we don't really have a changelog) the distros will probably pick it up just fine. |
skef
left a comment
There was a problem hiding this comment.
Yes, this looks a lot better than what was there. Pretty clean, too.
WOFF2 format is a wrapper for TTF/OTF font (see https://en.wikipedia.org/wiki/Web_Open_Font_Format). We select the underlying format according to the foreground spline curve type: TTF for quadratic, OTF for cubic. This logic is already employed in WOFF.
Fixes #5240.