ValveSoftware / Proton

Compatibility tool for Steam Play based on Wine and additional components
Other
23.93k stars 1.05k forks source link

An Open Source Alternative to Corefonts #571

Closed CuriousTommy closed 5 years ago

CuriousTommy commented 6 years ago

I have been noticing that a good amount of reports here require people to install corefonts. While it is fine for consumers to use winetricks to install the corefonts, the licenses forbids Valve (or any other company) from using the proprietary fonts.

As an alternative solution, there should be a library that intercepts any request for these propritary fonts and have the program use the open source equalivent instead (credit goes to FlukyS for the idea). I made a list of open source fonts that can be used instead on reddit.

pchome commented 6 years ago

More info: https://wiki.archlinux.org/index.php/Metric-compatible_fonts

ryao commented 6 years ago

Are any of these fonts drop in replacements as far as Wine is concerned or is someone going to need to adapt them?

As for fonts, most games that require fonts need corefonts. It turns out that most of corefonts (6/11) were licensed to Microsoft by the Monotype Corporation:

https://en.m.wikipedia.org/wiki/Core_fonts_for_the_Web#List_of_fonts_and_files

That includes Arial and Times New Roman, which are the two most popular in corefonts. If it turns out that most games that need fonts need just the ones that Monotype Corporation owns, Valve might be able purchase/license the rights to them for the community. Then proton could provide the original fonts to games rather than substitutes.

By the way, if Monotype wants more money for the rights than it would cost to hire a full time developer for a year, I would rather see Valve hire a full time developer whose first task would be to fix the font situation using OSS substitutes.

CuriousTommy commented 6 years ago

Are any of these fonts drop in replacements as far as Wine is concerned or is someone going to need to adapt them?

