Fix: enumerate the fonts fontconfig knows about on art - #225
Conversation
|
I am unsure about this PR. It is great to remove so much code, but now the art backend would depend on FontConfig. Up to now the art backend was a great option for old machines where there was no suitable FontConfig implementation available. That is computers where cairo, our preferred backend, was not possible. |
|
I am fine with that too - this was done for parity amongst the backends to try to ensure upstream compatibility at the application level, but I can certainly see the use case of art as a "backend of last resort" if you will. We can let people think about it for a bit, and then if not desired, we can close it and move on. |
|
I would keep this open right now and have the time to test it, I think there is no hurry with the art backend anyway. |
art enumerates the .nfont and .font bundles under the Library Fonts
directories, and this repository installs just the Helvetica bundle, so art
sees a single family. With no fixed pitch face to answer with,
userFixedPitchFontOfSize: falls back to the system font: at 24pt its i
advances 5 and its W 23.
art now uses the fontconfig enumerator that cairo, opal and xlib use, so it
sees what the system has. FTFontEnumerator becomes a subclass of
FCFontEnumerator, and FTFaceInfo a subclass of FCFaceInfo that reads the file,
the face index and the hinting out of the pattern fontconfig matched. That
drops the private font scanning, 570 lines of it, and the renderer takes its
hinting from the desktop settings rather than from a plist. The FreeType cache
keys on the face, so a face index other than 0 now opens correctly.
Measured here, art goes from 1 family with no fixed pitch face to 61 with 7,
the system font from Helvetica to DejaVuSans, and the fixed pitch font to
DejaVuSansMono, whose i and W both advance 14.
Tests/art/fixedpitch.m is new. The art set is 32 passed 3 failed against
master and 35 passed 0 failed here.
Closes #206