* configure.ac: Check availability of FT_Face_GetCharVariantIndex.
* src/ftfont.c (ftfont_variation_glyphs) [HAVE_FT_FACE_GETCHARVARIANTINDEX]:
Add function implementation.
* src/ftcrfont.c (ftcrfont_variation_glyphs)
[HAVE_FT_FACE_GETCHARVARIANTINDEX]: Use function implementation for
HAVE_OTF_GET_VARIATION_GLYPHS.
* src/ftfont.c (ftfont_driver) [HAVE_FT_FACE_GETCHARVARIANTINDEX]:
* src/xftfont.c (xftfont_driver) [HAVE_FT_FACE_GETCHARVARIANTINDEX]:
* src/ftxfont.c (ftxfont_driver) [HAVE_FT_FACE_GETCHARVARIANTINDEX]:
* src/ftcrfont.c (ftcrfont_driver) [HAVE_FT_FACE_GETCHARVARIANTINDEX]:
Populate the get_variation_glyphs method.
if test "${HAVE_FREETYPE}" = "yes"; then
AC_DEFINE(HAVE_FREETYPE, 1,
[Define to 1 if using the freetype and fontconfig libraries.])
+ OLD_CFLAGS=$CFLAGS
+ OLD_LIBS=$LIBS
+ CFLAGS="$CFLAGS $FREETYPE_CFLAGS"
+ LIBS="$FREETYPE_LIBS $LIBS"
+ AC_CHECK_FUNCS(FT_Face_GetCharVariantIndex)
+ CFLAGS=$OLD_CFLAGS
+ LIBS=$OLD_LIBS
if test "${with_libotf}" != "no"; then
EMACS_CHECK_MODULES([LIBOTF], [libotf])
if test "$HAVE_LIBOTF" = "yes"; then
}
#endif
-#ifdef HAVE_OTF_GET_VARIATION_GLYPHS
+#if defined HAVE_OTF_GET_VARIATION_GLYPHS || defined HAVE_FT_FACE_GETCHARVARIANTINDEX
static int
ftcrfont_variation_glyphs (struct font *font, int c, unsigned variations[256])
{
return result;
}
-#endif /* HAVE_OTF_GET_VARIATION_GLYPHS */
+#endif /* HAVE_OTF_GET_VARIATION_GLYPHS || HAVE_FT_FACE_GETCHARVARIANTINDEX */
static int
ftcrfont_draw (struct glyph_string *s,
#if defined HAVE_M17N_FLT && defined HAVE_LIBOTF
.shape = ftcrfont_shape,
#endif
-#ifdef HAVE_OTF_GET_VARIATION_GLYPHS
+#if defined HAVE_OTF_GET_VARIATION_GLYPHS || defined HAVE_FT_FACE_GETCHARVARIANTINDEX
.get_variation_glyphs = ftcrfont_variation_glyphs,
#endif
.filter_properties = ftfont_filter_properties,
#endif /* HAVE_M17N_FLT */
-#ifdef HAVE_OTF_GET_VARIATION_GLYPHS
+#endif /* HAVE_LIBOTF */
+#if defined HAVE_OTF_GET_VARIATION_GLYPHS || defined HAVE_FT_FACE_GETCHARVARIANTINDEX
int
ftfont_variation_glyphs (struct font *font, int c, unsigned variations[256])
{
struct font_info *ftfont_info = (struct font_info *) font;
+#ifdef HAVE_OTF_GET_VARIATION_GLYPHS
OTF *otf = ftfont_get_otf (ftfont_info);
if (! otf)
return 0;
return OTF_get_variation_glyphs (otf, c, variations);
-}
+#else /* !HAVE_OTF_GET_VARIATION_GLYPHS */
+ FT_Face ft_face = ftfont_info->ft_size->face;
+ int i, n = 0;
-#endif /* HAVE_OTF_GET_VARIATION_GLYPHS */
-#endif /* HAVE_LIBOTF */
+ for (i = 0; i < 16; i++)
+ {
+ variations[i] = FT_Face_GetCharVariantIndex (ft_face, c, 0xFE00 + i);
+ if (variations[i])
+ n++;
+ }
+ for (; i < 256; i++)
+ {
+ variations[i] = FT_Face_GetCharVariantIndex (ft_face, c,
+ 0xE0100 + (i - 16));
+ if (variations[i])
+ n++;
+ }
+
+ return n;
+#endif /* !HAVE_OTF_GET_VARIATION_GLYPHS */
+}
+#endif /* HAVE_OTF_GET_VARIATION_GLYPHS || HAVE_FT_FACE_GETCHARVARIANTINDEX */
#ifdef HAVE_HARFBUZZ
#if defined HAVE_M17N_FLT && defined HAVE_LIBOTF
.shape = ftfont_shape,
#endif
-#ifdef HAVE_OTF_GET_VARIATION_GLYPHS
+#if defined HAVE_OTF_GET_VARIATION_GLYPHS || defined HAVE_FT_FACE_GETCHARVARIANTINDEX
.get_variation_glyphs = ftfont_variation_glyphs,
#endif
.filter_properties = ftfont_filter_properties,
#if defined HAVE_M17N_FLT && defined HAVE_LIBOTF
.shape = ftfont_shape,
#endif
-#ifdef HAVE_OTF_GET_VARIATION_GLYPHS
+#if defined HAVE_OTF_GET_VARIATION_GLYPHS || defined HAVE_FT_FACE_GETCHARVARIANTINDEX
.get_variation_glyphs = ftfont_variation_glyphs,
#endif
.filter_properties = ftfont_filter_properties,
#if defined HAVE_M17N_FLT && defined HAVE_LIBOTF
.shape = xftfont_shape,
#endif
-#ifdef HAVE_OTF_GET_VARIATION_GLYPHS
+#if defined HAVE_OTF_GET_VARIATION_GLYPHS || defined HAVE_FT_FACE_GETCHARVARIANTINDEX
.get_variation_glyphs = ftfont_variation_glyphs,
#endif
.filter_properties = ftfont_filter_properties,