The google fonts (not sure about the others) should be "metrically compatible" with the proprietary equivalent. In theory, I think it shouldn't cause issues. However, I don't think anyone has actually tested it. If I have some free time, I may try using the opensource font with Business tour (Issue https://github.com/ValveSoftware/Proton/issues/290) and see if it works.

Valve might be able purchase/license the rights to them for the community. Then proton could provide the original fonts to games rather than substitutes.

I wonder if Valve would be willing to do that. That would definitely make everyone's life easier.

With that being said, I still would also like to have an open source solution so that it is easier to distribute the font to any wine-based install without restrictions.

By the way, if Monotype wants more money for the rights than it would cost to hire a full time developer for a year, I would rather see Valve hire a full time developer whose first task would be to fix the font situation using OSS substitutes.

That was also another concern of mines. I just hope we can come up with a solution to this issue.

shanefagan commented 6 years ago

GTA5 also needs corefonts for the social club key activation, the game itself doesn't but you need to social club thing to load the game so having at least an answer like a fake corefonts included in proton or just catch the call for that font and give it something equivalent would be a big deal.

CuriousTommy commented 6 years ago

So I have recently made a repo that converts the opensource name/metadata to the corefont equivalent. I am currently away from my desktop so it will be a while before I am able to test this. I thought I will post this now so that people can test it and report their findings.

Edit: Use austin987's foss_corefonts instead. You can find a link to it below.

austin987 commented 6 years ago

Has anyone tried liberation instead of corefonts? They're FOSS and supposed to be compatible with corefonts (unless the fontname is specifically checked iirc).

CuriousTommy commented 6 years ago

@austin987 Seeing that they are metrically compatible, I think they should work fine. I would just have to make minor changes to my script to so that they can mimic the corefonts.

But I would have to test to know for sure.

shanefagan commented 6 years ago

@austin987 yep liberation is fine but the issue is compatibility and something that is available to ship. Liberation checks the box sure for some fonts they need but they need to work on a way to intercept the font query from Windows and give it their own alternatives for each font needed.

ryao commented 6 years ago

After some thought, if they are metrically compatible and fontconfig is setup such that fc-match reports them as being used for each of the names given to corefonts, I suspect that we could resolve this problem without any changes to proton. Of course, this needs to be tested, but if it works, we can arrange fixes at the distribution level.

If someone else does the R&D work to make that a reality, I am willing to handle getting this fixed in Gentoo (which means fixing it in child distributions such as Sabayon, Funtoo, maybe ChromeOS, etcetera). I have commit privileges to Gentoo, although I will need to coordinate with other maintainers rather than blindly committing. That is something that I can handle. Others would need to volunteer to do the same for Debian and Fedora for this to filter down users of distributions in the other two major Linux distribution families.

shanefagan commented 6 years ago

@ryao well wouldn't it be easier to configure WINE itself to do that? Most distros ship enough metrically compatible fonts so blanket just having a loopup and select from the list of available open fonts would work. Also note that there is the problem with not supporting certain languages on specific fonts either. So you have to be careful not just for size of fonts but also comparable language support.

ryao commented 6 years ago

@shanefagan I installed corefonts using Gentoo's package manager on my machine. It made Age of Empires III happy just as if I had installed corefonts using winetricks. If the distributions are shipping metrically compatible fonts, then it would not be unreasonable to ask them to add a file in /etc/fonts/conf.avail/ and a symlink in /etc/fonts/conf.d/ to properly map corefonts to them.

The entire purpose of hooking into fontconfig should be to avoid a situation where the Wine project devotes resources to something that someone else can handle instead of something that only they can handle. They certainly can workaround distribution level issues, but it would come at a cost of slower development. I don't think that is an efficient use of resources, especially since this issue is approachable by the average person. They just need to read the documentation on fontconfig's XML format, make an appropriate XML file and get it reviewed by people familiar with fontconfig.

CuriousTommy commented 6 years ago

@ryao The question is can we get the wine team to add support for fontconfig. Is there any reason why they don't have it supported it so far (I can actually think of a few reasons why they might be against fontconfig)?

CuriousTommy commented 6 years ago

I finally got access to my desktop and was able to do a quick test with the font. Here is the font in action. So at least we know that the font does work (at least for english).

CuriousTommy commented 6 years ago

While I am at it... @aeikum, are you able to shed some light into why wine doesn't follow the fontconfig rules for binding font?

ryao commented 6 years ago

@CuriousTommy I hadn't realized that wine itself wasn't using fontconfig. That is a really odd design choice. I guess it is possible to patch wine directly to handle this better if metric compatible fonts are available.

nsivov commented 6 years ago

@ryao, @CuriousTommy, Wine is using fontconfig to build a list of available system fonts. Matching is more complicated because it involves Windows-specific configurable replacement mechanisms. It also works differently from fontconfig, and exists separately in gdi32 and directwrite, that are also different between the two.

It seems that correct approach will be to identify what exactly fails, and why is it fixable with additional fonts, on per-game basis.

CuriousTommy commented 6 years ago

@nsivov Thank you for responding. I am currently adding patches to protontricks so that people can easily test austin987 foss_corefonts package on games that require additional fonts.

I hope you don't mind responding to these statements (if you want to):

It seems that correct approach will be to identify what exactly fails...

In other words, we need to figure out what fonts are missing that would cause the program to crash, not display anything, or have any other wierd issues. Or do you mean something else?

...why is it fixable with additional fonts, on per-game basis.

I am not sure how to propose a testing solution for this question... Do you mean why one open source font would work fine while the other fails, or do you mean something else?

nsivov commented 6 years ago

Exact or fully compatible font is not always absolutely necessary. What I mean is that it's important to figure out why some available font is not picked instead of missing one the game asked for.

CuriousTommy commented 6 years ago

I am not sure if this relates to our current issue, but I found this Microsoft document on fallback fonts. Is seems that both the applications and the operating system can set their own fallback font.

Windows 8 and above has an API that allows the operating system to suggest a fallback font, but do the games that need corefonts (or an alternative font) use these APIs?

nsivov commented 6 years ago

They don't have to explicitly use any API, fallback, replacement and linking are different things. The point is that font selection should be likely improved - on Windows (in case of GDI), you can select non-existent font name, and still get some rendered text out of it, because something "suitable enough" will be picked as a last resort.

Anyway, this really depends on what application is doing in a first place, generalizing it like that is wrong I think.

mimattr commented 6 years ago

+1 Agree, the current Corefonts situation is an important issue for many.

From a development and licensing perspective it may be worth @kisak-valve and the team investigating Google's Croscore font alternatives (e.g. Arimo, Cousine & Tinos)

https://github.com/google/fonts

Hope that helps.

AsciiWolf commented 5 years ago

+1, many games require corefonts to work properly.

CuriousTommy commented 5 years ago

Hi @kisak-valve, I was wondering if you would be able to check with the lawyer on the legality of modifying some of the font's metadata to mimic Microsoft's (or any other proprietary copyrighted) font. Everyone wants to avoid modifying the font itself for trademark concerns. But I would love to hear what a legal authority has to say on the matter (and whether this is a trademark issue or a copyright issue).

@nsivov I was thinking about what you said a while ago. Let say that I was interested enough to submit a report on a game that doesn't work (or render any text) without corefonts. Would I need to know any reverse engineering skills to help out?

ryao commented 5 years ago

@CuriousTommy Microsoft does not actually own 6 out of the 11 core fonts. In theory, it would be possible to get a license to use them from the copyright holder.

ghost commented 5 years ago

https://azure.microsoft.com/en-us/blog/microsoft-joins-open-invention-network-to-help-protect-linux-and-open-source/

Any patents that they're "sharing" be of benefit also can projects like Proton use patents from this pool.

Holzhaus commented 5 years ago

@daasuharo Microsoft's fonts are copyrighted. Patents have nothing to do with it.

ghost commented 5 years ago

That's good information to know, thanks @Holzhaus

I came across this on wikipedia about design patents

"Typefaces may be protected by a design patent in many countries (either automatically, by registration, or by some combination thereof). A design patent is the strongest system of protection, but the most uncommon. It is the only US legal precedent that protects the actual design (the design of the individual shapes of the letters) of the font.[12] A prominent example is the European Union,[13] where the automatic protection (without registration) expires after three years and can be extended (by registration) up to 25 years.[14]

In 1981, Germany passed a special extension (Schriftzeichengesetz) to the design patent law (Geschmacksmustergesetz) for protecting typeface designs. This also permits typefaces to be registered as designs"

HonkingGoose commented 5 years ago

For reference, here is a (partial) list of games/software that would seem to benefit from some kind of corefonts solution.

Games:

17

37

44

79

290

307 You need to manually select the right "corefont" from the Winetricks GUI: https://github.com/ValveSoftware/Proton/issues/307#issuecomment-416514188

462

639

727

1317

1539

1666

1733

1755

Software:

7

Launchers not working/looking right without corefonts:

barni2000 commented 5 years ago

It may be help https://aur.archlinux.org/cgit/aur.git/tree/?h=fake-ms-fonts

HonkingGoose commented 5 years ago

Well with Proton 3.16-4 Beta it seems we got what we wanted? They apparently use Liberationfonts:

The Liberation(tm) Fonts is a font family which aims at metric compatibility with Arial, Times New Roman, and Courier New.

https://github.com/ValveSoftware/Proton/commit/17e50d67ab03119deeb3c8a63bcfb4c6918bee78 https://github.com/ValveSoftware/Proton/wiki/Changelog

From changelog:

Proton now ships with corefonts support. This should fix many games with missing text, or that crash due to missing font support.

aeikum commented 5 years ago

Yes, as of 3.16-4, we are now shipping corefonts support in Proton itself, so workarounds and native packages should no longer be needed. Please mention remaining font issues in the existing issues for the affected games, or open new issues if the game does not have an open issue.