&& ((vector->header.size & PSEUDOVECTOR_SIZE_MASK)
== FONT_OBJECT_MAX))
{
- struct font_driver *drv = ((struct font *) vector)->driver;
+ struct font_driver const *drv = ((struct font *) vector)->driver;
/* The font driver might sometimes be NULL, e.g. if Emacs was
interrupted before it had time to set it up. */
/* Used to catch bogus pointers in font objects. */
bool
-valid_font_driver (struct font_driver *drv)
+valid_font_driver (struct font_driver const *drv)
{
Lisp_Object tail, frame;
struct font_driver_list *fdl;
is a number frames sharing this cache, and FONT-CACHE-DATA is a
cons (FONT-SPEC . [FONT-ENTITY ...]). */
-static void font_prepare_cache (struct frame *, struct font_driver *);
-static void font_finish_cache (struct frame *, struct font_driver *);
-static Lisp_Object font_get_cache (struct frame *, struct font_driver *);
static void font_clear_cache (struct frame *, Lisp_Object,
- struct font_driver *);
+ struct font_driver const *);
static void
-font_prepare_cache (struct frame *f, struct font_driver *driver)
+font_prepare_cache (struct frame *f, struct font_driver const *driver)
{
Lisp_Object cache, val;
static void
-font_finish_cache (struct frame *f, struct font_driver *driver)
+font_finish_cache (struct frame *f, struct font_driver const *driver)
{
Lisp_Object cache, val, tmp;
static Lisp_Object
-font_get_cache (struct frame *f, struct font_driver *driver)
+font_get_cache (struct frame *f, struct font_driver const *driver)
{
Lisp_Object val = driver->get_cache (f);
Lisp_Object type = driver->type;
static void
-font_clear_cache (struct frame *f, Lisp_Object cache, struct font_driver *driver)
+font_clear_cache (struct frame *f, Lisp_Object cache,
+ struct font_driver const *driver)
{
Lisp_Object tail, elt;
Lisp_Object entity;
(e.g. syms_of_xfont). */
void
-register_font_driver (struct font_driver *driver, struct frame *f)
+register_font_driver (struct font_driver const *driver, struct frame *f)
{
struct font_driver_list *root = f ? f->font_driver_list : font_driver_list;
struct font_driver_list *prev, *list;
drivers. */
for (list = f->font_driver_list; list; list = list->next)
{
- struct font_driver *driver = list->driver;
+ struct font_driver const *driver = list->driver;
if ((EQ (new_drivers, Qt) || ! NILP (Fmemq (driver->type, new_drivers)))
!= list->on)
{
and then use it under w32 or ns. */
for (list = f->font_driver_list; list; list = list->next)
{
- struct font_driver *driver = list->driver;
+ struct font_driver const *driver = list->driver;
eassert (! list->on);
if (! driver->start_for_frame
|| driver->start_for_frame (f) == 0)
#endif /* HAVE_WINDOW_SYSTEM */
/* Font-driver for the font. */
- struct font_driver *driver;
+ struct font_driver const *driver;
/* There are more members in this structure, but they are private
to the font-driver. */
font driver list.*/
bool on;
/* Pointer to the font driver. */
- struct font_driver *driver;
+ struct font_driver const *driver;
/* Pointer to the next element of the chain. */
struct font_driver_list *next;
};
extern int font_parse_xlfd (char *name, ptrdiff_t len, Lisp_Object font);
extern ptrdiff_t font_unparse_xlfd (Lisp_Object font, int pixel_size,
char *name, int bytes);
-extern void register_font_driver (struct font_driver *driver, struct frame *f);
+extern void register_font_driver (struct font_driver const *, struct frame *);
extern void free_font_driver_list (struct frame *f);
#ifdef ENABLE_CHECKING
-extern bool valid_font_driver (struct font_driver *);
+extern bool valid_font_driver (struct font_driver const *);
#else
INLINE bool
-valid_font_driver (struct font_driver *d)
+valid_font_driver (struct font_driver const *d)
{
return true;
}
extern void font_drop_xrender_surfaces (struct frame *f);
#ifdef HAVE_FREETYPE
-extern struct font_driver ftfont_driver;
+extern int ftfont_anchor_point (struct font *, unsigned int, int,
+ int *, int *);
+extern int ftfont_get_bitmap (struct font *, unsigned int,
+ struct font_bitmap *, int);
+extern int ftfont_has_char (Lisp_Object, int);
+extern int ftfont_variation_glyphs (struct font *, int, unsigned[256]);
+extern Lisp_Object ftfont_combining_capability (struct font *);
+extern Lisp_Object ftfont_get_cache (struct frame *);
+extern Lisp_Object ftfont_list (struct frame *, Lisp_Object);
+extern Lisp_Object ftfont_list_family (struct frame *);
+extern Lisp_Object ftfont_match (struct frame *, Lisp_Object);
+extern Lisp_Object ftfont_open (struct frame *, Lisp_Object, int);
+extern Lisp_Object ftfont_otf_capability (struct font *);
+extern Lisp_Object ftfont_shape (Lisp_Object);
+extern unsigned ftfont_encode_char (struct font *, int);
+extern void ftfont_close (struct font *);
+extern void ftfont_filter_properties (Lisp_Object, Lisp_Object);
+extern void ftfont_text_extents (struct font *, unsigned *, int,
+ struct font_metrics *);
extern void syms_of_ftfont (void);
#endif /* HAVE_FREETYPE */
#ifdef HAVE_X_WINDOWS
-extern struct font_driver xfont_driver;
+extern struct font_driver const xfont_driver;
+extern Lisp_Object xfont_get_cache (struct frame *);
extern void syms_of_xfont (void);
extern void syms_of_ftxfont (void);
#ifdef HAVE_XFT
-extern struct font_driver xftfont_driver;
+extern struct font_driver const xftfont_driver;
#endif
#if defined HAVE_FREETYPE || defined HAVE_XFT
-extern struct font_driver ftxfont_driver;
+extern struct font_driver const ftxfont_driver;
extern void syms_of_xftfont (void);
#endif
#ifdef HAVE_BDFFONT
extern void syms_of_w32font (void);
#endif /* HAVE_NTGUI */
#ifdef HAVE_NS
-extern struct font_driver nsfont_driver;
+extern struct font_driver const 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 struct font_driver const ftcrfont_driver;
extern void syms_of_ftcrfont (void);
#endif
#define METRICS_SET_STATUS(metrics, status) \
((metrics)->ascent = 0, (metrics)->descent = (status))
-struct font_driver ftcrfont_driver;
-
static int
ftcrfont_glyph_extents (struct font *font,
unsigned glyph,
cache = ftcrfont_info->metrics[row] + col;
if (METRICS_STATUS (cache) == METRICS_INVALID)
- ftfont_driver.text_extents (font, &glyph, 1, cache);
+ ftfont_text_extents (font, &glyph, 1, cache);
if (metrics)
*metrics = *cache;
static Lisp_Object
ftcrfont_list (struct frame *f, Lisp_Object spec)
{
- Lisp_Object list = ftfont_driver.list (f, spec), tail;
+ Lisp_Object list = ftfont_list (f, spec), tail;
for (tail = list; CONSP (tail); tail = XCDR (tail))
ASET (XCAR (tail), FONT_TYPE_INDEX, Qftcr);
static Lisp_Object
ftcrfont_match (struct frame *f, Lisp_Object spec)
{
- Lisp_Object entity = ftfont_driver.match (f, spec);
+ Lisp_Object entity = ftfont_match (f, spec);
if (VECTORP (entity))
ASET (entity, FONT_TYPE_INDEX, Qftcr);
return entity;
}
-extern FT_Face ftfont_get_ft_face (Lisp_Object);
-
static Lisp_Object
ftcrfont_open (struct frame *f, Lisp_Object entity, int pixel_size)
{
cairo_font_face_destroy (ftcrfont_info->cr_font_face);
unblock_input ();
- ftfont_driver.close (font);
+ ftfont_close (font);
}
static void
\f
+struct font_driver const ftcrfont_driver =
+ {
+ type: LISPSYM_INITIALLY (Qftcr),
+ get_cache: ftfont_get_cache,
+ list: ftcrfont_list,
+ match: ftcrfont_match,
+ list_family: ftfont_list_family,
+ open: ftcrfont_open,
+ close: ftcrfont_close,
+ has_char: ftfont_has_char,
+ encode_char: ftfont_encode_char,
+ text_extents: ftcrfont_text_extents,
+ draw: ftcrfont_draw,
+ get_bitmap: ftfont_get_bitmap,
+ anchor_point: ftfont_anchor_point,
+#ifdef HAVE_LIBOTF
+ otf_capability: ftfont_otf_capability,
+#endif
+#if defined HAVE_M17N_FLT && defined HAVE_LIBOTF
+ shape: ftfont_shape,
+#endif
+#ifdef HAVE_OTF_GET_VARIATION_GLYPHS
+ get_variation_glyphs: ftfont_variation_glyphs,
+#endif
+ filter_properties: ftfont_filter_properties,
+ combining_capability: ftfont_combining_capability,
+ };
+
void
syms_of_ftcrfont (void)
{
abort ();
DEFSYM (Qftcr, "ftcr");
-
- ftcrfont_driver = ftfont_driver;
- ftcrfont_driver.type = Qftcr;
- ftcrfont_driver.list = ftcrfont_list;
- ftcrfont_driver.match = ftcrfont_match;
- ftcrfont_driver.open = ftcrfont_open;
- ftcrfont_driver.close = ftcrfont_close;
- ftcrfont_driver.text_extents = ftcrfont_text_extents;
- ftcrfont_driver.draw = ftcrfont_draw;
register_font_driver (&ftcrfont_driver, NULL);
}
#include "font.h"
#include "ftfont.h"
+static struct font_driver const ftfont_driver;
+
/* Flag to tell if FcInit is already called or not. */
static bool fc_initialized;
FTFONT_CACHE_FOR_ENTITY
};
-static Lisp_Object ftfont_pattern_entity (FcPattern *, Lisp_Object);
-
-static Lisp_Object ftfont_resolve_generic_family (Lisp_Object,
- FcPattern *);
static Lisp_Object ftfont_lookup_cache (Lisp_Object,
enum ftfont_cache_for);
-static void ftfont_filter_properties (Lisp_Object font, Lisp_Object alist);
-
-static Lisp_Object ftfont_combining_capability (struct font *);
-
#define SYMBOL_FcChar8(SYM) (FcChar8 *) SDATA (SYMBOL_NAME (SYM))
static struct
}
#endif /* HAVE_LIBOTF */
-static Lisp_Object ftfont_get_cache (struct frame *);
-static Lisp_Object ftfont_list (struct frame *, Lisp_Object);
-static Lisp_Object ftfont_match (struct frame *, Lisp_Object);
-static Lisp_Object ftfont_list_family (struct frame *);
-static Lisp_Object ftfont_open (struct frame *, Lisp_Object, int);
-static void ftfont_close (struct font *);
-static int ftfont_has_char (Lisp_Object, int);
-static unsigned ftfont_encode_char (struct font *, int);
-static void ftfont_text_extents (struct font *, unsigned *, int,
- struct font_metrics *);
-static int ftfont_get_bitmap (struct font *, unsigned,
- struct font_bitmap *, int);
-static int ftfont_anchor_point (struct font *, unsigned, int,
- int *, int *);
-#ifdef HAVE_LIBOTF
-static Lisp_Object ftfont_otf_capability (struct font *);
-# ifdef HAVE_M17N_FLT
-static Lisp_Object ftfont_shape (Lisp_Object);
-# endif
-#endif
-
-#ifdef HAVE_OTF_GET_VARIATION_GLYPHS
-static int ftfont_variation_glyphs (struct font *, int c,
- unsigned variations[256]);
-#endif /* HAVE_OTF_GET_VARIATION_GLYPHS */
-
-struct font_driver ftfont_driver =
- {
- LISPSYM_INITIALLY (Qfreetype),
- 0, /* case insensitive */
- ftfont_get_cache,
- ftfont_list,
- ftfont_match,
- ftfont_list_family,
- NULL, /* free_entity */
- ftfont_open,
- ftfont_close,
- /* We can't draw a text without device dependent functions. */
- NULL, /* prepare_face */
- NULL, /* done_face */
- ftfont_has_char,
- ftfont_encode_char,
- ftfont_text_extents,
- /* We can't draw a text without device dependent functions. */
- NULL, /* draw */
- ftfont_get_bitmap,
- NULL, /* free_bitmap */
- ftfont_anchor_point,
-#ifdef HAVE_LIBOTF
- ftfont_otf_capability,
-#else /* not HAVE_LIBOTF */
- NULL,
-#endif /* not HAVE_LIBOTF */
- NULL, /* otf_drive */
- NULL, /* start_for_frame */
- NULL, /* end_for_frame */
-#if defined (HAVE_M17N_FLT) && defined (HAVE_LIBOTF)
- ftfont_shape,
-#else /* not (HAVE_M17N_FLT && HAVE_LIBOTF) */
- NULL,
-#endif /* not (HAVE_M17N_FLT && HAVE_LIBOTF) */
- NULL, /* check */
-
-#ifdef HAVE_OTF_GET_VARIATION_GLYPHS
- ftfont_variation_glyphs,
-#else
- NULL,
-#endif
-
- ftfont_filter_properties, /* filter_properties */
-
- NULL, /* cached_font_ok */
-
- ftfont_combining_capability,
- };
-
-static Lisp_Object
+Lisp_Object
ftfont_get_cache (struct frame *f)
{
return freetype_font_cache;
return pattern;
}
-static Lisp_Object
+Lisp_Object
ftfont_list (struct frame *f, Lisp_Object spec)
{
Lisp_Object val = Qnil, family, adstyle;
return val;
}
-static Lisp_Object
+Lisp_Object
ftfont_match (struct frame *f, Lisp_Object spec)
{
Lisp_Object entity = Qnil;
return entity;
}
-static Lisp_Object
+Lisp_Object
ftfont_list_family (struct frame *f)
{
Lisp_Object list = Qnil;
return font_object;
}
-static Lisp_Object
+Lisp_Object
ftfont_open (struct frame *f, Lisp_Object entity, int pixel_size)
{
Lisp_Object font_object;
return ftfont_open2 (f, entity, pixel_size, font_object);
}
-static void
+void
ftfont_close (struct font *font)
{
/* FIXME: Although this function can be called while garbage-collecting,
FT_Done_Size (ftfont_info->ft_size);
}
-static int
+int
ftfont_has_char (Lisp_Object font, int c)
{
struct charset *cs = NULL;
}
}
-static unsigned
+unsigned
ftfont_encode_char (struct font *font, int c)
{
struct ftfont_info *ftfont_info = (struct ftfont_info *) font;
return (code > 0 ? code : FONT_INVALID_CODE);
}
-static void
+void
ftfont_text_extents (struct font *font, unsigned int *code,
int nglyphs, struct font_metrics *metrics)
{
metrics->width = width;
}
-static int
+int
ftfont_get_bitmap (struct font *font, unsigned int code, struct font_bitmap *bitmap, int bits_per_pixel)
{
struct ftfont_info *ftfont_info = (struct ftfont_info *) font;
return 0;
}
-static int
+int
ftfont_anchor_point (struct font *font, unsigned int code, int idx,
int *x, int *y)
{
}
-static Lisp_Object
+Lisp_Object
ftfont_otf_capability (struct font *font)
{
struct ftfont_info *ftfont_info = (struct ftfont_info *) font;
#ifdef HAVE_OTF_GET_VARIATION_GLYPHS
-static int
+int
ftfont_variation_glyphs (struct font *font, int c, unsigned variations[256])
{
struct ftfont_info *ftfont_info = (struct ftfont_info *) font;
NULL,
};
-static void
+void
ftfont_filter_properties (Lisp_Object font, Lisp_Object alist)
{
font_filter_properties (font, alist, ftfont_booleans, ftfont_non_booleans);
}
-static Lisp_Object
+Lisp_Object
ftfont_combining_capability (struct font *font)
{
#ifdef HAVE_M17N_FLT
#endif
}
+static struct font_driver const ftfont_driver =
+ {
+ /* We can't draw a text without device dependent functions. */
+ type: LISPSYM_INITIALLY (Qfreetype),
+ get_cache: ftfont_get_cache,
+ list: ftfont_list,
+ match: ftfont_match,
+ list_family: ftfont_list_family,
+ open: ftfont_open,
+ close: ftfont_close,
+ has_char: ftfont_has_char,
+ encode_char: ftfont_encode_char,
+ text_extents: ftfont_text_extents,
+ get_bitmap: ftfont_get_bitmap,
+ anchor_point: ftfont_anchor_point,
+#ifdef HAVE_LIBOTF
+ otf_capability: ftfont_otf_capability,
+#endif
+#if defined HAVE_M17N_FLT && defined HAVE_LIBOTF
+ shape: ftfont_shape,
+#endif
+#ifdef HAVE_OTF_GET_VARIATION_GLYPHS
+ get_variation_glyphs: ftfont_variation_glyphs,
+#endif
+ filter_properties: ftfont_filter_properties,
+ combining_capability: ftfont_combining_capability,
+ };
+
void
syms_of_ftfont (void)
{
/* FTX font driver. */
-struct font_driver ftxfont_driver;
-
struct ftxfont_frame_data
{
/* Background and foreground colors. */
unsigned char *b;
int i, j;
- if (ftfont_driver.get_bitmap (font, code, &bitmap, size > 0x100 ? 1 : 8) < 0)
+ if (ftfont_get_bitmap (font, code, &bitmap, size > 0x100 ? 1 : 8) < 0)
return 0;
if (size > 0x100)
{
}
}
- if (ftfont_driver.free_bitmap)
- ftfont_driver.free_bitmap (font, &bitmap);
+ /* There is no ftfont_free_bitmap, so do not try to free BITMAP. */
return bitmap.advance;
}
static Lisp_Object
ftxfont_list (struct frame *f, Lisp_Object spec)
{
- Lisp_Object list = ftfont_driver.list (f, spec), tail;
+ Lisp_Object list = ftfont_list (f, spec), tail;
for (tail = list; CONSP (tail); tail = XCDR (tail))
ASET (XCAR (tail), FONT_TYPE_INDEX, Qftx);
static Lisp_Object
ftxfont_match (struct frame *f, Lisp_Object spec)
{
- Lisp_Object entity = ftfont_driver.match (f, spec);
+ Lisp_Object entity = ftfont_match (f, spec);
if (VECTORP (entity))
ASET (entity, FONT_TYPE_INDEX, Qftx);
static Lisp_Object
ftxfont_open (struct frame *f, Lisp_Object entity, int pixel_size)
{
- Lisp_Object font_object;
- struct font *font;
-
- font_object = ftfont_driver.open (f, entity, pixel_size);
+ Lisp_Object font_object = ftfont_open (f, entity, pixel_size);
if (NILP (font_object))
return Qnil;
- font = XFONT_OBJECT (font_object);
+ struct font *font = XFONT_OBJECT (font_object);
font->driver = &ftxfont_driver;
return font_object;
}
static void
ftxfont_close (struct font *font)
{
- ftfont_driver.close (font);
+ ftfont_close (font);
}
static int
\f
+struct font_driver const ftxfont_driver =
+ {
+ /* We can't draw a text without device dependent functions. */
+ type: LISPSYM_INITIALLY (Qftx),
+ get_cache: ftfont_get_cache,
+ list: ftxfont_list,
+ match: ftxfont_match,
+ list_family: ftfont_list_family,
+ open: ftxfont_open,
+ close: ftxfont_close,
+ has_char: ftfont_has_char,
+ encode_char: ftfont_encode_char,
+ text_extents: ftfont_text_extents,
+ draw: ftxfont_draw,
+ get_bitmap: ftfont_get_bitmap,
+ anchor_point: ftfont_anchor_point,
+#ifdef HAVE_LIBOTF
+ otf_capability: ftfont_otf_capability,
+#endif
+ end_for_frame: ftxfont_end_for_frame,
+#if defined HAVE_M17N_FLT && defined HAVE_LIBOTF
+ shape: ftfont_shape,
+#endif
+#ifdef HAVE_OTF_GET_VARIATION_GLYPHS
+ get_variation_glyphs: ftfont_variation_glyphs,
+#endif
+ filter_properties: ftfont_filter_properties,
+ combining_capability: ftfont_combining_capability,
+ };
+
void
syms_of_ftxfont (void)
{
DEFSYM (Qftx, "ftx");
-
- ftxfont_driver = ftfont_driver;
- ftxfont_driver.type = Qftx;
- ftxfont_driver.list = ftxfont_list;
- ftxfont_driver.match = ftxfont_match;
- ftxfont_driver.open = ftxfont_open;
- ftxfont_driver.close = ftxfont_close;
- ftxfont_driver.draw = ftxfont_draw;
- ftxfont_driver.end_for_frame = ftxfont_end_for_frame;
register_font_driver (&ftxfont_driver, NULL);
}
#include <libkern/OSByteOrder.h>
-static struct font_driver macfont_driver;
-
static double mac_font_get_advance_width_for_glyph (CTFontRef, CGGlyph);
static CGRect mac_font_get_bounding_rect_for_glyph (CTFontRef, CGGlyph);
static CFArrayRef mac_font_create_available_families (void);
entity = font_make_entity ();
- ASET (entity, FONT_TYPE_INDEX, macfont_driver.type);
+ ASET (entity, FONT_TYPE_INDEX, Qmac_ct);
ASET (entity, FONT_REGISTRY_INDEX, Qiso10646_1);
macfont_store_descriptor_attributes (desc, entity);
unsigned variations[256]);
static void macfont_filter_properties (Lisp_Object, Lisp_Object);
-static struct font_driver macfont_driver =
+static struct font_driver const macfont_driver =
{
- LISPSYM_INITIALLY (Qmac_ct),
- 0, /* case insensitive */
- macfont_get_cache,
- macfont_list,
- macfont_match,
- macfont_list_family,
- macfont_free_entity,
- macfont_open,
- macfont_close,
- NULL, /* prepare_face */
- NULL, /* done_face */
- macfont_has_char,
- macfont_encode_char,
- macfont_text_extents,
- macfont_draw,
- NULL, /* get_bitmap */
- NULL, /* free_bitmap */
- NULL, /* anchor_point */
- NULL, /* otf_capability */
- NULL, /* otf_drive */
- NULL, /* start_for_frame */
- NULL, /* end_for_frame */
- macfont_shape,
- NULL, /* check */
- macfont_variation_glyphs,
- macfont_filter_properties,
+ type: LISPSYM_INITIALLY (Qmac_ct),
+ get_cache: macfont_get_cache,
+ list: macfont_list,
+ match: macfont_match,
+ list_family: macfont_list_family,
+ free_entity: macfont_free_entity,
+ open: macfont_open,
+ close: macfont_close,
+ has_char: macfont_has_char,
+ encode_char: macfont_encode_char,
+ text_extents: macfont_text_extents,
+ draw: macfont_draw,
+ shape: macfont_shape,
+ get_variation_glyphs: macfont_variation_glyphs,
+ filter_properties: macfont_filter_properties,
};
static Lisp_Object
========================================================================== */
-static Lisp_Object nsfont_get_cache (struct frame *frame);
-static Lisp_Object nsfont_list (struct frame *, Lisp_Object);
-static Lisp_Object nsfont_match (struct frame *, Lisp_Object);
-static Lisp_Object nsfont_list_family (struct frame *);
-static Lisp_Object nsfont_open (struct frame *f, Lisp_Object font_entity,
- int pixel_size);
-static void nsfont_close (struct font *font);
-static int nsfont_has_char (Lisp_Object entity, int c);
-static unsigned int nsfont_encode_char (struct font *font, int c);
-static void nsfont_text_extents (struct font *font, unsigned int *code,
- int nglyphs, struct font_metrics *metrics);
-static int nsfont_draw (struct glyph_string *s, int from, int to, int x, int y,
- bool with_background);
-
-struct font_driver nsfont_driver =
- {
- LISPSYM_INITIALLY (Qns),
- 1, /* case sensitive */
- nsfont_get_cache,
- nsfont_list,
- nsfont_match,
- nsfont_list_family,
- NULL, /*free_entity */
- nsfont_open,
- nsfont_close,
- NULL, /* prepare_face */
- NULL, /* done_face */
- nsfont_has_char,
- nsfont_encode_char,
- nsfont_text_extents,
- nsfont_draw,
- /* excluded: get_bitmap, free_bitmap,
- anchor_point, otf_capability, otf_driver,
- start_for_frame, end_for_frame, shape */
- };
-
-
/* Return a cache of font-entities on FRAME. The cache must be a
cons whose cdr part is the actual cache area. */
static Lisp_Object
font_object = font_make_object (VECSIZE (struct nsfont_info),
font_entity, pixel_size);
- ASET (font_object, FONT_TYPE_INDEX, nsfont_driver.type);
+ ASET (font_object, FONT_TYPE_INDEX, Qns);
font_info = (struct nsfont_info *) XFONT_OBJECT (font_object);
font = (struct font *) font_info;
if (!font)
fprintf (stderr, "\n");
}
+struct font_driver const nsfont_driver =
+ {
+ type: LISPSYM_INITIALLY (Qns),
+ case_sensitive: true,
+ get_cache: nsfont_get_cache,
+ list: nsfont_list,
+ match: nsfont_match,
+ list_family: nsfont_list_family,
+ open: nsfont_open,
+ close: nsfont_close,
+ has_char: nsfont_has_char,
+ encode_char: nsfont_encode_char,
+ text_extents: nsfont_text_extents,
+ draw: nsfont_draw,
+ };
void
syms_of_nsfont (void)
? NULL : pcm);
}
-static Lisp_Object xfont_get_cache (struct frame *);
-static Lisp_Object xfont_list (struct frame *, Lisp_Object);
-static Lisp_Object xfont_match (struct frame *, Lisp_Object);
-static Lisp_Object xfont_list_family (struct frame *);
-static Lisp_Object xfont_open (struct frame *, Lisp_Object, int);
-static void xfont_close (struct font *);
-static void xfont_prepare_face (struct frame *, struct face *);
-static int xfont_has_char (Lisp_Object, int);
-static unsigned xfont_encode_char (struct font *, int);
-static void xfont_text_extents (struct font *, unsigned *, int,
- struct font_metrics *);
-static int xfont_draw (struct glyph_string *, int, int, int, int, bool);
-static int xfont_check (struct frame *, struct font *);
-
-struct font_driver xfont_driver =
- {
- LISPSYM_INITIALLY (Qx),
- false, /* case insensitive */
- xfont_get_cache,
- xfont_list,
- xfont_match,
- xfont_list_family,
- NULL,
- xfont_open,
- xfont_close,
- xfont_prepare_face,
- NULL,
- xfont_has_char,
- xfont_encode_char,
- xfont_text_extents,
- xfont_draw,
- NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
- xfont_check,
- NULL, /* get_variation_glyphs */
- NULL, /* filter_properties */
- };
-
-static Lisp_Object
+Lisp_Object
xfont_get_cache (struct frame *f)
{
Display_Info *dpyinfo = FRAME_DISPLAY_INFO (f);
}
\f
+
+struct font_driver const xfont_driver =
+ {
+ type: LISPSYM_INITIALLY (Qx),
+ get_cache: xfont_get_cache,
+ list: xfont_list,
+ match: xfont_match,
+ list_family: xfont_list_family,
+ open: xfont_open,
+ close: xfont_close,
+ prepare_face: xfont_prepare_face,
+ has_char: xfont_has_char,
+ encode_char: xfont_encode_char,
+ text_extents: xfont_text_extents,
+ draw: xfont_draw,
+ check: xfont_check,
+ };
+
void
syms_of_xfont (void)
{
}
}
-
-struct font_driver xftfont_driver;
-
static Lisp_Object
xftfont_list (struct frame *f, Lisp_Object spec)
{
- Lisp_Object list = ftfont_driver.list (f, spec), tail;
+ Lisp_Object list = ftfont_list (f, spec);
- for (tail = list; CONSP (tail); tail = XCDR (tail))
+ for (Lisp_Object tail = list; CONSP (tail); tail = XCDR (tail))
ASET (XCAR (tail), FONT_TYPE_INDEX, Qxft);
return list;
}
static Lisp_Object
xftfont_match (struct frame *f, Lisp_Object spec)
{
- Lisp_Object entity = ftfont_driver.match (f, spec);
+ Lisp_Object entity = ftfont_match (f, spec);
if (! NILP (entity))
ASET (entity, FONT_TYPE_INDEX, Qxft);
return (ENCODE_CHAR (cs, c) != CHARSET_INVALID_CODE (cs));
if (FONT_ENTITY_P (font))
- return ftfont_driver.has_char (font, c);
+ return ftfont_has_char (font, c);
xftfont_info = (struct xftfont_info *) XFONT_OBJECT (font);
return (XftCharExists (xftfont_info->display, xftfont_info->xftfont,
(FcChar32) c) == FcTrue);
{
struct font *font = CHECK_FONT_GET_OBJECT (LGSTRING_FONT (lgstring));
struct xftfont_info *xftfont_info = (struct xftfont_info *) font;
- FT_Face ft_face;
- Lisp_Object val;
-
- ft_face = XftLockFace (xftfont_info->xftfont);
+ FT_Face ft_face = XftLockFace (xftfont_info->xftfont);
xftfont_info->ft_size = ft_face->size;
- val = ftfont_driver.shape (lgstring);
+ Lisp_Object val = ftfont_shape (lgstring);
XftUnlockFace (xftfont_info->xftfont);
return val;
}
return 0;
}
+/* When using X double buffering, the XftDraw structure we build
+ seems to be useless once a frame is resized, so recreate it on
+ ConfigureNotify and in some other cases. */
+
static void
xftfont_drop_xrender_surfaces (struct frame *f)
{
return ok;
}
+struct font_driver const xftfont_driver =
+ {
+ /* We can't draw a text without device dependent functions. */
+ type: LISPSYM_INITIALLY (Qxft),
+ get_cache: xfont_get_cache,
+ list: xftfont_list,
+ match: xftfont_match,
+ list_family: ftfont_list_family,
+ open: xftfont_open,
+ close: xftfont_close,
+ prepare_face: xftfont_prepare_face,
+ done_face: xftfont_done_face,
+ has_char: xftfont_has_char,
+ encode_char: xftfont_encode_char,
+ text_extents: xftfont_text_extents,
+ draw: xftfont_draw,
+ get_bitmap: ftfont_get_bitmap,
+ anchor_point: ftfont_anchor_point,
+#ifdef HAVE_LIBOTF
+ otf_capability: ftfont_otf_capability,
+#endif
+ end_for_frame: xftfont_end_for_frame,
+#if defined HAVE_M17N_FLT && defined HAVE_LIBOTF
+ shape: xftfont_shape,
+#endif
+#ifdef HAVE_OTF_GET_VARIATION_GLYPHS
+ get_variation_glyphs: ftfont_variation_glyphs,
+#endif
+ filter_properties: ftfont_filter_properties,
+ cached_font_ok: xftfont_cached_font_ok,
+ combining_capability: ftfont_combining_capability,
+ drop_xrender_surfaces: xftfont_drop_xrender_surfaces,
+ };
+
void
syms_of_xftfont (void)
{
ascii_printable[0] = 0;
- xftfont_driver = ftfont_driver;
- xftfont_driver.type = Qxft;
- xftfont_driver.get_cache = xfont_driver.get_cache;
- xftfont_driver.list = xftfont_list;
- xftfont_driver.match = xftfont_match;
- xftfont_driver.open = xftfont_open;
- xftfont_driver.close = xftfont_close;
- xftfont_driver.prepare_face = xftfont_prepare_face;
- xftfont_driver.done_face = xftfont_done_face;
- xftfont_driver.has_char = xftfont_has_char;
- xftfont_driver.encode_char = xftfont_encode_char;
- xftfont_driver.text_extents = xftfont_text_extents;
- xftfont_driver.draw = xftfont_draw;
- xftfont_driver.end_for_frame = xftfont_end_for_frame;
- xftfont_driver.cached_font_ok = xftfont_cached_font_ok;
-#if defined (HAVE_M17N_FLT) && defined (HAVE_LIBOTF)
- xftfont_driver.shape = xftfont_shape;
-#endif
- /* When using X double buffering, the XftDraw structure we build
- seems to be useless once a frame is resized, so recreate it on
- ConfigureNotify and in some other cases. */
- xftfont_driver.drop_xrender_surfaces = xftfont_drop_xrender_surfaces;
-
register_font_driver (&xftfont_driver, NULL);
}