From bb675a9e4b7940d0f8ebfc58a5a7847f9e236ddb Mon Sep 17 00:00:00 2001 From: Bill Kendrick Date: Fri, 3 Jan 2025 21:21:44 -0800 Subject: [PATCH] Look for FontConfig "fonts.conf" on Haiku, too h/t Luc --- docs/CHANGES.txt | 7 ++++--- src/fonts.c | 11 +++++++++-- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/docs/CHANGES.txt b/docs/CHANGES.txt index 94c25c72e..4244210a0 100644 --- a/docs/CHANGES.txt +++ b/docs/CHANGES.txt @@ -34,13 +34,14 @@ https://tuxpaint.org/ + WIP Checking for fonts in any locations specified by "" 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 - h/t Mark Kim + h/t Mark Kim & Luc Schrijvers + Tux Paint on Windows loads user fonts. TOYAMA Shin-ichi diff --git a/src/fonts.c b/src/fonts.c index 6e9d75e30..4868c2b37 100644 --- a/src/fonts.c +++ b/src/fonts.c @@ -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 @@ -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)