aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPo Lu2022-06-20 10:57:17 +0000
committerPo Lu2022-06-20 10:58:45 +0000
commitb5dd337ada80ec89651677cfd8630380afca6f91 (patch)
treec19c37ae4f7740a55ff5f02ffcfe5f89b97a599f
parent8400c59358c69574f3eeb2751b517f94abb28274 (diff)
downloademacs-b5dd337ada80ec89651677cfd8630380afca6f91.tar.gz
emacs-b5dd337ada80ec89651677cfd8630380afca6f91.zip
Fix initialization of Haiku font driver
* src/font.c (register_font_driver): Fix comment. * src/haikufont.c (haikufont_booleans): New list. (haikufont_filter_properties): New function. (haikufont_driver): Register new hook. (syms_of_haikufont_for_pdumper): Register font driver globally. (syms_of_haikufont): Call it in a pdumper hook.
-rw-r--r--src/font.c4
-rw-r--r--src/haikufont.c28
2 files changed, 29 insertions, 3 deletions
diff --git a/src/font.c b/src/font.c
index 702536c1cab..3846cfc1079 100644
--- a/src/font.c
+++ b/src/font.c
@@ -3589,8 +3589,8 @@ font_open_by_name (struct frame *f, Lisp_Object name)
3589 3589
3590 The second is with frame F NULL. In this case, DRIVER is globally 3590 The second is with frame F NULL. In this case, DRIVER is globally
3591 registered in the variable `font_driver_list'. All font-driver 3591 registered in the variable `font_driver_list'. All font-driver
3592 implementations must call this function in its syms_of_XXXX 3592 implementations must call this function in its
3593 (e.g. syms_of_xfont). */ 3593 syms_of_XXXX_for_pdumper (e.g. syms_of_xfont_for_pdumper). */
3594 3594
3595void 3595void
3596register_font_driver (struct font_driver const *driver, struct frame *f) 3596register_font_driver (struct font_driver const *driver, struct frame *f)
diff --git a/src/haikufont.c b/src/haikufont.c
index 77aa4006310..e9a25c0d58b 100644
--- a/src/haikufont.c
+++ b/src/haikufont.c
@@ -1173,6 +1173,24 @@ haikufont_list_family (struct frame *f)
1173 return list; 1173 return list;
1174} 1174}
1175 1175
1176/* List of boolean properties in font names accepted by this font
1177 driver. */
1178static const char *const haikufont_booleans[] =
1179 {
1180 ":antialias",
1181 NULL,
1182 };
1183
1184/* List of non-boolean properties. Currently empty. */
1185static const char *const haikufont_non_booleans[1];
1186
1187static void
1188haikufont_filter_properties (Lisp_Object font, Lisp_Object alist)
1189{
1190 font_filter_properties (font, alist, haikufont_booleans,
1191 haikufont_non_booleans);
1192}
1193
1176struct font_driver const haikufont_driver = 1194struct font_driver const haikufont_driver =
1177 { 1195 {
1178 .type = LISPSYM_INITIALLY (Qhaiku), 1196 .type = LISPSYM_INITIALLY (Qhaiku),
@@ -1187,7 +1205,8 @@ struct font_driver const haikufont_driver =
1187 .encode_char = haikufont_encode_char, 1205 .encode_char = haikufont_encode_char,
1188 .text_extents = haikufont_text_extents, 1206 .text_extents = haikufont_text_extents,
1189 .shape = haikufont_shape, 1207 .shape = haikufont_shape,
1190 .list_family = haikufont_list_family 1208 .list_family = haikufont_list_family,
1209 .filter_properties = haikufont_filter_properties,
1191 }; 1210 };
1192 1211
1193static bool 1212static bool
@@ -1270,6 +1289,12 @@ in the font selection dialog. */)
1270 QCsize, lsize); 1289 QCsize, lsize);
1271} 1290}
1272 1291
1292static void
1293syms_of_haikufont_for_pdumper (void)
1294{
1295 register_font_driver (&haikufont_driver, NULL);
1296}
1297
1273void 1298void
1274syms_of_haikufont (void) 1299syms_of_haikufont (void)
1275{ 1300{
@@ -1299,6 +1324,7 @@ syms_of_haikufont (void)
1299#ifdef USE_BE_CAIRO 1324#ifdef USE_BE_CAIRO
1300 Fput (Qhaiku, Qfont_driver_superseded_by, Qftcr); 1325 Fput (Qhaiku, Qfont_driver_superseded_by, Qftcr);
1301#endif 1326#endif
1327 pdumper_do_now_and_after_load (syms_of_haikufont_for_pdumper);
1302 1328
1303 font_cache = list (Qnil); 1329 font_cache = list (Qnil);
1304 staticpro (&font_cache); 1330 staticpro (&font_cache);