summaryrefslogtreecommitdiff
path: root/src/font.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/font.c')
-rw-r--r--src/font.c35
1 files changed, 29 insertions, 6 deletions
diff --git a/src/font.c b/src/font.c
index 5705758b99f..964028ccf00 100644
--- a/src/font.c
+++ b/src/font.c
@@ -3518,7 +3518,10 @@ free_font_driver_list (struct frame *f)
/* Make the frame F use font backends listed in NEW_DRIVERS (list of
symbols, e.g. xft, x). If NEW_DRIVERS is t, make F use all
- available font drivers. If NEW_DRIVERS is nil, finalize all drivers.
+ available font drivers that are not superseded by another driver.
+ (A font driver SYMBOL is superseded by the driver specified by
+ SYMBOL's 'font-driver-superseded-by property if it is a non-nil
+ symbol.) If NEW_DRIVERS is nil, finalize all drivers.
A caller must free all realized faces if any in advance. The
return value is a list of font backends actually made used on
@@ -3527,16 +3530,33 @@ free_font_driver_list (struct frame *f)
Lisp_Object
font_update_drivers (struct frame *f, Lisp_Object new_drivers)
{
- Lisp_Object active_drivers = Qnil;
+ Lisp_Object active_drivers = Qnil, default_drivers = Qnil;
struct font_driver_list *list;
+ /* Collect all unsuperseded driver symbols into
+ `default_drivers'. */
+ Lisp_Object all_drivers = Qnil;
+ for (list = f->font_driver_list; list; list = list->next)
+ all_drivers = Fcons (list->driver->type, all_drivers);
+ for (Lisp_Object rest = all_drivers; CONSP (rest); rest = XCDR (rest))
+ {
+ Lisp_Object superseded_by
+ = Fget (XCAR (rest), Qfont_driver_superseded_by);
+
+ if (NILP (superseded_by)
+ || NILP (Fmemq (superseded_by, all_drivers)))
+ default_drivers = Fcons (XCAR (rest), default_drivers);
+ }
+
+ if (EQ (new_drivers, Qt))
+ new_drivers = default_drivers;
+
/* At first, turn off non-requested drivers, and turn on requested
drivers. */
for (list = f->font_driver_list; list; list = list->next)
{
struct font_driver const *driver = list->driver;
- if ((EQ (new_drivers, Qt) || ! NILP (Fmemq (driver->type, new_drivers)))
- != list->on)
+ if ((! NILP (Fmemq (driver->type, new_drivers))) != list->on)
{
if (list->on)
{
@@ -3559,8 +3579,7 @@ font_update_drivers (struct frame *f, Lisp_Object new_drivers)
if (NILP (new_drivers))
return Qnil;
-
- if (! EQ (new_drivers, Qt))
+ else
{
/* Re-order the driver list according to new_drivers. */
struct font_driver_list **list_table, **next;
@@ -3599,6 +3618,8 @@ font_update_drivers (struct frame *f, Lisp_Object new_drivers)
{
struct font_driver const *driver = list->driver;
eassert (! list->on);
+ if (NILP (Fmemq (driver->type, default_drivers)))
+ continue;
if (! driver->start_for_frame
|| driver->start_for_frame (f) == 0)
{
@@ -5359,6 +5380,8 @@ syms_of_font (void)
DEFSYM (QL2R, "L2R");
DEFSYM (QR2L, "R2L");
+ DEFSYM (Qfont_driver_superseded_by, "font-driver-superseded-by");
+
scratch_font_spec = Ffont_spec (0, NULL);
staticpro (&scratch_font_spec);
scratch_font_prefer = Ffont_spec (0, NULL);