From 02de9ff8db9da733807323a9c392311956b3385c Mon Sep 17 00:00:00 2001 From: Vincent Sanders Date: Fri, 27 Feb 2009 09:56:02 +0000 Subject: Improve freetype build integration (from hiyuh) Improve error checking on font initialization svn path=/trunk/netsurf/; revision=6655 --- Makefile | 4 ++-- framebuffer/fb_font_freetype.c | 3 ++- framebuffer/fb_gui.c | 5 +++-- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index 703a2b7b1..3de7426f9 100644 --- a/Makefile +++ b/Makefile @@ -470,8 +470,8 @@ ifeq ($(TARGET),framebuffer) $(eval $(call feature_enabled,MNG,-DWITH_MNG,-lmng,PNG support)) ifeq ($(NETSURF_FB_FONTLIB),freetype) - CFLAGS += -DFB_USE_FREETYPE -I/usr/include/freetype2 - LDFLAGS += -lfreetype + CFLAGS += -DFB_USE_FREETYPE $(shell freetype-config --cflags) + LDFLAGS += $(shell freetype-config --libs) endif # define additional CFLAGS and LDFLAGS requirements for pkg-configed libs here diff --git a/framebuffer/fb_font_freetype.c b/framebuffer/fb_font_freetype.c index 64c76c172..8c3ae76b3 100644 --- a/framebuffer/fb_font_freetype.c +++ b/framebuffer/fb_font_freetype.c @@ -99,7 +99,7 @@ fb_new_face(const char *fontfile) FT_Face aface; newf = calloc(1, sizeof(fb_faceid_t)); - newf->fontfile=strdup(fontfile); + newf->fontfile = strdup(fontfile); error = FTC_Manager_LookupFace(ft_cmanager, (FTC_FaceID)newf, &aface); if (error) { @@ -149,6 +149,7 @@ bool fb_font_init(void) fb_face_sans_serif = fb_new_face("/usr/share/fonts/truetype/ttf-bitstream-vera/Vera.ttf"); if (fb_face_sans_serif == NULL) { LOG(("Could not find default font (code %d)\n", error)); + FTC_Manager_Done(ft_cmanager ); FT_Done_FreeType(library); return false; } diff --git a/framebuffer/fb_gui.c b/framebuffer/fb_gui.c index cb88a7b7f..276aba62d 100644 --- a/framebuffer/fb_gui.c +++ b/framebuffer/fb_gui.c @@ -260,12 +260,13 @@ void gui_init(int argc, char** argv) default: LOG(("Unsupported bit depth (%d)", framebuffer->bpp)); - exit(1); + die("Unsupported bit depth"); } framebuffer->cursor = fb_cursor_init(framebuffer, &pointer_image); - fb_font_init(); + if (fb_font_init() == false) + die("Unable to initialise the font system"); } -- cgit v1.2.3