diff options
author | martin-s <martin-s@ffa7fe5e-494d-0410-b361-a75ebd5db220> | 2009-01-06 18:24:56 +0000 |
---|---|---|
committer | martin-s <martin-s@ffa7fe5e-494d-0410-b361-a75ebd5db220> | 2009-01-06 18:24:56 +0000 |
commit | 5b7856e090b4993a245d35378c561322a45de265 (patch) | |
tree | 689d81e07426edd5bb84b4d75144c683ea0234ca /navit/font | |
parent | 7b5eeb7801a57f55cf16022a5f093075a0854855 (diff) | |
download | navit-svn-5b7856e090b4993a245d35378c561322a45de265.tar.gz |
Fix:Core:Check for fontconfig and provide own fonts if not present
git-svn-id: http://svn.code.sf.net/p/navit/code/trunk/navit@1906 ffa7fe5e-494d-0410-b361-a75ebd5db220
Diffstat (limited to 'navit/font')
-rw-r--r-- | navit/font/freetype/font_freetype.c | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/navit/font/freetype/font_freetype.c b/navit/font/freetype/font_freetype.c index 86363ba9..4eb7d21c 100644 --- a/navit/font/freetype/font_freetype.c +++ b/navit/font/freetype/font_freetype.c @@ -1,4 +1,7 @@ +#include "config.h" +#ifdef HAVE_FONTCONFIG #include <fontconfig/fontconfig.h> +#endif #include <ft2build.h> #include <glib.h> #include FT_FREETYPE_H @@ -7,7 +10,6 @@ #include FT_CACHE_H #endif #include <freetype/ftglyph.h> -#include "config.h" #include "point.h" #include "graphics.h" #include "debug.h" @@ -324,7 +326,8 @@ font_freetype_font_new(struct graphics_priv *gr, g_new(struct font_freetype_font, 1); *meth = font_methods; - int exact, found; + int exact, found=0; + char *name; char **family; #ifdef USE_CACHING char *idstr; @@ -341,7 +344,7 @@ font_freetype_font_new(struct graphics_priv *gr, #endif library_init = 1; } - found = 0; +#ifdef HAVE_FONTCONFIG font->size=size; dbg(2, " about to search for fonts, prefered = %s\n", fontfamily); for (exact = 1; !found && exact >= 0; exact--) { @@ -428,8 +431,14 @@ font_freetype_font_new(struct graphics_priv *gr, family++; } } +#else + name=g_strdup_printf("%s/fonts/%s-%s.ttf",getenv("NAVIT_SHAREDIR"),"LiberationSans",flags ? "Bold":"Regular"); + if (!FT_New_Face(library, name, 0, &font->face)) + found=1; + g_free(name); +#endif if (!found) { - g_warning("Failed to load font, no labelling"); + dbg(0,"Failed to load font, no labelling\n"); g_free(font); return NULL; } @@ -636,5 +645,7 @@ void plugin_init(void) { plugin_register_font_type("freetype", font_freetype_new); +#ifdef HAVE_FONTCONFIG FcInit(); +#endif } |