X-Git-Url: https://code.delx.au/gnu-emacs/blobdiff_plain/7e09ef09a479731d01b1ca46e94ddadd73ac98e3..fb6d826c69939c2d016c1b824d4e9bcb53d9e643:/src/font.h diff --git a/src/font.h b/src/font.h index 617860c85f..3f4ccb106c 100644 --- a/src/font.h +++ b/src/font.h @@ -22,8 +22,9 @@ along with GNU Emacs. If not, see . */ #ifndef EMACS_FONT_H #define EMACS_FONT_H -#include "ccl.h" -#include "frame.h" +struct composition_it; +struct face; +struct glyph_string; INLINE_HEADER_BEGIN @@ -56,7 +57,6 @@ INLINE_HEADER_BEGIN Note: Only the method `open' of a font-driver can create this object, and it should never be modified by Lisp. */ -extern Lisp_Object Qfont_spec, Qfont_entity, Qfont_object; /* An enumerator for each font property. This is used as an index to the vector of FONT-SPEC and FONT-ENTITY. @@ -239,17 +239,6 @@ enum font_property_index #define FONT_BASE(f) ((f)->ascent) #define FONT_DESCENT(f) ((f)->descent) -extern Lisp_Object QCspacing, QCdpi, QCscalable, QCotf, QClang, QCscript; -extern Lisp_Object QCavgwidth, QCantialias, QCfont_entity; -extern Lisp_Object Qp; - - -/* Important character set symbols. */ -extern Lisp_Object Qascii_0; -extern Lisp_Object Qiso8859_1, Qiso10646_1, Qunicode_bmp, Qunicode_sip; - -/* Special ADSTYLE properties to avoid fonts used for Latin characters. */ -extern Lisp_Object Qja, Qko; /* Structure for a font-spec. */ @@ -425,46 +414,133 @@ struct font_bitmap /* Predicates to check various font-related objects. */ /* True iff X is one of font-spec, font-entity, and font-object. */ -#define FONTP(x) PSEUDOVECTORP (x, PVEC_FONT) +INLINE bool +FONTP (Lisp_Object x) +{ + return PSEUDOVECTORP (x, PVEC_FONT); +} + /* True iff X is font-spec. */ -#define FONT_SPEC_P(x) \ - (FONTP (x) && (ASIZE (x) & PSEUDOVECTOR_SIZE_MASK) == FONT_SPEC_MAX) +INLINE bool +FONT_SPEC_P (Lisp_Object x) +{ + return FONTP (x) && (ASIZE (x) & PSEUDOVECTOR_SIZE_MASK) == FONT_SPEC_MAX; +} + +/* Like FONT_SPEC_P, but can be used in the garbage collector. */ +INLINE bool +GC_FONT_SPEC_P (Lisp_Object x) +{ + return FONTP (x) && (gc_asize (x) & PSEUDOVECTOR_SIZE_MASK) == FONT_SPEC_MAX; +} + /* True iff X is font-entity. */ -#define FONT_ENTITY_P(x) \ - (FONTP (x) && (ASIZE (x) & PSEUDOVECTOR_SIZE_MASK) == FONT_ENTITY_MAX) +INLINE bool +FONT_ENTITY_P (Lisp_Object x) +{ + return FONTP (x) && (ASIZE (x) & PSEUDOVECTOR_SIZE_MASK) == FONT_ENTITY_MAX; +} + +/* Like FONT_ENTITY_P, but can be used in the garbage collector. */ +INLINE bool +GC_FONT_ENTITY_P (Lisp_Object x) +{ + return FONTP (x) && (gc_asize (x) & PSEUDOVECTOR_SIZE_MASK) == FONT_ENTITY_MAX; +} + /* True iff X is font-object. */ -#define FONT_OBJECT_P(x) \ - (FONTP (x) && (ASIZE (x) & PSEUDOVECTOR_SIZE_MASK) == FONT_OBJECT_MAX) - -/* Check macros for various font-related objects. */ - -#define CHECK_FONT(x) \ - do { if (! FONTP (x)) wrong_type_argument (Qfont, x); } while (false) -#define CHECK_FONT_SPEC(x) \ - do { if (! FONT_SPEC_P (x)) wrong_type_argument (Qfont_spec, x); } \ - while (false) -#define CHECK_FONT_ENTITY(x) \ - do { if (! FONT_ENTITY_P (x)) wrong_type_argument (Qfont_entity, x); } \ - while (false) -#define CHECK_FONT_OBJECT(x) \ - do { if (! FONT_OBJECT_P (x)) wrong_type_argument (Qfont_object, x); } \ - while (false) - -#define CHECK_FONT_GET_OBJECT(x, font) \ - do { \ - CHECK_FONT_OBJECT (x); \ - font = XFONT_OBJECT (x); \ - } while (false) +INLINE bool +FONT_OBJECT_P (Lisp_Object x) +{ + return FONTP (x) && (ASIZE (x) & PSEUDOVECTOR_SIZE_MASK) == FONT_OBJECT_MAX; +} + +/* Like FONT_OBJECT_P, but can be used in the garbage collector. */ +INLINE bool +GC_FONT_OBJECT_P (Lisp_Object x) +{ + return FONTP (x) && (gc_asize (x) & PSEUDOVECTOR_SIZE_MASK) == FONT_OBJECT_MAX; +} + +/* Type checking functions for various font-related objects. */ + +INLINE void +CHECK_FONT (Lisp_Object x) +{ + CHECK_TYPE (FONTP (x), Qfont, x); +} + +INLINE void +CHECK_FONT_SPEC (Lisp_Object x) +{ + CHECK_TYPE (FONT_SPEC_P (x), Qfont_spec, x); +} + +INLINE void +CHECK_FONT_ENTITY (Lisp_Object x) +{ + CHECK_TYPE (FONT_ENTITY_P (x), Qfont_entity, x); +} + +INLINE void +CHECK_FONT_OBJECT (Lisp_Object x) +{ + CHECK_TYPE (FONT_OBJECT_P (x), Qfont_object, x); +} + +/* C pointer extraction functions for various font-related objects. */ + +INLINE struct font_spec * +XFONT_SPEC (Lisp_Object p) +{ + eassert (FONT_SPEC_P (p)); + return XUNTAG (p, Lisp_Vectorlike); +} + +INLINE struct font_spec * +GC_XFONT_SPEC (Lisp_Object p) +{ + eassert (GC_FONT_SPEC_P (p)); + return XUNTAG (p, Lisp_Vectorlike); +} + +INLINE struct font_entity * +XFONT_ENTITY (Lisp_Object p) +{ + eassert (FONT_ENTITY_P (p)); + return XUNTAG (p, Lisp_Vectorlike); +} + +INLINE struct font_entity * +GC_XFONT_ENTITY (Lisp_Object p) +{ + eassert (GC_FONT_ENTITY_P (p)); + return XUNTAG (p, Lisp_Vectorlike); +} + +INLINE struct font * +XFONT_OBJECT (Lisp_Object p) +{ + eassert (FONT_OBJECT_P (p)); + return XUNTAG (p, Lisp_Vectorlike); +} + +INLINE struct font * +GC_XFONT_OBJECT (Lisp_Object p) +{ + eassert (GC_FONT_OBJECT_P (p)); + return XUNTAG (p, Lisp_Vectorlike); +} -#define XFONT_SPEC(p) \ - (eassert (FONT_SPEC_P (p)), (struct font_spec *) XUNTAG (p, Lisp_Vectorlike)) -#define XFONT_ENTITY(p) \ - (eassert (FONT_ENTITY_P (p)), \ - (struct font_entity *) XUNTAG (p, Lisp_Vectorlike)) -#define XFONT_OBJECT(p) \ - (eassert (FONT_OBJECT_P (p)), (struct font *) XUNTAG (p, Lisp_Vectorlike)) #define XSETFONT(a, b) (XSETPSEUDOVECTOR (a, b, PVEC_FONT)) +INLINE struct font * +CHECK_FONT_GET_OBJECT (Lisp_Object x) +{ + CHECK_FONT_OBJECT (x); + return XFONT_OBJECT (x); +} + /* Number of pt per inch (from the TeXbook). */ #define PT_PER_INCH 72.27 @@ -681,6 +757,12 @@ struct font_driver bool (*cached_font_ok) (struct frame *f, Lisp_Object font_object, Lisp_Object entity); + + /* Optional + + Return non-nil if the driver support rendering of combining + characters for FONT according to Unicode combining class. */ + Lisp_Object (*combining_capability) (struct font *font); }; @@ -791,12 +873,11 @@ extern struct font_driver xfont_driver; extern void syms_of_xfont (void); extern void syms_of_ftxfont (void); #ifdef HAVE_XFT -extern Lisp_Object Qxft; extern struct font_driver xftfont_driver; -extern void syms_of_xftfont (void); #endif #if defined HAVE_FREETYPE || defined HAVE_XFT extern struct font_driver ftxfont_driver; +extern void syms_of_xftfont (void); #endif #ifdef HAVE_BDFFONT extern void syms_of_bdffont (void); @@ -808,18 +889,19 @@ extern struct font_driver uniscribe_font_driver; extern void syms_of_w32font (void); #endif /* HAVE_NTGUI */ #ifdef HAVE_NS -extern Lisp_Object Qfontsize; extern struct font_driver nsfont_driver; extern void syms_of_nsfont (void); extern void syms_of_macfont (void); #endif /* HAVE_NS */ +#ifdef USE_CAIRO +extern struct font_driver ftcrfont_driver; +extern void syms_of_ftcrfont (void); +#endif #ifndef FONT_DEBUG #define FONT_DEBUG #endif -extern Lisp_Object QCfoundry; - extern void font_add_log (const char *, Lisp_Object, Lisp_Object); extern void font_deferred_log (const char *, Lisp_Object, Lisp_Object);