[vlc-commits] configure: provide --with options to override default fonts
Luca Barbato
git at videolan.org
Tue Apr 2 14:09:08 CEST 2013
vlc | branch: master | Luca Barbato <lu_zero at gentoo.org> | Mon Apr 1 21:18:01 2013 +0200| [e297db1dd3f0267ee8e65d405150b1968833b44d] | committer: Rafaël Carré
configure: provide --with options to override default fonts
Most distributions have fonts in paths different from defaults.
Signed-off-by: Rafaël Carré <funman at videolan.org>
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=e297db1dd3f0267ee8e65d405150b1968833b44d
---
configure.ac | 22 ++++++++++++++
modules/text_renderer/freetype.c | 56 +++++++++++++++++++++++-------------
modules/visualization/projectm.cpp | 10 +++++++
3 files changed, 68 insertions(+), 20 deletions(-)
diff --git a/configure.ac b/configure.ac
index 08e0971..c833434 100644
--- a/configure.ac
+++ b/configure.ac
@@ -3109,6 +3109,28 @@ AC_ARG_ENABLE(fribidi,
AC_ARG_ENABLE(fontconfig,
[ --enable-fontconfig fontconfig support (default auto)])
+AC_ARG_WITH([default-font],
+ AS_HELP_STRING([--default-font=PATH],
+ [Path to the default font]),
+ [AC_DEFINE_UNQUOTED([DEFAULT_FONT_FILE],
+ "$withval", [Default font])])
+AC_ARG_WITH([default-monospace-font],
+ AS_HELP_STRING([--default-monospace-font=PATH],
+ [Path to the default font]),
+ [AC_DEFINE_UNQUOTED([DEFAULT_MONOSPACE_FONT_FILE],
+ "$withval", [Default monospace font])])
+
+AC_ARG_WITH([default-font-family],
+ AS_HELP_STRING([--default-font-family=NAME],
+ [Path to the default font family]),
+ [AC_DEFINE_UNQUOTED([DEFAULT_FAMILY],
+ "$withval", [Default font family])])
+AC_ARG_WITH([default-monospace-font-family],
+ AS_HELP_STRING([--default-monospace-font-family=NAME],
+ [Path to the default font family]),
+ [AC_DEFINE_UNQUOTED([DEFAULT_MONOSPACE_FAMILY],
+ "$withval", [Default monospace font family])])
+
if test "${enable_freetype}" != "no"; then
PKG_CHECK_MODULES(FREETYPE, freetype2, [
have_freetype=yes
diff --git a/modules/text_renderer/freetype.c b/modules/text_renderer/freetype.c
index 7565375..9f94fb0 100644
--- a/modules/text_renderer/freetype.c
+++ b/modules/text_renderer/freetype.c
@@ -47,30 +47,46 @@
/* Default fonts */
#ifdef __APPLE__
-# define DEFAULT_FONT_FILE "/Library/Fonts/Arial Unicode.ttf"
-# define DEFAULT_FAMILY "Arial Unicode MS"
-# define DEFAULT_MONOSPACE_FONT_FILE "/System/Library/Fonts/Monaco.dfont"
-# define DEFAULT_MONOSPACE_FAMILY "Monaco"
+# define SYSTEM_DEFAULT_FONT_FILE "/Library/Fonts/Arial Unicode.ttf"
+# define SYSTEM_DEFAULT_FAMILY "Arial Unicode MS"
+# define SYSTEM_DEFAULT_MONOSPACE_FONT_FILE "/System/Library/Fonts/Monaco.dfont"
+# define SYSTEM_DEFAULT_MONOSPACE_FAMILY "Monaco"
#elif defined( WIN32 )
-# define DEFAULT_FONT_FILE "arial.ttf" /* Default path font found at run-time */
-# define DEFAULT_FAMILY "Arial"
-# define DEFAULT_MONOSPACE_FONT_FILE "cour.ttf"
-# define DEFAULT_MONOSPACE_FAMILY "Courier New"
+# define SYSTEM_DEFAULT_FONT_FILE "arial.ttf" /* Default path font found at run-time */
+# define SYSTEM_DEFAULT_FAMILY "Arial"
+# define SYSTEM_DEFAULT_MONOSPACE_FONT_FILE "cour.ttf"
+# define SYSTEM_DEFAULT_MONOSPACE_FAMILY "Courier New"
#elif defined( __OS2__ )
-# define DEFAULT_FONT_FILE "/psfonts/tnrwt_k.ttf"
-# define DEFAULT_FAMILY "Times New Roman WT K"
-# define DEFAULT_MONOSPACE_FONT_FILE "/psfonts/mtsansdk.ttf"
-# define DEFAULT_MONOSPACE_FAMILY "Monotype Sans Duospace WT K"
+# define SYSTEM_DEFAULT_FONT_FILE "/psfonts/tnrwt_k.ttf"
+# define SYSTEM_DEFAULT_FAMILY "Times New Roman WT K"
+# define SYSTEM_DEFAULT_MONOSPACE_FONT_FILE "/psfonts/mtsansdk.ttf"
+# define SYSTEM_DEFAULT_MONOSPACE_FAMILY "Monotype Sans Duospace WT K"
#elif defined( __ANDROID__ )
-# define DEFAULT_FONT_FILE "/system/fonts/DroidSans-Bold.ttf"
-# define DEFAULT_FAMILY "Droid Sans Bold"
-# define DEFAULT_MONOSPACE_FONT_FILE "/system/fonts/DroidSansMono.ttf"
-# define DEFAULT_MONOSPACE_FAMILY "Droid Sans Mono"
+# define SYSTEM_DEFAULT_FONT_FILE "/system/fonts/DroidSans-Bold.ttf"
+# define SYSTEM_DEFAULT_FAMILY "Droid Sans Bold"
+# define SYSTEM_DEFAULT_MONOSPACE_FONT_FILE "/system/fonts/DroidSansMono.ttf"
+# define SYSTEM_DEFAULT_MONOSPACE_FAMILY "Droid Sans Mono"
#else
-# define DEFAULT_FONT_FILE "/usr/share/fonts/truetype/freefont/FreeSerifBold.ttf"
-# define DEFAULT_FAMILY "Serif Bold"
-# define DEFAULT_MONOSPACE_FONT_FILE "/usr/share/fonts/truetype/freefont/FreeMono.ttf"
-# define DEFAULT_MONOSPACE_FAMILY "Monospace"
+# define SYSTEM_DEFAULT_FONT_FILE "/usr/share/fonts/truetype/freefont/FreeSerifBold.ttf"
+# define SYSTEM_DEFAULT_FAMILY "Serif Bold"
+# define SYSTEM_DEFAULT_MONOSPACE_FONT_FILE "/usr/share/fonts/truetype/freefont/FreeMono.ttf"
+# define SYSTEM_DEFAULT_MONOSPACE_FAMILY "Monospace"
+#endif
+
+#ifndef DEFAULT_FONT_FILE
+#define DEFAULT_FONT_FILE SYSTEM_DEFAULT_FONT_FILE
+#endif
+
+#ifndef DEFAULT_FAMILY
+#define DEFAULT_FAMILY SYSTEM_DEFAULT_FAMILY
+#endif
+
+#ifndef DEFAULT_MONOSPACE_FONT_FILE
+#define DEFAULT_MONOSPACE_FONT_FILE SYSTEM_DEFAULT_MONOSPACE_FONT_FILE
+#endif
+
+#ifndef DEFAULT_MONOSPACE_FAMILY
+#define DEFAULT_MONOSPACE_FAMILY SYSTEM_DEFAULT_MONOSPACE_FAMILY
#endif
/* Freetype */
diff --git a/modules/visualization/projectm.cpp b/modules/visualization/projectm.cpp
index ff7e7d5..812be12 100644
--- a/modules/visualization/projectm.cpp
+++ b/modules/visualization/projectm.cpp
@@ -84,6 +84,16 @@ static void Close ( vlc_object_t * );
# define PRESET_PATH "/usr/share/projectM/presets"
#endif
+#ifdef DEFAULT_FONT_FILE
+#undef FONT_PATH
+#define FONT_PATH DEFAULT_FONT_FILE
+#endif
+
+#ifdef DEFAULT_MONOSPACE_FONT_FILE
+#undef FONT_PATH_MENU
+#define FONT_PATH_MENU DEFAULT_MONOSPACE_FONT_FILE
+#endif
+
vlc_module_begin ()
set_shortname( N_("projectM"))
set_description( N_("libprojectM effect") )
More information about the vlc-commits
mailing list