• YAMAMOTO Mitsuharu's avatar
    Add new font backend drivers for text shaping by HarfBuzz · f208d5ae
    YAMAMOTO Mitsuharu authored
    * 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.
    f208d5ae
xftfont.c 25.3 KB