test "$HAVE_FREETYPE" = "no" && AC_MSG_ERROR(libxft requires libfreetype)
fi
+ fi # $HAVE_CAIRO != yes
+ HAVE_HARFBUZZ=no
HAVE_LIBOTF=no
if test "${HAVE_FREETYPE}" = "yes"; then
AC_DEFINE(HAVE_FREETYPE, 1,
optsep=
emacs_config_features=
for opt in XAW3D XPM JPEG TIFF GIF PNG RSVG CAIRO IMAGEMAGICK SOUND GPM DBUS \
- GCONF GSETTINGS GLIB NOTIFY ACL LIBSELINUX GNUTLS LIBXML2 FREETYPE M17N_FLT \
+ GCONF GSETTINGS GLIB NOTIFY ACL LIBSELINUX GNUTLS LIBXML2 FREETYPE HARFBUZZ M17N_FLT \
LIBOTF XFT ZLIB TOOLKIT_SCROLL_BARS X_TOOLKIT OLDXMENU X11 XDBE XIM \
- NS MODULES THREADS XWIDGETS LIBSYSTEMD JSON CANNOT_DUMP LCMS2 GMP; do
+ NS MODULES THREADS XWIDGETS LIBSYSTEMD JSON PDUMPER UNEXEC LCMS2 GMP; do
case $opt in
- CANNOT_DUMP) eval val=\${$opt} ;;
+ PDUMPER) val=${with_pdumper} ;;
+ UNEXEC) val=${with_unexec} ;;
GLIB) val=${emacs_cv_links_glib} ;;
NOTIFY|ACL) eval val=\${${opt}_SUMMARY} ;;
TOOLKIT_SCROLL_BARS|X_TOOLKIT) eval val=\${USE_$opt} ;;
DEFSYM (QCuser_spec, ":user-spec");
- staticpro (&scratch_font_spec);
+ /* For shapers that need to know text directionality. */
+ DEFSYM (QL2R, "L2R");
+ DEFSYM (QR2L, "R2L");
+
scratch_font_spec = Ffont_spec (0, NULL);
- staticpro (&scratch_font_prefer);
+ staticpro (&scratch_font_spec);
scratch_font_prefer = Ffont_spec (0, NULL);
+ staticpro (&scratch_font_prefer);
- staticpro (&Vfont_log_deferred);
Vfont_log_deferred = make_nil_vector (3);
+ staticpro (&Vfont_log_deferred);
#if 0
#ifdef HAVE_LIBOTF
output glyphs (M) are more than the input glyphs (N), (N+1)th
through (M)th elements of GSTRING are updated possibly by making
a new glyph object and storing it in GSTRING. If (M) is greater
- than the length of GSTRING, nil should be return. In that case,
- this function is called again with the larger GSTRING. */
+ than the length of GSTRING, this method should return nil. In
+ that case, the method is called again with a larger GSTRING. */
- Lisp_Object (*shape) (Lisp_Object lgstring);
+ Lisp_Object (*shape) (Lisp_Object lgstring, Lisp_Object direction);
/* Optional.
-
If FONT is usable on frame F, return 0. Otherwise return -1.
This method is used only for debugging. If this method is NULL,
Emacs assumes that the font is usable on any frame. */
metrics->width = width;
}
-ftcrfont_shape (Lisp_Object lgstring)
+ static int
+ ftcrfont_get_bitmap (struct font *font, unsigned int code,
+ struct font_bitmap *bitmap, int bits_per_pixel)
+ {
+ struct font_info *ftcrfont_info = (struct font_info *) font;
+
+ if (ftcrfont_info->bitmap_strike_index < 0)
+ return ftfont_get_bitmap (font, code, bitmap, bits_per_pixel);
+
+ return -1;
+ }
+
+ static int
+ ftcrfont_anchor_point (struct font *font, unsigned int code, int idx,
+ int *x, int *y)
+ {
+ struct font_info *ftcrfont_info = (struct font_info *) font;
+
+ if (ftcrfont_info->bitmap_strike_index < 0)
+ return ftfont_anchor_point (font, code, idx, x, y);
+
+ return -1;
+ }
+
+ static Lisp_Object
-#if defined HAVE_M17N_FLT && defined HAVE_LIBOTF
++ftcrfont_shape (Lisp_Object lgstring, Lisp_Object direction)
+ {
- return ftfont_shape (lgstring);
++#if (defined HAVE_M17N_FLT && defined HAVE_LIBOTF) || defined HAVE_HARFBUZZ
+ struct font *font = CHECK_FONT_GET_OBJECT (LGSTRING_FONT (lgstring));
+ struct font_info *ftcrfont_info = (struct font_info *) font;
+
+ if (ftcrfont_info->bitmap_strike_index < 0)
++ return ftfont_shape (lgstring, direction);
+ #endif
+
+ return make_fixnum (0);
+ }
+
static int
ftcrfont_draw (struct glyph_string *s,
int from, int to, int x, int y, bool with_background)
ftfont_info->maybe_otf = (ft_face->face_flags & FT_FACE_FLAG_SFNT) != 0;
ftfont_info->otf = NULL;
#endif /* HAVE_LIBOTF */
+#ifdef HAVE_HARFBUZZ
+ ftfont_info->hb_font = NULL;
+#endif /* HAVE_HARFBUZZ */
+ ftfont_info->bitmap_strike_index = strike_index;
/* This means that there's no need of transformation. */
ftfont_info->matrix.xx = 0;
font->pixel_size = size;
#endif /* HAVE_LIBOTF */
FT_Size ft_size;
int index;
+ /* Index of the bitmap strike used as a fallback for
+ FT_Set_Pixel_Sizes failure. If the value is non-negative, then
+ ft_size is not of the requested size. Otherwise it is -1. */
+ FT_Int bitmap_strike_index;
FT_Matrix matrix;
+#ifdef HAVE_HARFBUZZ
+ hb_font_t *hb_font;
+#endif /* HAVE_HARFBUZZ */
#ifdef USE_CAIRO
- cairo_font_face_t *cr_font_face;
+ cairo_scaled_font_t *cr_scaled_font;
/* To prevent cairo from cluttering the activated FT_Size maintained
in ftfont.c, we activate this special FT_Size before drawing. */
FT_Size ft_size_draw;