* configure.ac: Add support for HarfBuzz on Android. * java/INSTALL: Document where to get Emacs with HarfBuzz. * lisp/subr.el (overriding-text-conversion-style, y-or-n-p): Correctly set text conversion style if y-or-n-p is called inside the minibuffer. * src/sfnt.c (sfnt_read_cmap_format_8) (sfnt_read_cmap_format_12): Fix typos. (sfnt_read_24, sfnt_read_cmap_format_14): New function. (sfnt_read_cmap_table_1, sfnt_read_cmap_table): Handle format 14 cmap tables. (sfnt_read_default_uvs_table, sfnt_read_nondefault_uvs_table) (sfnt_compare_table_offsets, sfnt_create_uvs_context) (sfnt_free_uvs_context, sfnt_compare_uvs_mapping) (sfnt_variation_glyph_for_char, sfnt_map_table, sfnt_unmap_table) (sfnt_read_table, sfnt_test_uvs): New functions. (main): Add UVS tests. * src/sfnt.h (struct sfnt_cmap_format_14) (struct sfnt_variation_selector_record) (struct sfnt_default_uvs_table, struct sfnt_unicode_value_range) (struct sfnt_nondefault_uvs_table, struct sfnt_uvs_mapping) (struct sfnt_mapped_variation_selector_record) (struct sfnt_table_offset_rec, struct sfnt_uvs_context) (struct sfnt_mapped_table): New structures. Update prototypes. * src/sfntfont-android.c (android_sfntfont_driver): Register HarfBuzz callbacks where required. * src/sfntfont.c (sfntfont_select_cmap): Look for a format 14 table. Save it in new arg FORMAT14. (sfntfont_read_cmap): Adjust accordingly. (struct sfnt_font_info): New field `uvs'. New fields `hb_font', `fd' and `directory'. (sfntfont_open): Open uvs context. Under HarfBuzz, don't close the fd or subtable, but save them in the font info instead. (sfntfont_close): Free UVS context. Close font fd and table directory and HarfBuzz font. (sfntfont_draw): Handle case where s->padding_p. (sfntfont_get_variation_glyphs): New function. (sfntfont_unmap_blob, sfntfont_get_font_table) (sfntfont_begin_hb_font): New functions. * src/sfntfont.h: Update prototypes. * src/textconv.c (Fset_text_conversion_style): Fix doc string.
80 lines
2.3 KiB
C
80 lines
2.3 KiB
C
/* sfnt format font driver for GNU Emacs.
|
||
|
||
Copyright (C) 2023 Free Software Foundation, Inc.
|
||
|
||
This file is part of GNU Emacs.
|
||
|
||
GNU Emacs is free software: you can redistribute it and/or modify
|
||
it under the terms of the GNU General Public License as published by
|
||
the Free Software Foundation, either version 3 of the License, or (at
|
||
your option) any later version.
|
||
|
||
GNU Emacs is distributed in the hope that it will be useful,
|
||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||
GNU General Public License for more details.
|
||
|
||
You should have received a copy of the GNU General Public License
|
||
along with GNU Emacs. If not, write to the Free Software Foundation,
|
||
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||
|
||
#ifndef _SFNTFONT_H_
|
||
#define _SFNTFONT_H_
|
||
|
||
#include "lisp.h"
|
||
#include "frame.h"
|
||
#include "font.h"
|
||
#include "sfnt.h"
|
||
|
||
extern int sfnt_enum_font (const char *);
|
||
|
||
|
||
/* Font driver callbacks. */
|
||
|
||
extern Lisp_Object sfntfont_list (struct frame *, Lisp_Object);
|
||
extern Lisp_Object sfntfont_match (struct frame *, Lisp_Object);
|
||
extern Lisp_Object sfntfont_open (struct frame *, Lisp_Object, int);
|
||
|
||
extern unsigned int sfntfont_encode_char (struct font *, int);
|
||
extern void sfntfont_text_extents (struct font *, const unsigned int *,
|
||
int, struct font_metrics *);
|
||
extern void sfntfont_close (struct font *);
|
||
extern int sfntfont_draw (struct glyph_string *, int, int,
|
||
int, int, bool);
|
||
extern Lisp_Object sfntfont_list_family (struct frame *);
|
||
extern int sfntfont_get_variation_glyphs (struct font *, int, unsigned[256]);
|
||
|
||
|
||
/* Initialization functions. */
|
||
|
||
typedef void (*sfntfont_put_glyph_proc) (struct glyph_string *, int, int,
|
||
int, int, bool, struct sfnt_raster **,
|
||
int *);
|
||
|
||
extern void syms_of_sfntfont (void);
|
||
extern void init_sfntfont (void);
|
||
extern void mark_sfntfont (void);
|
||
extern void init_sfntfont_vendor (Lisp_Object, const struct font_driver *,
|
||
sfntfont_put_glyph_proc);
|
||
|
||
|
||
/* mmap specific functions. */
|
||
|
||
#ifdef HAVE_MMAP
|
||
|
||
extern bool sfntfont_detect_sigbus (void *);
|
||
|
||
#endif /* HAVE_MMAP */
|
||
|
||
|
||
|
||
/* HarfBuzz specific functions. */
|
||
|
||
#ifdef HAVE_HARFBUZZ
|
||
|
||
extern hb_font_t *sfntfont_begin_hb_font (struct font *, double *);
|
||
|
||
#endif /* HAVE_HARFBUZZ */
|
||
|
||
#endif /* _SFNTFONT_H_ */
|