View Single Post
Old 08-16-2018, 01:30 AM   #32
cfillion
Human being with feelings
 
cfillion's Avatar
 
Join Date: May 2015
Location: Québec, Canada
Posts: 2,883
Default

Quote:
Originally Posted by Justin View Post
Edit: while I have you, have some code to enumerate the available font faces installed on the system (for the font browser)?
Here's how fc-list does it: https://cgit.freedesktop.org/fontcon...fc-list.c#n172.

Code:
FcPattern *pattern = FcPatternCreate();
FcObjectSet *properties = FcObjectSetBuild(FC_FAMILY, FC_WEIGHT, FC_SLANT, FC_INDEX, FC_FILE, nullptr);
FcFontSet *fonts = FcFontList(s_fontconfig, pattern, properties);

for(int i = 0; i < fonts->nfont; ++i) {
  FcPattern *font = fonts->fonts[i];
  FcPatternPrint(font);
}

FcFontSetDestroy(fonts);
FcObjectSetDestroy(properties);
FcPatternDestroy(pattern);
Quote:
Originally Posted by Justin View Post
I've started on the intergration, http://1014.org/shiz/shup/fontconfig.patch
Thank you! Seems to work well except on files containing multiple fontfaces (like .ttc fonts). FC_INDEX from the hit pattern should be given to FT_New_Face.

Quote:
Originally Posted by Justin View Post
1) The fonts in REAPER and libSwell.colortheme etc being mapped differently (can we set preferred fallback fonts?)
I don't understand what you mean by "being mapped differently", but fallbacks are usually configured through system-wide or user XML files. They can be loaded from code too with FcConfigParseAndLoad or FcConfigParseAndLoadFromMemory.
https://wiki.archlinux.org/index.php..._default_fonts

Quote:
Originally Posted by Justin View Post
2) App-local fonts (we include liberation sans and a modified version of Bravura) -- can we shove these into our instance of fontconfig?
Code:
FcConfigAppFontAddFile(s_fontconfig,
  (const FcChar8 *)"/opt/REAPER/Plugins/Reavura.otf");
(An application font is not given priority over a system font if the later is deemed better.)

Last edited by cfillion; 08-16-2018 at 11:37 AM.
cfillion is offline   Reply With Quote