Improve freetype build integration (from hiyuh)

Improve error checking on font initialization

svn path=/trunk/netsurf/; revision=6655
This commit is contained in:
Vincent Sanders 2009-02-27 09:56:02 +00:00
parent 4cf1a9f36b
commit 02de9ff8db
3 changed files with 7 additions and 5 deletions

View File

@ -470,8 +470,8 @@ ifeq ($(TARGET),framebuffer)
$(eval $(call feature_enabled,MNG,-DWITH_MNG,-lmng,PNG support)) $(eval $(call feature_enabled,MNG,-DWITH_MNG,-lmng,PNG support))
ifeq ($(NETSURF_FB_FONTLIB),freetype) ifeq ($(NETSURF_FB_FONTLIB),freetype)
CFLAGS += -DFB_USE_FREETYPE -I/usr/include/freetype2 CFLAGS += -DFB_USE_FREETYPE $(shell freetype-config --cflags)
LDFLAGS += -lfreetype LDFLAGS += $(shell freetype-config --libs)
endif endif
# define additional CFLAGS and LDFLAGS requirements for pkg-configed libs here # define additional CFLAGS and LDFLAGS requirements for pkg-configed libs here

View File

@ -99,7 +99,7 @@ fb_new_face(const char *fontfile)
FT_Face aface; FT_Face aface;
newf = calloc(1, sizeof(fb_faceid_t)); 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); error = FTC_Manager_LookupFace(ft_cmanager, (FTC_FaceID)newf, &aface);
if (error) { 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"); fb_face_sans_serif = fb_new_face("/usr/share/fonts/truetype/ttf-bitstream-vera/Vera.ttf");
if (fb_face_sans_serif == NULL) { if (fb_face_sans_serif == NULL) {
LOG(("Could not find default font (code %d)\n", error)); LOG(("Could not find default font (code %d)\n", error));
FTC_Manager_Done(ft_cmanager );
FT_Done_FreeType(library); FT_Done_FreeType(library);
return false; return false;
} }

View File

@ -260,12 +260,13 @@ void gui_init(int argc, char** argv)
default: default:
LOG(("Unsupported bit depth (%d)", framebuffer->bpp)); LOG(("Unsupported bit depth (%d)", framebuffer->bpp));
exit(1); die("Unsupported bit depth");
} }
framebuffer->cursor = fb_cursor_init(framebuffer, &pointer_image); framebuffer->cursor = fb_cursor_init(framebuffer, &pointer_image);
fb_font_init(); if (fb_font_init() == false)
die("Unable to initialise the font system");
} }