gnustep / libs-back

The GNUstep gui library is a library of graphical user interface classes written completely in the Objective-C language; the classes are based upon Apple's Cocoa framework (which came from the OpenStep specification). *** Larger patches require copyright assignment to FSF. please file bugs here. ***
http://www.gnustep.org
GNU General Public License v3.0
50 stars 34 forks source link

Font system revamp #5

Closed Deek closed 5 years ago

Deek commented 5 years ago

This is a semi-comprehensive revamp of the font system in use with the Cairo backend.

I have implemented support for Fontconfig 2.11's unique PostScript font descriptors, which prevents synthesized font names from causing fonts to "shadow" each other. For people with very old versions of fontconfig, I have added many new rules for synthesizing new font descriptors, which should limit that shadowing effect drastically, as well as made use of each font's human-readable name to improve the user interface (and make shadowing even less likely).

I have also introduced sorting for the font list, which causes the faces within a font to become sorted by weight and traits, so that the user-visible list now has a discernible pattern to it that it lacked before.

I have used Cairo's and Fontconfig's support for the FreeType library to access encoding information and PostScript glyph tables to enable -glyphIsEncoded: and -glyphWithName: to finally work, which enables things like ligatures and (eventually) complex glyph substitutions.

I have also included some stubbed-out code which enables the fetching of TrueType SFNT tables, which are the things that actually provide glyph substitution as well as all of the basic typographic metric data we can use to find any font's true typographic baseline, xHeight, and glyph extents.

And finally, for my own purposes, I turned on subpixel rendering and hinting in a user-controllable way.

Fred asked me to put this together some time ago, but I have been busy and hadn't gotten around to it. Sorry. :)

Deek commented 5 years ago

By the way, I have recently discovered that under certain conditions, the Fontconfig code is extracting human-readable names from some fonts that are encoded in languages other than English. Most fonts don't exhibit the issue, but some Microsoft ones do. I have looked for a useful way around it, but I haven't found one yet. If you see a font named e.g. "Courier New kurzíva", this is the cause. The problem is not on our end, it's in Fontconfig and/or the font itself. Actually taking the step to load and use the SFNT tables ourselves is the probable solution.

fredkiefer commented 5 years ago

How to proceed with this pull request? You did not change anything, not even the bug you admitted. Does this mean I will have to adjust this pull request myself? If so I would prefer the merge it piecewise. If that is fine for you, I will start merging next week.

fredkiefer commented 5 years ago

I changed my mind and will no merge the whole change request and do the clean up after that. This seems easier for me. Could you also add a pull request for your changes on gui? Without that the changes to the font display names will never show up anywhere.