From: YAMAMOTO Mitsuharu Date: Sat, 27 Apr 2019 09:33:39 +0000 (+0900) Subject: Merge branch 'master' into harfbuzz X-Git-Tag: emacs-27.0.90~2671^2~26 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=886bedb36c7b959b7e6fc8ce8e0c04e144b0ae28;p=emacs.git Merge branch 'master' into harfbuzz --- 886bedb36c7b959b7e6fc8ce8e0c04e144b0ae28 diff --cc configure.ac index 991ab55c685,810c3219e4f..26ffc3e3fdf --- a/configure.ac +++ b/configure.ac @@@ -3307,8 -3406,8 +3407,9 @@@ if test "${HAVE_X11}" = "yes"; the 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, @@@ -5472,12 -5585,13 +5596,13 @@@ Configured for '${canonical}' 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} ;; diff --cc src/font.c index fc8efa7f235,5ca89c97dcf..f1cb7561070 --- a/src/font.c +++ b/src/font.c @@@ -5354,17 -5351,13 +5355,17 @@@ syms_of_font (void DEFSYM (QCuser_spec, ":user-spec"); + /* For shapers that need to know text directionality. */ + DEFSYM (QL2R, "L2R"); + DEFSYM (QR2L, "R2L"); + - staticpro (&scratch_font_spec); 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 diff --cc src/font.h index 52bdaa38899,3720650a2e1..3540a8dba22 --- a/src/font.h +++ b/src/font.h @@@ -735,12 -730,11 +737,11 @@@ struct font_drive 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. */ diff --cc src/ftcrfont.c index 45e526d24a4,8a1c9a48e1f..c0f62e0418e --- a/src/ftcrfont.c +++ b/src/ftcrfont.c @@@ -190,6 -264,44 +264,44 @@@ ftcrfont_text_extents (struct font *fon metrics->width = width; } + 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 -ftcrfont_shape (Lisp_Object lgstring) ++ftcrfont_shape (Lisp_Object lgstring, Lisp_Object direction) + { -#if defined HAVE_M17N_FLT && defined HAVE_LIBOTF ++#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); ++ 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) diff --cc src/ftfont.c index 63df123001f,d0078a37701..58c462a90fe --- a/src/ftfont.c +++ b/src/ftfont.c @@@ -1158,9 -1165,7 +1178,10 @@@ ftfont_open2 (struct frame *f 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; diff --cc src/ftfont.h index 3bbcbfb5d70,adbda49ff1c..f877860895e --- a/src/ftfont.h +++ b/src/ftfont.h @@@ -59,13 -54,14 +59,17 @@@ struct font_inf #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;