diff --git a/Makefile b/Makefile index 4c91e17..da2df77 100644 --- a/Makefile +++ b/Makefile @@ -121,11 +121,16 @@ else SRC_DIR := $(TOP_DIR_2)/src endif + CAIRO_INC = $(shell pkg-config cairo --cflags | sed "s/\/freetype2//g" | sed "s/-I//g" | sed "s/ / \n/g") + FT_INCLUDES := $(OBJ_BUILD) \ $(BUILD_DIR) \ $(DEVEL_DIR) \ $(TOP_DIR)/include \ - $(SRC_DIR) + $(SRC_DIR) \ + ../resvg_rendering_port/port \ + ../resvg_rendering_port/port/resvg/capi/include \ + $(CAIRO_INC) COMPILE = $(CC) $(CPPFLAGS) \ $(CFLAGS) \ @@ -179,6 +184,10 @@ else endif endif +LINK_LIBS += -L../resvg_rendering_port/port/resvg/target/debug +LINK_LIBS += -lresvg +LINK_LIBS += $(shell pkg-config cairo --libs) + LINK = $(LINK_CMD) \ $(LINK_ITEMS) \ $(LINK_LIBS) @@ -193,6 +202,14 @@ else $(LINK_LIBS) $(subst /,$(COMPILER_SEP),$(GRAPH_LIB)) \ $(GRAPH_LINK) $(MATH) + resvg = ../resvg_rendering_port/port/build/resvg_port.o + + LINK_NEW_VIEW = $(LINK_CMD) \ + $(LINK_ITEMS) $(subst /,$(COMPILER_SEP),$(COMMON_OBJ) \ + $(FTCOMMON_OBJ)) \ + $(LINK_LIBS) $(subst /,$(COMPILER_SEP),$(GRAPH_LIB)) \ + $(GRAPH_LINK) $(MATH) $(resvg) + .PHONY: exes clean distclean @@ -519,9 +536,10 @@ else $(LINK) - $(BIN_DIR_2)/ftview$E: $(OBJ_DIR_2)/ftview.$(SO) $(FTLIB) \ - $(GRAPH_LIB) $(COMMON_OBJ) $(FTCOMMON_OBJ) - $(LINK_NEW) + + $(BIN_DIR_2)/ftview$E: $(OBJ_DIR_2)/ftview.$(SO) $(FTLIB) \ + $(GRAPH_LIB) $(COMMON_OBJ) $(FTCOMMON_OBJ) + $(LINK_NEW_VIEW) $(BIN_DIR_2)/ftgrid$E: $(OBJ_DIR_2)/ftgrid.$(SO) $(FTLIB) \ $(GRAPH_LIB) $(COMMON_OBJ) $(FTCOMMON_OBJ) diff --git a/src/ftcommon.c b/src/ftcommon.c index 89c69d0..0cb7c73 100644 --- a/src/ftcommon.c +++ b/src/ftcommon.c @@ -1118,6 +1118,17 @@ *aglyf = glyf; } + if ( glyf->format == FT_GLYPH_FORMAT_SVG ) + { + + /* render the glyph to a bitmap, don't destroy original */ + error = FT_Glyph_To_Bitmap( &glyf, FT_RENDER_MODE_NORMAL, NULL, 0 ); + if ( error ) + return error; + + *aglyf = glyf; + } + if ( glyf->format != FT_GLYPH_FORMAT_BITMAP ) PanicZ( "invalid glyph format returned!" ); diff --git a/src/ftview.c b/src/ftview.c index 60fc2dc..662e12a 100644 --- a/src/ftview.c +++ b/src/ftview.c @@ -37,6 +37,9 @@ #include FT_COLOR_H #include FT_BITMAP_H +#include FT_SVG_RENDERER_H + +#include #define MAXPTSIZE 500 /* dtp */ @@ -2007,6 +2010,11 @@ for ( ; argc > 0; argc--, argv++ ) FTDemo_Install_Font( handle, argv[0], 0, 0 ); + /* inject the hooks for SVG */ + FT_Set_Svg_Hooks( handle->library, resvg_port_init, resvg_port_free, + resvg_port_render ); + + if ( handle->num_fonts == 0 ) Fatal( "could not find/open any font file" );