-
-
Notifications
You must be signed in to change notification settings - Fork 13.8k
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
freetype: disable patent-encumbered code by default #2020
Conversation
The Infinality patches silently enable patent-encumbered code in freetype, making the result unredistributable.
as far as I know subpixel rendering itself is ok. The effect of disabling these patches by default would be that enabling them (as a user) leads to massive local rebuilds of almost any gtk/qt package on every upgrade. |
@bluescreen303 Freetype has a page dedicated to this: The subpixel rendering code in Freetype uses color filter technology that the authors believe is encumbered by the Microsoft ClearType patent. This is the code enabled by Infinality. It is also the exact same code enabled if The NixOS wiki has a page describing how to use a patched Freetype without rebuilding everything: https://nixos.org/wiki/How_to_enable_subpixel_rendering_in_freetype |
@vcunat, you added Infinality support, what is your opinion on this? |
Those instruction will probably give a messy system as there is no way to update the environment on upgrades (nixos-rebuild switch) apart from logging out and back in again. Not doing this will lead to newly started applications trying to use the old version of freetype. To make matters worse: this old version can be garbage collected (as there is a new version available and the current (but not yet activated) environment points to that). So the workaround is a no-no for me. But if there is indeed a legal issue I will turn to building stuff locally. |
It would be nice if Nixpkgs/NixOS could legally be distributed it the US. |
No, from what I found before, infinality should be a patent-free alternative to the other patent-encumbered color filtering in freetype. I'm no lawyer, but I believe the state is that infinality provides that custom color filtering mentioned in http://freetype.org/patents.html (in fact you can override the parameters by env vars). |
@vcunat Infinality doesn't implement a new filter algorithm, it just lets you adjust the parameters to the existing one. Freetype already ships with three presets ("default", "light", and "legacy"). Infinality merely lets you customize the default filter parameters, it doesn't implement a new algorithm. I'm not a lawyer, but that can't be enough to circumvent the patent. |
Quoting from the link above:
|
Infinality doesn't use a different color filter. The patent-encumbered Freetype color filter algorithm takes 5 numbers as parameters. Infinality lets you change them at runtime, but you can always change them at compile time. Those input parameters are not the subject of the Microsoft patent. The algorithm itself is the subject of the patent. Infinality doesn't change the algorithm. Infinality doesn't even change the parameters by default. Can you cite some other source for why the Infinality patches aren't encumbered? |
The patch is huge and does add new algorithms (I skimmed it now again). Whether it uses some patented stuff is hard to say, especially for people like me who don't know the insides of freetype. Browsable updated version of the patch (we use older but analogical): https://github.com/bohoomil/fontconfig-ultimate/blob/pkgbuild/01_freetype2-iu/infinality-2.5.3.patch Anyway, it might be dangerous to use anything similar to ClearType, I don't know. I'm just trying to work out a good way of allowing the user to choose without rebuilding everything. Having a global lib override is a fragile solution, and per-package wrappers are cumbersome. From patent point of view, any idea whether it is a problem if you have the algorithms compiled in but subpixel rendering is disabled? |
Sorry, I wasn't trying to say that Infinality doesn't add new filtering algorithms. (I realize now that's how it came out.) Infinality's filters are all in addition to the encumbered subpixel color filter that comes with Freetype. Infinality doesn't replace the encumbered filter. In fact, the patch intentionally enables it. It's pretty easy to figure out where the encumbered filter is by grepping for |
It seems you are right. To get more confidence I asked upstream, as I found practically no mention of patents around there http://www.infinality.net/forum/viewtopic.php?f=2&t=346. If we are to switch the default behavior soon, I would do it at once with major freetype update. |
on a sidenote: microsoft also claims to have patents on various techniques used in the linux kernel. |
@bluescreen303: if it can be split into a loadable module... perhaps we should introduce "I'm afraid of patents"-switch in nixos for such things. Most common users will want to have FAT because of USB keys and memory cards, and they are at a low risk when infringing SW patents, especially inside EU. |
Most users also want decent font rendering, especially with higher-resolution displays, It would indeed be nice if we can manage to do this without (US or other) users having to build everything themselves though. Perhaps a different channel can help? |
I certainly don't want to duplicate each build on Hydra. BTW, the value of subpixel rendering decreases when your DPI increases as it's common nowadays (the "retina" trend, FullHD on phones, etc.). |
Right, I propose to use Reasons:
I didn't look yet much into the details of
|
How about enabling patented code by default but not distributing it via the cache? Nix will build it itself when it fails to get a cached build, so it's transparent except for a few minutes of compiling. Or just not distributing it to clients in the US. |
@ambrop72: I don't understand what you mean:
|
@vcunat I think the only issue regarding patent encumbered code is that NixOS may get into a legal dispute if it distributes patent encumbered code. My proposed solution obviously solves this problem (and would be an exception to Hydra distributing only closed sets).
If anyone wants or needs to avoid the patent encumbered code, he can still override the flags and rebuild (and/or use the LD hacks people currently use to enable the encumbered code). But I believe only a minority of NixOS users want a patent free setup, and it doesn't make sense to support the minority better than the majority (by providing patent-free builds but not patent-encumbered builds). |
Additionally, if we agree that enabling patent encumbered code by default is all right, it might be a good idea to disable Infinality and use the other rendering code (whatever useEncumberedCode=true useInfinality=false does). It results in much nicer fonts than the current default (Infinality). |
As mentioned above, currently the default rendering is as freetype upstream. You need to switch infinality on with env vars. What is better is highly subjective; infinality has the advantage of allowing you to tweak the parameters (or choose from a few defaults, e.g. mimicking Windows, etc.). |
@ambrop72 We definitely do not want |
Unimportant note: the nix expression for Freetype seems to be confusing between licences and patents: https://github.com/NixOS/nixpkgs/blob/master/pkgs/development/libraries/freetype/default.nix#L68 Enabling patent encumbered code doesn't change the licence of Freetype. It's still GPL/FTL. Maybe we need a way to track patented code in the metadata as a separate field? Such a feature could then be used to prevent distribution by Hydra. |
|
|
Footnote: Right now, by default, the environment settings for Infinality aren't made, so the patches are mostly disabled, but Infinality's fontconfig settings are left enabled. This is probably the cause of most font rendering glitches on NixOS. As I alluded to before, I'm working on a patch to make it possible to truly disable Infinality's fontconfig settings at runtime. |
BTW, the fact that we use global font configuration has been preventing me from fontconfig update. See e40a059. The problem is that the xml format changed, so the files distributed by default are mutually incompatible. Moreover, when fontconfig finds an ivalid one, it fails to load any config at all (IMO bug), resulting into unusable state. (EDIT: this in turn prevents updating pango and transitively librsvg for a long time.) |
Yeah, fontconfig is bad in that way. I remember a while back programs linked against an older fontconfig would segfault due to a change in the fontconfig cache format... |
@vcunat Have you considered installing the new configuration files in, e.g., |
@ttuegel: how simple :-) Thanks! It will probably be best that way, only in nixos I expect we need to install both old and new fontconfig files, at least for some months. Infinality could get a (People that don't like patented stuff can solve it by setting an option in packageOverrides and rebuild, or if there was enough interest we could later have some easy-to-use dependency exchanger without rebuilding for such cases.) |
Using non-standard paths like /etc/fonts-2.11 is a problem because Nixpkgs is supposed to work on non-NixOS systems, which won't have /etc/fonts-2.11. But it's better to discuss this in another issue. |
Was there a resolution to this discussion? Should this be merged? |
@shlevy No, this should not be merged. |
The Infinality patches were enabled by default, but they enabled patent-encumbered code (subpixel rendering).
I have also added myself as maintainer, since noone else was listed.