Look for FontConfig "fonts.conf" on Haiku, too

h/t Luc
This commit is contained in:
Bill Kendrick 2025-01-03 21:21:44 -08:00
parent 1b293283a5
commit bb675a9e4b
2 changed files with 13 additions and 5 deletions

View file

@ -34,13 +34,14 @@ https://tuxpaint.org/
+ WIP Checking for fonts in any locations specified by "<dir>"
entries found in system-wide and user-level FontConfig config files.
This allows more fonts, and user-specific fonts, to be found & loaded.
- TODO - Looks in $FONTCONFIG_PATH/fonts.conf on macOS/iOS, otherwise
Un*x-specific `/etc/fonts/fonts.conf` and
- TODO - Looks in $FONTCONFIG_PATH/fonts.conf on macOS/iOS,
`/boot/system/settings/fonts/fonts.conf` on Haiku, otherwise
the Un*x-specific `/etc/fonts/fonts.conf` and
`~/.config/fontconfig/fonts.conf`. Should look in the correct
places on other platforms.
- Note: This adds a build dependency on `libxml-2.0`.
Bill Kendrick <bill@newbreedsoftware.com>
h/t Mark Kim
h/t Mark Kim & Luc Schrijvers
+ Tux Paint on Windows loads user fonts.
TOYAMA Shin-ichi <dolphin6k@wmail.plala.or.jp>

View file

@ -1,7 +1,7 @@
/*
fonts.c
Copyright (c) 2009-2024
Copyright (c) 2009-2025
https://tuxpaint.org/
This program is free software; you can redistribute it and/or modify
@ -19,7 +19,7 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
(See COPYING.txt)
Last modified: December 29, 2024
Last modified: January 3, 2025
*/
#include <stdio.h>
@ -1100,6 +1100,13 @@ char * * malloc_fontconfig_config_paths(int num_to_malloc, int * num_actually_ma
fontconfig_config_paths[0] = malloc(1024);
snprintf(fontconfig_config_paths[0], 1024, "%s/fonts.conf", getenv("FONTCONFIG_PATH"));
}
#elif defined(__HAIKU__)
fontconfig_config_paths = malloc_fontconfig_config_paths(1, &num_fontconfig_config_paths);
if (fontconfig_config_paths != NULL)
{
fontconfig_config_paths[0] = malloc(1024);
snprintf(fontconfig_config_paths[0], 1024, "/boot/system/settings/fonts/fonts.conf");
}
#else
fontconfig_config_paths = malloc_fontconfig_config_paths(2, &num_fontconfig_config_paths);
if (fontconfig_config_paths != NULL)