Lean on autoconf to find useful FreeType functions (bug 95)
This commit is contained in:
parent
2b45ef3a8a
commit
79621aa5c7
|
@ -113,12 +113,15 @@ AC_SUBST(FREETYPE_LIBS)
|
||||||
AC_SUBST(FREETYPE_CFLAGS)
|
AC_SUBST(FREETYPE_CFLAGS)
|
||||||
|
|
||||||
#
|
#
|
||||||
# Check to see whether we have FT_Get_First_Char(), new in 2.0.9
|
# Check to see whether we have:
|
||||||
|
# FT_Get_Next_Char
|
||||||
|
# FT_Get_BDF_Property
|
||||||
|
# FT_Get_PS_Font_Info
|
||||||
#
|
#
|
||||||
|
|
||||||
fontconfig_save_libs=$LIBS
|
fontconfig_save_libs=$LIBS
|
||||||
LIBS="$LIBS $FREETYPE_LIBS"
|
LIBS="$LIBS $FREETYPE_LIBS"
|
||||||
AC_CHECK_FUNCS(FT_Get_First_Char)
|
AC_CHECK_FUNCS(FT_Get_Next_Char FT_Get_BDF_Property FT_Get_PS_Font_Info)
|
||||||
LIBS=$fontconfig_save_libs
|
LIBS=$fontconfig_save_libs
|
||||||
|
|
||||||
#
|
#
|
||||||
|
|
|
@ -55,10 +55,9 @@
|
||||||
#include <freetype/ttnameid.h>
|
#include <freetype/ttnameid.h>
|
||||||
#include <freetype/t1tables.h>
|
#include <freetype/t1tables.h>
|
||||||
|
|
||||||
#if (FREETYPE_MINOR > 1 || (FREETYPE_MINOR == 1 && FREETYPE_PATCH >= 4))
|
#if HAVE_FT_GET_BDF_PROPERTY
|
||||||
#include <freetype/ftbdf.h>
|
#include <freetype/ftbdf.h>
|
||||||
#include <freetype/ftmodule.h>
|
#include <freetype/ftmodule.h>
|
||||||
#define USE_FTBDF
|
|
||||||
#define HAS_BDF_PROPERTY(f) ((f) && (f)->driver && \
|
#define HAS_BDF_PROPERTY(f) ((f) && (f)->driver && \
|
||||||
(f)->driver->root.clazz->get_interface)
|
(f)->driver->root.clazz->get_interface)
|
||||||
#define MY_Get_BDF_Property(f,n,p) (HAS_BDF_PROPERTY(f) ? \
|
#define MY_Get_BDF_Property(f,n,p) (HAS_BDF_PROPERTY(f) ? \
|
||||||
|
@ -66,6 +65,13 @@
|
||||||
FT_Err_Invalid_Argument)
|
FT_Err_Invalid_Argument)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if !HAVE_FT_GET_BDF_PROPERTY
|
||||||
|
#warning "No FT_Get_BDF_Property"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if !HAVE_FT_GET_PS_FONT_INFO
|
||||||
|
#warning "No FT_Get_Font_Info"
|
||||||
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Keep Han languages separated by eliminating languages
|
* Keep Han languages separated by eliminating languages
|
||||||
|
@ -357,8 +363,10 @@ FcFreeTypeQuery (const FcChar8 *file,
|
||||||
const FcChar8 *foundry = 0;
|
const FcChar8 *foundry = 0;
|
||||||
int spacing;
|
int spacing;
|
||||||
TT_OS2 *os2;
|
TT_OS2 *os2;
|
||||||
|
#if HAVE_FT_GET_PS_FONT_INFO
|
||||||
PS_FontInfoRec psfontinfo;
|
PS_FontInfoRec psfontinfo;
|
||||||
#ifdef USE_FTBDF
|
#endif
|
||||||
|
#if HAVE_FT_GET_BDF_PROPERTY
|
||||||
BDF_PropertyRec prop;
|
BDF_PropertyRec prop;
|
||||||
#endif
|
#endif
|
||||||
TT_Header *head;
|
TT_Header *head;
|
||||||
|
@ -793,6 +801,7 @@ FcFreeTypeQuery (const FcChar8 *file,
|
||||||
* Code from g2@magestudios.net (Gerard Escalante)
|
* Code from g2@magestudios.net (Gerard Escalante)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#if HAVE_FT_GET_PS_FONT_INFO
|
||||||
if (FT_Get_PS_Font_Info(face, &psfontinfo) == 0)
|
if (FT_Get_PS_Font_Info(face, &psfontinfo) == 0)
|
||||||
{
|
{
|
||||||
if (weight == -1 && psfontinfo.weight)
|
if (weight == -1 && psfontinfo.weight)
|
||||||
|
@ -817,8 +826,9 @@ FcFreeTypeQuery (const FcChar8 *file,
|
||||||
if(!foundry)
|
if(!foundry)
|
||||||
foundry = FcNoticeFoundry(psfontinfo.notice);
|
foundry = FcNoticeFoundry(psfontinfo.notice);
|
||||||
}
|
}
|
||||||
|
#endif /* HAVE_FT_GET_PS_FONT_INFO */
|
||||||
|
|
||||||
#ifdef USE_FTBDF
|
#if HAVE_FT_GET_BDF_PROPERTY
|
||||||
/*
|
/*
|
||||||
* Finally, look for a FOUNDRY BDF property if no other
|
* Finally, look for a FOUNDRY BDF property if no other
|
||||||
* mechanism has managed to locate a foundry
|
* mechanism has managed to locate a foundry
|
||||||
|
@ -866,7 +876,6 @@ FcFreeTypeQuery (const FcChar8 *file,
|
||||||
printf ("\tsetwidth %s maps to %d\n", prop.u.atom, width);
|
printf ("\tsetwidth %s maps to %d\n", prop.u.atom, width);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -934,7 +943,7 @@ FcFreeTypeQuery (const FcChar8 *file,
|
||||||
if (!cs)
|
if (!cs)
|
||||||
goto bail1;
|
goto bail1;
|
||||||
|
|
||||||
#ifdef USE_FTBDF
|
#if HAVE_FT_GET_BDF_PROPERTY
|
||||||
/* For PCF fonts, override the computed spacing with the one from
|
/* For PCF fonts, override the computed spacing with the one from
|
||||||
the property */
|
the property */
|
||||||
if(MY_Get_BDF_Property(face, "SPACING", &prop) == 0 &&
|
if(MY_Get_BDF_Property(face, "SPACING", &prop) == 0 &&
|
||||||
|
@ -985,7 +994,7 @@ FcFreeTypeQuery (const FcChar8 *file,
|
||||||
goto bail1;
|
goto bail1;
|
||||||
if (!FcPatternAddBool (pat, FC_ANTIALIAS, FcFalse))
|
if (!FcPatternAddBool (pat, FC_ANTIALIAS, FcFalse))
|
||||||
goto bail1;
|
goto bail1;
|
||||||
#ifdef USE_FTBDF
|
#if HAVE_FT_GET_BDF_PROPERTY
|
||||||
if(face->num_fixed_sizes == 1) {
|
if(face->num_fixed_sizes == 1) {
|
||||||
int rc;
|
int rc;
|
||||||
int value;
|
int value;
|
||||||
|
@ -1062,31 +1071,10 @@ bail:
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Figure out whether the available freetype has FT_Get_Next_Char
|
|
||||||
*/
|
|
||||||
|
|
||||||
#if FREETYPE_MAJOR > 2
|
|
||||||
# define HAS_NEXT_CHAR
|
|
||||||
#else
|
|
||||||
# if FREETYPE_MAJOR == 2
|
|
||||||
# if FREETYPE_MINOR > 0
|
|
||||||
# define HAS_NEXT_CHAR
|
|
||||||
# else
|
|
||||||
# if FREETYPE_MINOR == 0
|
|
||||||
# if FREETYPE_PATCH >= 9
|
|
||||||
# define HAS_NEXT_CHAR
|
|
||||||
# endif
|
|
||||||
# endif
|
|
||||||
# endif
|
|
||||||
# endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* For our purposes, this approximation is sufficient
|
* For our purposes, this approximation is sufficient
|
||||||
*/
|
*/
|
||||||
#ifndef HAS_NEXT_CHAR
|
#if !HAVE_FT_GET_NEXT_CHAR
|
||||||
#define FT_Get_First_Char(face, gi) ((*(gi) = 1), 1)
|
|
||||||
#define FT_Get_Next_Char(face, ucs4, gi) ((ucs4) >= 0xffffff ? \
|
#define FT_Get_Next_Char(face, ucs4, gi) ((ucs4) >= 0xffffff ? \
|
||||||
(*(gi) = 0), 0 : \
|
(*(gi) = 0), 0 : \
|
||||||
(*(gi) = 1), (ucs4) + 1)
|
(*(gi) = 1), (ucs4) + 1)
|
||||||
|
|
Loading…
Reference in New Issue