Hi Bill,
> Are there other places we should look?
No.
:)
Thanks,
Mark
On Sat, Feb 22, 2025 at 5:19 PM Bill Kendrick <nb...@so...> wrote:
> On Sat, Feb 22, 2025 at 01:41:35PM -0800, Bill Kendrick wrote:
> <snip>
> >
> > And I think for _now_, we're all set, for Windows at least...?
> > I'll attempt to summon Mark to see whether anything else needs to
> > be done on the macOS side. :)
>
> Mark, I'm realizing that Tux Paint for macOS also (like Windows)
> ships with its own FontConfig "fonts.conf" XML file.
>
> For the purposes of making fonts available in the Text and Label tools,
> beyond those in folders that Tux Paint explicitly scans (in fonts.c's
> "load_user_fonts()" function), I recently added some very minimimal
> support for parsing FontConfig "fonts.conf" files. For each "<dir>"
> it finds, it will try to load fonts from that path.
>
> In the Tux Paint's "macos/fonts.conf", I see:
>
> <dir prefix="cwd">Resources/share/tuxpaint/fonts</dir>
> <dir prefix="cwd">Resources/share/tuxpaint/fonts/locale</dir>
> <dir prefix="cwd">share/tuxpaint/fonts</dir>
> <dir prefix="cwd">share/tuxpaint/fonts/locale</dir>
> <dir>~/Library/Application Support/TuxPaint/fonts</dir>
> <dir>~/Library/Application Support/TuxPaint/fonts/locale</dir>
> <dir>/Library/Application Support/TuxPaint/fonts</dir>
> <dir>/Library/Application Support/TuxPaint/fonts/locale</dir>
>
> <dir>/Library/Fonts</dir>
> <dir>/Network/Library/Fonts</dir>
> <dir>/System/Library/Fonts</dir>
>
> And in "load_user_fonts()", inside an "__APPLE__" #ifdef test, I see
> we explicitly load fonts from these paths:
>
> loadfonts(screen, texture, renderer, "/System/Library/Fonts");
> loadfonts(screen, texture, renderer, "/Library/Fonts");
> loadfonts(screen, texture, renderer, apple_fontsPath());
> loadfonts(screen, texture, renderer, "/usr/share/fonts");
> loadfonts(screen, texture, renderer, "/usr/X11R6/lib/X11/fonts");
>
> ...where "apple_fontsPath()" comes from "src/macos.m", and simply
> plugs the $HOME env. variable into "%s/Library/Fonts".
>
>
> My assumption is that, in previous versions of Tux Paint, any fonts
> that were added to any other folders listed in "macos/fonts.conf" <dir>
> tags (but not explicitly in that hard-coded list in "src/fonts.c")
> would NOT be loaded and made available to the Text & Label tools.
>
>
> Moving forward (0.9.35 & beyond), I'd like for us to consult any
> relevant "fonts.conf" files, and load fonts found in any of the
> directories specified within (in those "<dir> tags).
>
> So for example, on Linux, I am now parsing any "fonts.conf" found
> within:
>
> * $FONTCONFIG_PATH/ (or "/etc/fonts/", if not set)
> * $XDG_CONFIG_HOME/fontconfig/ (or "$HOME/.config/fontconfig/", if not
> set)
>
>
> On macOS, we're currently looking here:
>
> * $FONTCONFIG_PATH/
>
> Are there other places we should look? I assume we should try loading the
> "fonts.conf" that we ship along with Tux Paint. Since I don't have a Mac,
> I can't really hack on this and test it, so I was hoping you could help.
> :-)
>
>
> Specifically, it's this block of code inside Tux Paint's "src/fonts.c":
>
> ...
> /* See what dirs fontconfig configuration files point to,
> and try loading fonts from those locations */
>
> #if defined(__APPLE__)
> fontconfig_config_paths = malloc_fontconfig_config_paths(1,
> &num_fontconfig_config_paths);
> if (fontconfig_config_paths != NULL)
> {
> /* Apple: Look for fonts.conf in $FONTCONFIG_PATH */
> fontconfig_config_paths[0] = malloc(1024);
> snprintf(fontconfig_config_paths[0], 1024, "%s/fonts.conf",
> getenv("FONTCONFIG_PATH"));
>
> /* FIXME: Apple: Look for the fonts.conf that we ship with Tux Paint
> for macOS */
> }
> ...
>
>
> Thanks in advance!
>
> -bill!
>
>
>
> _______________________________________________
> Tuxpaint-devel mailing list
> Tux...@li...
> https://lists.sourceforge.net/lists/listinfo/tuxpaint-devel
>
|