aboutsummaryrefslogtreecommitdiffstats
path: root/src/macfont.m
diff options
context:
space:
mode:
authorDmitry Antipov2013-10-25 10:55:36 +0400
committerDmitry Antipov2013-10-25 10:55:36 +0400
commit78e0b35c45892995da596c65759fdece3e67129d (patch)
tree4e18a2b9f5703f8eb4c7151fc061f4c13892432e /src/macfont.m
parent963ce6361af7f8b7aefb63e7a50956e497020b12 (diff)
downloademacs-78e0b35c45892995da596c65759fdece3e67129d.tar.gz
emacs-78e0b35c45892995da596c65759fdece3e67129d.zip
Omit unused frame argument of font API's close function.
* font.h (struct font): Drop frame argument. Adjust comment. * font.c (font_clear_cache, font_close_object): Adjust users. * ftfont.c (ftfont_close): * ftxfont.c (ftxfont_close): * macfont.m (macfont_close): * nsfont.m (nsfont_close): * w32font.c (w32font_close): * xfont.c (xfont_close): * xftfont.c (xftfont_close): Adjust driver-specific close functions, tweak comments and make functions safe if called more than once for the same font object.
Diffstat (limited to 'src/macfont.m')
-rw-r--r--src/macfont.m35
1 files changed, 20 insertions, 15 deletions
diff --git a/src/macfont.m b/src/macfont.m
index b3bf96d8c4e..150aca07651 100644
--- a/src/macfont.m
+++ b/src/macfont.m
@@ -1518,7 +1518,7 @@ static Lisp_Object macfont_match (struct frame *, Lisp_Object);
1518static Lisp_Object macfont_list_family (struct frame *); 1518static Lisp_Object macfont_list_family (struct frame *);
1519static void macfont_free_entity (Lisp_Object); 1519static void macfont_free_entity (Lisp_Object);
1520static Lisp_Object macfont_open (struct frame *, Lisp_Object, int); 1520static Lisp_Object macfont_open (struct frame *, Lisp_Object, int);
1521static void macfont_close (struct frame *, struct font *); 1521static void macfont_close (struct font *);
1522static int macfont_has_char (Lisp_Object, int); 1522static int macfont_has_char (Lisp_Object, int);
1523static unsigned macfont_encode_char (struct font *, int); 1523static unsigned macfont_encode_char (struct font *, int);
1524static int macfont_text_extents (struct font *, unsigned int *, int, 1524static int macfont_text_extents (struct font *, unsigned int *, int,
@@ -2580,23 +2580,28 @@ macfont_open (struct frame * f, Lisp_Object entity, int pixel_size)
2580} 2580}
2581 2581
2582static void 2582static void
2583macfont_close (struct frame * f, struct font *font) 2583macfont_close (struct font *font)
2584{ 2584{
2585 struct macfont_info *macfont_info = (struct macfont_info *) font; 2585 struct macfont_info *macfont_info = (struct macfont_info *) font;
2586 int i;
2587 2586
2588 block_input (); 2587 if (macfont_info->cache)
2589 CFRelease (macfont_info->macfont); 2588 {
2590 CGFontRelease (macfont_info->cgfont); 2589 int i;
2591 if (macfont_info->screen_font) 2590
2592 CFRelease (macfont_info->screen_font); 2591 block_input ();
2593 macfont_release_cache (macfont_info->cache); 2592 CFRelease (macfont_info->macfont);
2594 for (i = 0; i < macfont_info->metrics_nrows; i++) 2593 CGFontRelease (macfont_info->cgfont);
2595 if (macfont_info->metrics[i]) 2594 if (macfont_info->screen_font)
2596 xfree (macfont_info->metrics[i]); 2595 CFRelease (macfont_info->screen_font);
2597 if (macfont_info->metrics) 2596 macfont_release_cache (macfont_info->cache);
2598 xfree (macfont_info->metrics); 2597 macfont_info->cache = NULL;
2599 unblock_input (); 2598 for (i = 0; i < macfont_info->metrics_nrows; i++)
2599 if (macfont_info->metrics[i])
2600 xfree (macfont_info->metrics[i]);
2601 if (macfont_info->metrics)
2602 xfree (macfont_info->metrics);
2603 unblock_input ();
2604 }
2600} 2605}
2601 2606
2602static int 2607static int