diff options
| author | Po Lu | 2022-06-20 10:57:17 +0000 |
|---|---|---|
| committer | Po Lu | 2022-06-20 10:58:45 +0000 |
| commit | b5dd337ada80ec89651677cfd8630380afca6f91 (patch) | |
| tree | c19c37ae4f7740a55ff5f02ffcfe5f89b97a599f | |
| parent | 8400c59358c69574f3eeb2751b517f94abb28274 (diff) | |
| download | emacs-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.c | 4 | ||||
| -rw-r--r-- | src/haikufont.c | 28 |
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 | ||
| 3595 | void | 3595 | void |
| 3596 | register_font_driver (struct font_driver const *driver, struct frame *f) | 3596 | register_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. */ | ||
| 1178 | static const char *const haikufont_booleans[] = | ||
| 1179 | { | ||
| 1180 | ":antialias", | ||
| 1181 | NULL, | ||
| 1182 | }; | ||
| 1183 | |||
| 1184 | /* List of non-boolean properties. Currently empty. */ | ||
| 1185 | static const char *const haikufont_non_booleans[1]; | ||
| 1186 | |||
| 1187 | static void | ||
| 1188 | haikufont_filter_properties (Lisp_Object font, Lisp_Object alist) | ||
| 1189 | { | ||
| 1190 | font_filter_properties (font, alist, haikufont_booleans, | ||
| 1191 | haikufont_non_booleans); | ||
| 1192 | } | ||
| 1193 | |||
| 1176 | struct font_driver const haikufont_driver = | 1194 | struct 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 | ||
| 1193 | static bool | 1212 | static bool |
| @@ -1270,6 +1289,12 @@ in the font selection dialog. */) | |||
| 1270 | QCsize, lsize); | 1289 | QCsize, lsize); |
| 1271 | } | 1290 | } |
| 1272 | 1291 | ||
| 1292 | static void | ||
| 1293 | syms_of_haikufont_for_pdumper (void) | ||
| 1294 | { | ||
| 1295 | register_font_driver (&haikufont_driver, NULL); | ||
| 1296 | } | ||
| 1297 | |||
| 1273 | void | 1298 | void |
| 1274 | syms_of_haikufont (void) | 1299 | syms_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); |