aboutsummaryrefslogtreecommitdiffstats
path: root/src/nsfont.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/nsfont.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/nsfont.m')
-rw-r--r--src/nsfont.m37
1 files changed, 19 insertions, 18 deletions
diff --git a/src/nsfont.m b/src/nsfont.m
index bd9a2acc983..58663804a2f 100644
--- a/src/nsfont.m
+++ b/src/nsfont.m
@@ -624,7 +624,7 @@ static Lisp_Object nsfont_match (struct frame *, Lisp_Object);
624static Lisp_Object nsfont_list_family (struct frame *); 624static Lisp_Object nsfont_list_family (struct frame *);
625static Lisp_Object nsfont_open (struct frame *f, Lisp_Object font_entity, 625static Lisp_Object nsfont_open (struct frame *f, Lisp_Object font_entity,
626 int pixel_size); 626 int pixel_size);
627static void nsfont_close (struct frame *f, struct font *font); 627static void nsfont_close (struct font *font);
628static int nsfont_has_char (Lisp_Object entity, int c); 628static int nsfont_has_char (Lisp_Object entity, int c);
629static unsigned int nsfont_encode_char (struct font *font, int c); 629static unsigned int nsfont_encode_char (struct font *font, int c);
630static int nsfont_text_extents (struct font *font, unsigned int *code, 630static int nsfont_text_extents (struct font *font, unsigned int *code,
@@ -929,29 +929,30 @@ nsfont_open (struct frame *f, Lisp_Object font_entity, int pixel_size)
929} 929}
930 930
931 931
932/* Close FONT on frame F. */ 932/* Close FONT. */
933static void 933static void
934nsfont_close (struct frame *f, struct font *font) 934nsfont_close (struct font *font)
935{ 935{
936 struct nsfont_info *font_info = (struct nsfont_info *)font; 936 struct nsfont_info *font_info = (struct nsfont_info *) font;
937 int i;
938
939 /* FIXME: this occurs apparently due to same failure to detect same font
940 that causes need for cache in nsfont_open () */
941 if (!font_info)
942 return;
943 937
944 for (i =0; i<0x100; i++) 938 /* FIXME: font_info may be NULL due to same failure to detect
939 same font that causes need for cache in nsfont_open. */
940 if (font_info && font_info->name)
945 { 941 {
946 xfree (font_info->glyphs[i]); 942 int i;
947 xfree (font_info->metrics[i]); 943
948 } 944 for (i = 0; i < 0x100; i++)
949 [font_info->nsfont release]; 945 {
946 xfree (font_info->glyphs[i]);
947 xfree (font_info->metrics[i]);
948 }
949 [font_info->nsfont release];
950#ifdef NS_IMPL_COCOA 950#ifdef NS_IMPL_COCOA
951 CGFontRelease (font_info->cgfont); 951 CGFontRelease (font_info->cgfont);
952#endif 952#endif
953 xfree (font_info->name); 953 xfree (font_info->name);
954 xfree (font_info); 954 font_info->name = NULL;
955 }
955} 956}
956 957
957 958