[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[freetype2] GSoC-2019-moazin edd9ef1: Plug in a default library. `librsv
From: |
Moazin Khatti |
Subject: |
[freetype2] GSoC-2019-moazin edd9ef1: Plug in a default library. `librsvg' for now. |
Date: |
Sun, 21 Jul 2019 02:39:41 -0400 (EDT) |
branch: GSoC-2019-moazin
commit edd9ef1e9e98a6460ee910c985ca2d16d0c9f306
Author: Moazin Khatti <address@hidden>
Commit: Moazin Khatti <address@hidden>
Plug in a default library. `librsvg' for now.
---
builds/unix/configure.raw | 53 +++++++++++++++++++++++++++++++++++---
include/freetype/config/ftoption.h | 2 ++
src/svg/ftsvg.c | 9 +++++++
src/svg/rules.mk | 14 +++++++++-
4 files changed, 74 insertions(+), 4 deletions(-)
diff --git a/builds/unix/configure.raw b/builds/unix/configure.raw
index a1a6dbe..90bec42 100644
--- a/builds/unix/configure.raw
+++ b/builds/unix/configure.raw
@@ -542,6 +542,40 @@ if test x"$with_harfbuzz" = xyes -a "$have_harfbuzz" = no;
then
AC_MSG_ERROR([harfbuzz support requested but library not found])
fi
+# OT-SVG checks
+# Librsvg is the default for now!
+AC_ARG_WITH([svg],
+ [AS_HELP_STRING([--with-svg=@<:@yes|no|auto@:>@],
+ [support OpenType SVG fonts @<:@default=auto@:>@])],
+ [], [with_svg=auto])
+
+have_librsvg=no
+if test x"$with_svg" = xyes -o x"$with_svg"=xauto; then
+ librsvg_pkg="librsvg-2.0 >= 2.40.0"
+ have_librsvg_pkg=no
+
+ if test x"$LIBRSVG_CFLAGS" = x -a x"$LIBRSVG_LIBS" = x; then
+ PKG_CHECK_EXISTS([$librsvg_pkg], [have_librsvg_pkg=yes])
+ fi
+ PKG_CHECK_MODULES([LIBRSVG], [$librsvg_pkg],
+ [have_librsvg="yes (pkg-config)"], [:])
+
+ if test $have_librsvg_pkg = yes; then
+ # we have librsvg pkg-config file
+ librsvg_reqpriv="$librsvg_pkg"
+ librsvg_libspriv=
+ librsvg_libsstaticconf=`$PKG_CONFIG --static --libs "$librsvg_pkg"`
+ else
+ librsvg_reqpriv=
+
+ if test "$have_librsvg" != no; then
+ # LIBRSVG_CFLAGS and LIBRSVG_LIBS are set by the user
+ librsvg_libspriv="$LIBRSVG_LIBS"
+ librsvg_libsstaticconf="$LIBRSVG_LIBS"
+ have_librsvg="yes (LIBRSVG_CFLAGS and LIBRSVG_LIBS)"
+ fi
+ fi
+fi
# check for librt
#
@@ -992,7 +1026,8 @@ fi
REQUIRES_PRIVATE="$zlib_reqpriv, \
$bzip2_reqpriv, \
$libpng_reqpriv, \
- $harfbuzz_reqpriv"
+ $harfbuzz_reqpriv, \
+ $librsvg_reqpriv"
# beautify
REQUIRES_PRIVATE=`echo "$REQUIRES_PRIVATE" \
| sed -e 's/^ *//' \
@@ -1007,7 +1042,8 @@ LIBS_PRIVATE="$zlib_libspriv \
$bzip2_libspriv \
$libpng_libspriv \
$harfbuzz_libspriv \
- $ft2_extra_libs"
+ $ft2_extra_libs \
+ $librsvg_libspriv"
# beautify
LIBS_PRIVATE=`echo "$LIBS_PRIVATE" \
| sed -e 's/^ *//' \
@@ -1019,7 +1055,9 @@ LIBSSTATIC_CONFIG="-lfreetype \
$bzip2_libsstaticconf \
$libpng_libsstaticconf \
$harfbuzz_libsstaticconf \
- $ft2_extra_libs"
+ $ft2_extra_libs \
+ $librsvg_libsstaticconf"
+
# remove -L/usr/lib and -L/usr/lib64 since `freetype-config' adds them later
# on if necessary; also beautify
LIBSSTATIC_CONFIG=`echo "$LIBSSTATIC_CONFIG" \
@@ -1084,6 +1122,15 @@ else
ftoption_unset FT_CONFIG_OPTION_USE_HARFBUZZ
fi
+if test "$have_librsvg" != no; then
+ LIBRSVG_CFLAGS=$(echo $LIBRSVG_CFLAGS | sed -e 's/-I\(.*\?\)freetype2//g')
+ CFLAGS="$CFLAGS $LIBRSVG_CFLAGS"
+ LDFLAGS="$LDFLAGS $LIBRSVG_LIBS"
+ ftoption_set FT_CONFIG_OPTION_SVG_DEFAULT
+else
+ ftoption_unset FT_CONFIG_OPTION_SVG_DEFAULT
+fi
+
AC_SUBST([CFLAGS])
AC_SUBST([LDFLAGS])
diff --git a/include/freetype/config/ftoption.h
b/include/freetype/config/ftoption.h
index 1a37524..6d57391 100644
--- a/include/freetype/config/ftoption.h
+++ b/include/freetype/config/ftoption.h
@@ -501,6 +501,8 @@ FT_BEGIN_HEADER
*/
#define FT_CONFIG_OPTION_SVG
+/* #define FT_CONFIG_OPTION_SVG_DEFAULT */
+
/**************************************************************************
*
diff --git a/src/svg/ftsvg.c b/src/svg/ftsvg.c
index 0486b74..5c9d081 100644
--- a/src/svg/ftsvg.c
+++ b/src/svg/ftsvg.c
@@ -21,6 +21,9 @@
#include FT_SVG_RENDER_H
#include FT_BBOX_H
+#ifdef FT_CONFIG_OPTION_SVG_DEFAULT
+#include <rsvg_port.h>
+#endif
#include <stdio.h>
#include "ftsvg.h"
@@ -31,6 +34,12 @@
{
FT_Error error = FT_Err_Ok;
svg_module->loaded = FALSE;
+#ifdef FT_CONFIG_OPTION_SVG_DEFAULT
+ svg_module->hooks.init_svg = (SVG_Lib_Init_Func)rsvg_port_init;
+ svg_module->hooks.free_svg = (SVG_Lib_Free_Func)rsvg_port_free;
+ svg_module->hooks.render_svg = (SVG_Lib_Render_Func)rsvg_port_render;
+ svg_module->hooks.get_buffer_size =
(SVG_Lib_Get_Buffer_Size_Func)rsvg_port_get_buffer_size;
+#endif
return error;
}
diff --git a/src/svg/rules.mk b/src/svg/rules.mk
index 427580f..c5e5ed9 100644
--- a/src/svg/rules.mk
+++ b/src/svg/rules.mk
@@ -21,9 +21,13 @@ SVG_DIR := $(SRC_DIR)/svg
#
SVG_COMPILE := $(CC) $(ANSIFLAGS) \
$I$(subst /,$(COMPILER_SEP),$(SVG_DIR)) \
- $(INCLUDE_FLAGS) \
+ $(INCLUDE_FLAGS) \
$(FT_CFLAGS)
+SVG_PORT_COMPILE := $(CC) \
+ $I$(subst /,$(COMPILER_SEP),$(SVG_DIR)) \
+ $(INCLUDE_FLAGS) \
+ $(FT_CFLAGS)
# raster driver sources (i.e., C files)
#
@@ -52,6 +56,13 @@ SVG_DRV_SRC_S := $(SVG_DIR)/svg.c
# raster driver - single object
#
+
+SVG_PORT_SRC_S := $(SVG_DIR)/rsvg_port.c
+SVG_PORT_OBJ_S := $(OBJ_DIR)/rsvg_port.$O
+
+$(SVG_PORT_OBJ_S): $(SVG_PORT_SRC_S) $(FREETYPE_H)
+ $(SVG_PORT_COMPILE) $T$(subst /,$(COMPILER_SEP), $@ $(SVG_PORT_SRC_S))
+
$(SVG_DRV_OBJ_S): $(SVG_DRV_SRC_S) $(SVG_DRV_SRC) \
$(FREETYPE_H) $(SVG_DRV_H)
$(SVG_COMPILE) $T$(subst /,$(COMPILER_SEP),$@ $(SVG_DRV_SRC_S))
@@ -68,5 +79,6 @@ $(OBJ_DIR)/%.$O: $(SVG_DIR)/%.c $(FREETYPE_H) $(SVG_DRV_H)
DRV_OBJS_S += $(SVG_DRV_OBJ_S)
DRV_OBJS_M += $(SVG_DRV_OBJ_M)
+DRV_OBJS_S += $(SVG_PORT_OBJ_S)
# EOF
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [freetype2] GSoC-2019-moazin edd9ef1: Plug in a default library. `librsvg' for now.,
Moazin Khatti <=