[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[mgp-users-jp 01155] Re: Xft2 + fontconfig support
- To: mgp-users-jp@mew.org
- Subject: [mgp-users-jp 01155] Re: Xft2 + fontconfig support
- From: Fumitoshi UKAI <ukai@debian.or.jp>
- Date: Thu, 20 Feb 2003 01:59:56 +0900
- Delivered-to: mailing list mgp-users-jp@mew.org
- In-reply-to: <>
- Mailing-list: contact mgp-users-jp-help@mew.org; run by ezmlm
- Organization: Debian JP Project
- References: <> <> <> <>
- User-agent: Wanderlust/2.10.0 (Venus) SEMI/1.14.4 (Hosorogi) FLIM/1.14.4 (Kashiharajingū-mae) APEL/10.4 Emacs/21.2 (i386-pc-linux-gnu) MULE/5.0 (SAKAKI)
At Mon, 17 Feb 2003 12:58:13 -0800 (PST),
Yoshifumi Nishida wrote:
>
> 最新の cvsに Xft2 + fontconfigを supportするコードが入っています。
> このコードを利用すると、テキストの表示に Xft2を利用できるようになります。
>
> Xft2 + fontconfigの環境がある人はテストしてもらえるとうれしいです。
> ちなみに日本語の表示には、iconv libraryが必要になります。
>
> libraryは configureが見つけてくれるはずです。問題があったら教えて下さい。
> 少なくとも RH8.0では、必要なlibraryがすべて自動的に検出されるはずです。
問題ありました。
* autoconfの使い方をまちがっています。
AC_ARG_ENABLE (FEATURE, HELP-STRING, [ACTION-IF-GIVEN],
[ACTION-IF-NOT-GIVEN])
なのに
AC_ARG_ENABLE (FEATURE, HELP-STRING, ACTION-IF_ENABLED, ACTION-IF-DISABLED)
のような書き方をしているので、--disblad-* がdefaultになってる
option (例えば xft2)に対して明示的に --enabled-xft2 すると
checking if --disable-xft2 option specified... yes
となり非常に混乱します。
ACTION-IF-GIVEN では $enabledval をみるように直しました。
それにともない HELP-STRING もかえました。
* Xft2 とかは pkg-config をつかった方がいいと思います。
(あと 普通にいれると -lXft2 じゃなくて -lXft になると思うのですが
そっちはそのままにしてあります)
他にも pkg-config つかえるやつはそれを見るようにしました。
* mpg.h の freetype.h の includeはこうじゃないでしょうか。
# とはいえ、ここの ifdef FREETYPE は freetype1 で、
# Xft2 + fontconfig とは同時には使えなさそうなかんじですが…
添付の patch あてて autoconf して、configure, xmkmf -a, make
で 問題ないようです。
Index: configure.in
===================================================================
RCS file: /cvsmgp/kit/configure.in,v
retrieving revision 1.84
diff -u -u -r1.84 configure.in
--- configure.in 17 Feb 2003 05:25:22 -0000 1.84
+++ configure.in 19 Feb 2003 16:49:43 -0000
@@ -39,19 +39,25 @@
OPTFLAGS="$OPTFLAGS -DGUNZIP=\\\"$mgp_cv_path_gunzip\\\""
dnl Checks for debugging option.
-AC_MSG_CHECKING(if --enable-debug option specified)
+AC_MSG_CHECKING(if debugging is enabled)
AC_ARG_ENABLE(debug,
[ --enable-debug compile debugging information in.],
- [mgp_debug="yes"; OPTFLAGS="$OPTFLAGS -g -DDEBUG -Wall"],
+ [mgp_debug="$enableval"],
[mgp_debug="no"])
+if test "$mgp_debug" = "yes"; then
+ OPTFLAGS="$OPTFLAGS -g -DDEBUG -Wall"
+fi
AC_MSG_RESULT($mgp_debug)
dnl Checks for locale option.
-AC_MSG_CHECKING(if --enable-locale option specified)
+AC_MSG_CHECKING(if setlocale() should be used)
AC_ARG_ENABLE(locale,
[ --enable-locale perform setlocale() on invocation.],
- [mgp_locale="yes"; OPTFLAGS="$OPTFLAGS -DUSE_SETLOCALE"],
+ [mgp_locale="$enableval"],
[mgp_locale="no"])
+if test $mgp_locale = "yes"; then
+ OPTFLAGS="$OPTFLAGS -DUSE_SETLOCALE"
+fi
AC_MSG_RESULT($mgp_locale)
AC_HEADER_STDC
@@ -76,15 +82,16 @@
dnl Checks for libraries.
LIBS="-lm $LIBS"
-AC_MSG_CHECKING(if --disable-freetype option specified)
+AC_MSG_CHECKING(if freetype1 is used)
AC_ARG_ENABLE(freetype,
- [ --disable-freetype DON'T use freetype routines.],
- [mgp_skip_freetype="yes"; mgp_use_freetype="no"],
- [mgp_skip_freetype="no"; mgp_use_freetype="yes"])
-AC_MSG_RESULT($mgp_skip_freetype)
+ [ --disable-freetype DON'T use freetype1 routines.],
+ [mgp_use_freetype="$enableval"],
+ [mgp_use_freetype="yes"])
+AC_MSG_RESULT($mgp_use_freetype)
if test "$mgp_use_freetype" = "yes"; then
- AC_MSG_CHECKING(for freetype library/header)
+ # XXX: freetype2 may use freetype-config
+ AC_MSG_CHECKING(for freetype1 library/header)
for dir in /usr/local/freetype /usr/local /opt/freetype /usr/pkg /usr; do
ac_cv_ft_lib=no
ac_cv_ft_include=no
@@ -116,34 +123,41 @@
else
AC_MSG_RESULT($ac_cv_ft_lib and $ac_cv_ft_include)
fi
-fi
-if test "$mgp_use_freetype" = "yes"; then
- LIBS="-L$ac_cv_ft_lib $LIBS"
- OPTFLAGS="-I$ac_cv_ft_include $OPTFLAGS"
- DEPLIBS="$ac_cv_ft_lib/$ac_cv_ft_libpath $DEPLIBS"
- AC_CHECK_LIB(intl, dgettext)
- AC_CHECK_LIB(ttf, TT_Init_FreeType, [],
+ if test "$mgp_use_freetype" = "yes"; then
+ LIBS="-L$ac_cv_ft_lib $LIBS"
+ OPTFLAGS="-I$ac_cv_ft_include $OPTFLAGS"
+ DEPLIBS="$ac_cv_ft_lib/$ac_cv_ft_libpath $DEPLIBS"
+ AC_CHECK_LIB(intl, dgettext)
+ AC_CHECK_LIB(ttf, TT_Init_FreeType, [],
[echo "Fatal: libttf.a not found"
exit 1])
- AC_TRY_COMPILE([#include <freetype.h>], [], [], [dnl
+ AC_TRY_COMPILE([#include <freetype.h>], [], [], [dnl
echo "Fatal: freetype.h not found"
exit 1])
- AC_DEFINE(FREETYPE)
- AC_MSG_CHECKING(for num_CharMaps field in TT_Face_Properties)
- AC_TRY_COMPILE([#include <freetype.h>],
+ AC_DEFINE(FREETYPE)
+ AC_MSG_CHECKING(for num_CharMaps field in TT_Face_Properties)
+ AC_TRY_COMPILE([#include <freetype.h>],
[TT_Face_Properties x; return x.num_CharMaps;],
[result=yes; AC_DEFINE(HAVE_TT_FACE_PROPERTIES_CHARMAPS)],
[result=no])
- AC_MSG_RESULT($result)
+ AC_MSG_RESULT($result)
+ fi
fi
-AC_MSG_CHECKING(if --disable-xft2 option specified)
+AC_MSG_CHECKING(if Xft2 is used)
AC_ARG_ENABLE(xft2,
[ --disable-xft2 DON'T use xft2 libraries.],
- [mgp_skip_xft2="yes"; mgp_use_xft2="no"],
- [mgp_skip_xft2="no"; mgp_use_xft2="yes"])
-AC_MSG_RESULT($mgp_skip_xft2)
+ [mgp_use_xft2="$enableval"],
+ [mgp_use_xft2="yes"])
+AC_MSG_RESULT($mgp_use_xft2)
if test "$mgp_use_xft2" = "yes"; then
+ if type pkg-config > /dev/null 2>&1; then
+ if pkg-config xft; then
+ OPTFLAGS="`pkg-config --cflags xft` $OPTFLAGS"
+ LIBS="$LIBS `pkg-config --libs xft`"
+ AC_DEFINE(USE_XFT2)
+ fi
+ else
AC_MSG_CHECKING(for xft2 and ft2 and fc header..)
for dir in /usr/include /usr/include/Xft2 /usr/X11R6/include \
/usr/local/include /usr/include/freetype2; do
@@ -172,12 +186,13 @@
OPTFLAGS="-I$ac_cv_fc_hdrdir $OPTFLAGS"
fi
fi
-fi
-if test "$mgp_use_xft2" = "yes"; then
- AC_MSG_CHECKING(for xft2 library..)
- AC_CHECK_LIB(Xft2, XftFontOpen,
+ if test "$mgp_use_xft2" = "yes"; then
+ AC_MSG_CHECKING(for xft2 library..)
+ AC_CHECK_LIB(Xft2, XftFontOpen,
[LIBS="$LIBS -lXft2 -lfontconfig"
AC_DEFINE(USE_XFT2)], [], [-lfontconfig])
+ fi
+ fi
fi
if test "$mgp_use_xft2" = "yes"; then
AC_MSG_CHECKING(for iconv..)
@@ -185,12 +200,12 @@
[AC_CHECK_LIB(iconv, iconv_open, [AC_DEFINE(HAVE_ICONV)])])
fi
-AC_MSG_CHECKING(if --disable-vflib option specified)
+AC_MSG_CHECKING(if vflib is used)
AC_ARG_ENABLE(vflib,
[ --disable-vflib DON'T use vflib routines.],
- [mgp_skip_vflib="yes"; mgp_use_vflib="no"],
- [mgp_skip_vflib="no"; mgp_use_vflib="yes"])
-AC_MSG_RESULT($mgp_skip_vflib)
+ [mgp_use_vflib="$enableval"],
+ [mgp_use_vflib="yes"])
+AC_MSG_RESULT($mgp_use_vflib)
if test "$mgp_use_vflib" = "yes"; then
AC_MSG_CHECKING(for VFlib library/header)
@@ -279,10 +294,10 @@
fi
if test "$mgp_use_freetype" = "yes"; then
- AC_MSG_CHECKING(if --enable-freetype-charset16 option specified)
+ AC_MSG_CHECKING(if freetype-charset16 is enabled)
AC_ARG_ENABLE(freetype-charset16,
[ --enable-freetype-charset16 use freetype for chaset16.],
- [mgp_use_freetype_c16="yes"],
+ [mgp_use_freetype_c16="$enableval"],
[mgp_use_freetype_c16="no"])
AC_MSG_RESULT($mgp_use_freetype_c16)
@@ -291,7 +306,14 @@
fi
fi
-for i in /usr/pkg /usr/local /usr; do
+if type pkg-config > /dev/null 2>&1; then
+ if pkg-config libpng; then
+ LIBS="$LIBS `pkg-config --libs libpng`"
+ OPTFLAGS="$OPTFLAGS `pkg-config --cflags libpng`"
+ AC_DEFINE(USE_PNG)
+ fi
+else
+ for i in /usr/pkg /usr/local /usr; do
if test -f $i/include/png.h; then
if test -f $i/lib/libpng.a ; then
DEPLIBS="$DEPLIBS $i/lib/libpng.a"
@@ -311,7 +333,8 @@
[], [-lz])])
break
fi
-done
+ done
+fi
for i in /usr/pkg /usr/local /usr; do
if test -f $i/include/libmng.h; then
@@ -337,10 +360,10 @@
dnl Checks for header files.
AC_PATH_X
-AC_MSG_CHECKING(if --enable-gif option specified)
+AC_MSG_CHECKING(if gif handling is enabled)
AC_ARG_ENABLE(gif,
[ --enable-gif compile gif support in (need libungif).],
- [mgp_gif="yes"],
+ [mgp_gif="$enableval"],
[mgp_gif="no"])
AC_MSG_RESULT($mgp_gif)
if test $mgp_gif = "yes"; then
@@ -383,13 +406,21 @@
USE_IMLIB=0
AC_SUBST(USE_IMLIB)
-AC_MSG_CHECKING(if --enable-imlib option specified)
+AC_MSG_CHECKING(if imlib is used)
AC_ARG_ENABLE(imlib,
[ --enable-imlib use imlib exclusively to load images.],
- [mgp_imlib="yes"],
+ [mgp_imlib="$enableval"],
[mgp_imlib="no"])
AC_MSG_RESULT($mgp_imlib)
if test $mgp_imlib = "yes"; then
+ if type pkg-config > /dev/null 2>&1; then
+ if pkg-config imlib; then
+ LIBS="$LIBS `pkg-config --libs imlib`"
+ OPTFLAGS="$OPTFLAGS `pkg-config --cflags imlib`"
+ AC_DEFINE(USE_IMLIB)
+ USE_IMLIB=1
+ fi
+ else
AC_CHECK_LIB(Imlib, Imlib_init,
[imlib_ok=yes
LIBS="$LIBS -lImlib"
@@ -414,6 +445,7 @@
echo 'FATAL: can not find Imlib.h. pass proper CPPFLAGS to configure.'
exit 1
fi
+ fi
fi
dnl add GIFLIB to LIBS
Index: mgp.h
===================================================================
RCS file: /cvsmgp/kit/mgp.h,v
retrieving revision 1.131
diff -u -u -r1.131 mgp.h
--- mgp.h 17 Feb 2003 05:25:22 -0000 1.131
+++ mgp.h 19 Feb 2003 16:49:43 -0000
@@ -90,7 +90,7 @@
#endif /* end of VFLIB */
#ifdef FREETYPE
-#include "freetype.h"
+#include <freetype/freetype.h>
#ifndef FREETYPEFONTDIR
#define FREETYPEFONTDIR "/usr/local/share/fonts/ttf"
--
鵜飼文敏