Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/src/fonts.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/fonts.c')
-rw-r--r--src/fonts.c19
1 files changed, 15 insertions, 4 deletions
diff --git a/src/fonts.c b/src/fonts.c
index 7671c08..3fe0574 100644
--- a/src/fonts.c
+++ b/src/fonts.c
@@ -123,6 +123,8 @@ SDL_Thread *font_thread;
#endif
+#include "tuxpaint.h"
+
#ifdef FORKED_FONTS
int no_system_fonts;
@@ -193,7 +195,7 @@ static TuxPaint_Font *try_alternate_font(int size)
if ((p = strrchr(prefix, '_')) != NULL)
{
*p = 0;
- snprintf(str, sizeof(str), "%sfonts/locale/%s.ttf", DATA_PREFIX, prefix);
+ snprintf(str, sizeof(str), "%s/fonts/locale/%s.ttf", DATA_PREFIX, prefix);
return TuxPaint_Font_OpenFont("", str, size);
}
@@ -213,14 +215,14 @@ TuxPaint_Font *load_locale_font(TuxPaint_Font * fallback, int size)
else
{
char str[128];
- snprintf(str, sizeof(str), "%sfonts/locale/%s.ttf", DATA_PREFIX, lang_prefix);
+ snprintf(str, sizeof(str), "%s/fonts/locale/%s.ttf", DATA_PREFIX, lang_prefix);
ret = TuxPaint_Font_OpenFont("", str, size);
#ifdef __APPLE__
if (!ret)
{
- snprintf(str, sizeof(str), "%sfonts/%s.ttf", DATA_PREFIX, lang_prefix);
+ snprintf(str, sizeof(str), "%s/fonts/%s.ttf", DATA_PREFIX, lang_prefix);
ret = TuxPaint_Font_OpenFont("", str, size);
}
@@ -335,6 +337,13 @@ TuxPaint_Font *TuxPaint_Font_OpenFont(const char *pangodesc, const char *ttffile
}
#endif
+ char fname_buf[MAX_PATH];
+ if (ttffilename[0] != '/')
+ {
+ snprintf(fname_buf, sizeof(fname_buf), "%s/%s", DATA_PREFIX, ttffilename);
+ ttffilename = fname_buf;
+ }
+
tpf = (TuxPaint_Font *) malloc(sizeof(TuxPaint_Font));
tpf->typ = FONT_TYPE_TTF;
tpf->ttf_font = TTF_OpenFont(ttffilename, size);
@@ -935,10 +944,12 @@ static void loadfonts(SDL_Surface * screen, const char *const dir)
/* static */ int load_user_fonts(SDL_Surface * screen, void *vp, const char *restrict const locale)
{
char *homedirdir;
+ char str[MAX_PATH];
(void) vp; // junk passed by threading library
- loadfonts_locale_filter(screen, DATA_PREFIX "fonts", locale);
+ snprintf(str, sizeof(str), "%s/fonts", DATA_PREFIX);
+ loadfonts_locale_filter(screen, str, locale);
if (!no_system_fonts)
{