From f208d5ae77cf381c6f1db9b1aef76d5e9805a106 Mon Sep 17 00:00:00 2001 From: YAMAMOTO Mitsuharu Date: Sun, 5 May 2019 08:21:49 +0900 Subject: Add new font backend drivers for text shaping by HarfBuzz * etc/NEWS: Mention new font backend drivers xfthb and ftcrhb. * src/font.h [HAVE_HARFBUZZ]: Include hb.h. (struct font_driver) [HAVE_HARFBUZZ]: New members begin_hb_font and end_hb_font. (ftfont_match, ftfont_list): Remove externs. (ftfont_match2, ftfont_list2): (fthbfont_combining_capability, fthbfont_begin_hb_font) (fthbfont_shape) [HAVE_HARFBUZZ]: (xfthbfont_driver) [HAVE_XFT && HAVE_HARFBUZZ]: (ftcrhbfont_driver) [USE_CAIRO && HAVE_HARFBUZZ]: Add externs. * src/ftcrfont.c (ftcrfont_list): Use ftfont_list2. (ftcrfont_match): Use ftfont_match2. (ftcrfont_open): Get font type from entity. (ftcrfont_open) [HAVE_HARFBUZZ]: Use HarfBuzz version of driver if specified. (ftcrfont_shape) [HAVE_HARFBUZZ]: Make shaping fail. (ftcrhbfont_list, ftcrhbfont_match) (ftcrhbfont_begin_hb_font) [HAVE_HARFBUZZ]: New functions. (ftcrhbfont_driver) [HAVE_HARFBUZZ]: New variable. (syms_of_ftcrfont_for_pdumper) [HAVE_HARFBUZZ]: Initialize and register it. (syms_of_ftcrfont) [HAVE_HARFBUZZ]: New symbol Qftcrhb. * src/ftfont.c: Include math.h for lround. (fthbfont_driver) [HAVE_HARFBUZZ]: New variable. (ftfont_get_hb_font) [HAVE_HARFBUZZ]: Remove function. (ftfont_list, ftfont_match): Make static. (ftfont_list2, ftfont_match2): New functions. (ftfont_open2) [HAVE_HARFBUZZ]: Use HarfBuzz version of driver if specified. (ftfont_open): Get font type from entity. (ftfont_shape, ftfont_combining_capability, ftfont_driver) [HAVE_HARFBUZZ]: Move HarfBuzz specific part from here ... (fthbfont_shape, fthbfont_combining_capability) (fthbfont_driver) [HAVE_HARFBUZZ]: ... to here. New functions and variable. (fthbfont_begin_hb_font) [HAVE_HARFBUZZ]: New function. (fthbfont_shape_by_hb) [HAVE_HARFBUZZ]: Rename from ftfont_shape_by_hb. Don't take FreeType specific arguments ft_face and matrix. Use begin_hb_font and end_hb_font font driver functions. Use text_extents font driver functions instead of ftfont_glyph_metrics. (syms_of_ftfont) [HAVE_HARFBUZZ]: New symbol Qfreetypehb. (syms_of_ftfont_for_pdumper) [HAVE_HARFBUZZ]: Initialize and register fthbfont_drivert. * src/ftxfont.c (ftxfont_list): Use ftfont_list2. (ftxfont_match): Use ftfont_match2. (ftxfont_driver) [HAVE_HARFBUZZ]: Don't initialize shape member explicitly. * src/xfns.c (Fx_create_frame) [USE_CAIRO && HAVE_HARFBUZZ]: (Fx_create_frame) [HAVE_XFT && HAVE_HARFBUZZ]: Register HarfBuzz versions of font drivers. * src/xftfont.c (xftfont_list): Use ftfont_list2. (xftfont_match): Use ftfont_match2. (xftfont_open): Get font type from entity. (xftfont_open) [HAVE_HARFBUZZ]: Use HarfBuzz version of driver if specified. (xftfont_shape) [HAVE_HARFBUZZ]: Make shaping fail. (xfthbfont_list, xfthbfont_match, xfthbfont_begin_hb_font) (xfthbfont_end_hb_font) [HAVE_HARFBUZZ]: New functions. (xftfont_driver) [HAVE_HARFBUZZ]: Don't initialize shape member explicitly. (xfthbfont_driver) [HAVE_HARFBUZZ]: New variable. (syms_of_xftfont_for_pdumper) [HAVE_HARFBUZZ]: Initialize and register it. (syms_of_xftfont) [HAVE_HARFBUZZ]: New symbol Qxfthb. --- src/xfns.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/xfns.c') diff --git a/src/xfns.c b/src/xfns.c index 2ceb55a30ad..50a430aa78c 100644 --- a/src/xfns.c +++ b/src/xfns.c @@ -3774,10 +3774,16 @@ This function is an internal primitive--use `make-frame' instead. */) #ifdef USE_CAIRO register_font_driver (&ftcrfont_driver, f); +#ifdef HAVE_HARFBUZZ + register_font_driver (&ftcrhbfont_driver, f); +#endif /* HAVE_HARFBUZZ */ #else #ifdef HAVE_FREETYPE #ifdef HAVE_XFT register_font_driver (&xftfont_driver, f); +#ifdef HAVE_HARFBUZZ + register_font_driver (&xfthbfont_driver, f); +#endif #else /* not HAVE_XFT */ register_font_driver (&ftxfont_driver, f); #endif /* not HAVE_XFT */ -- cgit v1.2.3