diff options
| author | Dmitry Antipov | 2013-12-12 18:26:06 +0400 |
|---|---|---|
| committer | Dmitry Antipov | 2013-12-12 18:26:06 +0400 |
| commit | cf86e18b159f754d6e5537b7b9cbefc32297f7d2 (patch) | |
| tree | b584773b90d5cb4c5993cc194037686110a89e36 /src/font.c | |
| parent | c4246a6008ef0c69db296df4aab95530f8e2b95e (diff) | |
| download | emacs-cf86e18b159f754d6e5537b7b9cbefc32297f7d2.tar.gz emacs-cf86e18b159f754d6e5537b7b9cbefc32297f7d2.zip | |
* font.h (struct font_entity) [HAVE_NS]: New field to record
font driver which was used to create this entity.
(struct font) [HAVE_WINDOW_SYSTEM]: New field to record
frame where the font was opened.
(font_close_object): Add prototype.
* font.c (font_make_entity) [HAVE_NS]: Zero out driver field.
(font_close_object): Not static any more. Lost frame arg.
Adjust comment and users.
* alloc.c (cleanup_vector): Call font_close_object to adjust
per-frame font counters correctly. If HAVE_NS, also call
driver-specific cleanup for font-entity objects.
* ftfont.c (ftfont_open):
* nsfont.m (nsfont_open):
* w32font.c (w32font_open_internal):
* xfont.c (xfont_open):
* xftfont.c (xftfont_open): Save frame pointer in font object.
* macfont.m (macfont_open): Likewise.
(macfont_descriptor_entity): Save driver pointer to be able
to call its free_entity routine when font-entity is swept.
* ftxfont.c (ftxfont_open): Add eassert because frame
pointer should be saved by ftfont_driver.open.
Diffstat (limited to 'src/font.c')
| -rw-r--r-- | src/font.c | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/src/font.c b/src/font.c index fb56b3d3fb3..d0a10332028 100644 --- a/src/font.c +++ b/src/font.c | |||
| @@ -173,6 +173,9 @@ font_make_entity (void) | |||
| 173 | allocate_pseudovector (VECSIZE (struct font_entity), | 173 | allocate_pseudovector (VECSIZE (struct font_entity), |
| 174 | FONT_ENTITY_MAX, PVEC_FONT)); | 174 | FONT_ENTITY_MAX, PVEC_FONT)); |
| 175 | XSETFONT (font_entity, entity); | 175 | XSETFONT (font_entity, entity); |
| 176 | #ifdef HAVE_NS | ||
| 177 | entity->driver = NULL; | ||
| 178 | #endif | ||
| 176 | return font_entity; | 179 | return font_entity; |
| 177 | } | 180 | } |
| 178 | 181 | ||
| @@ -2881,10 +2884,10 @@ font_open_entity (struct frame *f, Lisp_Object entity, int pixel_size) | |||
| 2881 | } | 2884 | } |
| 2882 | 2885 | ||
| 2883 | 2886 | ||
| 2884 | /* Close FONT_OBJECT that is opened on frame F. */ | 2887 | /* Close FONT_OBJECT. */ |
| 2885 | 2888 | ||
| 2886 | static void | 2889 | void |
| 2887 | font_close_object (struct frame *f, Lisp_Object font_object) | 2890 | font_close_object (Lisp_Object font_object) |
| 2888 | { | 2891 | { |
| 2889 | struct font *font = XFONT_OBJECT (font_object); | 2892 | struct font *font = XFONT_OBJECT (font_object); |
| 2890 | 2893 | ||
| @@ -2894,8 +2897,9 @@ font_close_object (struct frame *f, Lisp_Object font_object) | |||
| 2894 | FONT_ADD_LOG ("close", font_object, Qnil); | 2897 | FONT_ADD_LOG ("close", font_object, Qnil); |
| 2895 | font->driver->close (font); | 2898 | font->driver->close (font); |
| 2896 | #ifdef HAVE_WINDOW_SYSTEM | 2899 | #ifdef HAVE_WINDOW_SYSTEM |
| 2897 | eassert (FRAME_DISPLAY_INFO (f)->n_fonts); | 2900 | eassert (font->frame); |
| 2898 | FRAME_DISPLAY_INFO (f)->n_fonts--; | 2901 | eassert (FRAME_DISPLAY_INFO (font->frame)->n_fonts); |
| 2902 | FRAME_DISPLAY_INFO (font->frame)->n_fonts--; | ||
| 2899 | #endif | 2903 | #endif |
| 2900 | } | 2904 | } |
| 2901 | 2905 | ||
| @@ -4548,11 +4552,11 @@ DEFUN ("open-font", Fopen_font, Sopen_font, 1, 3, 0, | |||
| 4548 | } | 4552 | } |
| 4549 | 4553 | ||
| 4550 | DEFUN ("close-font", Fclose_font, Sclose_font, 1, 2, 0, | 4554 | DEFUN ("close-font", Fclose_font, Sclose_font, 1, 2, 0, |
| 4551 | doc: /* Close FONT-OBJECT. */) | 4555 | doc: /* Close FONT-OBJECT. Optional FRAME is unused. */) |
| 4552 | (Lisp_Object font_object, Lisp_Object frame) | 4556 | (Lisp_Object font_object, Lisp_Object frame) |
| 4553 | { | 4557 | { |
| 4554 | CHECK_FONT_OBJECT (font_object); | 4558 | CHECK_FONT_OBJECT (font_object); |
| 4555 | font_close_object (decode_live_frame (frame), font_object); | 4559 | font_close_object (font_object); |
| 4556 | return Qnil; | 4560 | return Qnil; |
| 4557 | } | 4561 | } |
| 4558 | 4562 | ||
| @@ -4887,7 +4891,7 @@ If the named font is not yet loaded, return nil. */) | |||
| 4887 | /* As font_object is still in FONT_OBJLIST of the entity, we can't | 4891 | /* As font_object is still in FONT_OBJLIST of the entity, we can't |
| 4888 | close it now. Perhaps, we should manage font-objects | 4892 | close it now. Perhaps, we should manage font-objects |
| 4889 | by `reference-count'. */ | 4893 | by `reference-count'. */ |
| 4890 | font_close_object (f, font_object); | 4894 | font_close_object (font_object); |
| 4891 | #endif | 4895 | #endif |
| 4892 | return info; | 4896 | return info; |
| 4893 | } | 4897 | } |