aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog9
-rw-r--r--src/nsfont.m28
2 files changed, 27 insertions, 10 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 13b53e922ed..a002eaf33d8 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,12 @@
12013-01-13 Jan Djärv <jan.h.d@swipnet.se>
2
3 * nsfont.m (ns_findfonts): Add block/unblock_input calls.
4 Remove check for fkeys count > zero, block/unblock fixes the real bug.
5 (nsfont_list_family): Add block/unblock_input calls.
6 (nsfont_open): Move block_input earlier. Add unblock_input before early
7 return.
8 (nsfont_draw): Add block/unblock_input calls.
9
12013-01-12 Dmitry Antipov <dmantipov@yandex.ru> 102013-01-12 Dmitry Antipov <dmantipov@yandex.ru>
2 11
3 * indent.c (Fvertical_motion): Remove now-incorrect GCPROs 12 * indent.c (Fvertical_motion): Remove now-incorrect GCPROs
diff --git a/src/nsfont.m b/src/nsfont.m
index c0bea2e225c..39f9e2ef3bc 100644
--- a/src/nsfont.m
+++ b/src/nsfont.m
@@ -546,6 +546,7 @@ ns_findfonts (Lisp_Object font_spec, BOOL isMatch)
546 NSSet *cFamilies; 546 NSSet *cFamilies;
547 BOOL foundItal = NO; 547 BOOL foundItal = NO;
548 548
549 block_input ();
549 if (NSFONT_TRACE) 550 if (NSFONT_TRACE)
550 { 551 {
551 fprintf (stderr, "nsfont: %s for fontspec:\n ", 552 fprintf (stderr, "nsfont: %s for fontspec:\n ",
@@ -560,10 +561,7 @@ ns_findfonts (Lisp_Object font_spec, BOOL isMatch)
560 if (isMatch) 561 if (isMatch)
561 [fkeys removeObject: NSFontFamilyAttribute]; 562 [fkeys removeObject: NSFontFamilyAttribute];
562 563
563 if ([fkeys count] > 0) 564 matchingDescs = [fdesc matchingFontDescriptorsWithMandatoryKeys: fkeys];
564 matchingDescs = [fdesc matchingFontDescriptorsWithMandatoryKeys: fkeys];
565 else
566 matchingDescs = [NSMutableArray array];
567 565
568 if (NSFONT_TRACE) 566 if (NSFONT_TRACE)
569 NSLog(@"Got desc %@ and found %d matching fonts from it: ", fdesc, 567 NSLog(@"Got desc %@ and found %d matching fonts from it: ", fdesc,
@@ -598,6 +596,8 @@ ns_findfonts (Lisp_Object font_spec, BOOL isMatch)
598 [s1 release]; 596 [s1 release];
599 } 597 }
600 598
599 unblock_input ();
600
601 /* Return something if was a match and nothing found. */ 601 /* Return something if was a match and nothing found. */
602 if (isMatch) 602 if (isMatch)
603 return ns_fallback_entity (); 603 return ns_fallback_entity ();
@@ -701,10 +701,12 @@ static Lisp_Object
701nsfont_list_family (Lisp_Object frame) 701nsfont_list_family (Lisp_Object frame)
702{ 702{
703 Lisp_Object list = Qnil; 703 Lisp_Object list = Qnil;
704 NSEnumerator *families = 704 NSEnumerator *families;
705 [[[NSFontManager sharedFontManager] availableFontFamilies]
706 objectEnumerator];
707 NSString *family; 705 NSString *family;
706
707 block_input ();
708 families = [[[NSFontManager sharedFontManager] availableFontFamilies]
709 objectEnumerator];
708 while ((family = [families nextObject])) 710 while ((family = [families nextObject]))
709 list = Fcons (intern ([family UTF8String]), list); 711 list = Fcons (intern ([family UTF8String]), list);
710 /* FIXME: escape the name? */ 712 /* FIXME: escape the name? */
@@ -713,6 +715,7 @@ nsfont_list_family (Lisp_Object frame)
713 fprintf (stderr, "nsfont: list families returning %"pI"d entries\n", 715 fprintf (stderr, "nsfont: list families returning %"pI"d entries\n",
714 XINT (Flength (list))); 716 XINT (Flength (list)));
715 717
718 unblock_input ();
716 return list; 719 return list;
717} 720}
718 721
@@ -735,6 +738,8 @@ nsfont_open (FRAME_PTR f, Lisp_Object font_entity, int pixel_size)
735 Lisp_Object font_object; 738 Lisp_Object font_object;
736 int fixLeopardBug; 739 int fixLeopardBug;
737 740
741 block_input ();
742
738 if (NSFONT_TRACE) 743 if (NSFONT_TRACE)
739 { 744 {
740 fprintf (stderr, "nsfont: open size %d of fontentity:\n ", pixel_size); 745 fprintf (stderr, "nsfont: open size %d of fontentity:\n ", pixel_size);
@@ -794,13 +799,14 @@ nsfont_open (FRAME_PTR f, Lisp_Object font_entity, int pixel_size)
794 font_info = (struct nsfont_info *) XFONT_OBJECT (font_object); 799 font_info = (struct nsfont_info *) XFONT_OBJECT (font_object);
795 font = (struct font *) font_info; 800 font = (struct font *) font_info;
796 if (!font) 801 if (!font)
797 return Qnil; /* FIXME: other terms do, but return Qnil causes segfault */ 802 {
803 unblock_input ();
804 return Qnil; /* FIXME: other terms do, but return Qnil causes segfault */
805 }
798 806
799 font_info->glyphs = xzalloc (0x100 * sizeof *font_info->glyphs); 807 font_info->glyphs = xzalloc (0x100 * sizeof *font_info->glyphs);
800 font_info->metrics = xzalloc (0x100 * sizeof *font_info->metrics); 808 font_info->metrics = xzalloc (0x100 * sizeof *font_info->metrics);
801 809
802 block_input ();
803
804 /* for metrics */ 810 /* for metrics */
805#ifdef NS_IMPL_COCOA 811#ifdef NS_IMPL_COCOA
806 sfont = [nsfont screenFontWithRenderingMode: 812 sfont = [nsfont screenFontWithRenderingMode:
@@ -1051,6 +1057,7 @@ nsfont_draw (struct glyph_string *s, int from, int to, int x, int y,
1051 char isComposite = s->first_glyph->type == COMPOSITE_GLYPH; 1057 char isComposite = s->first_glyph->type == COMPOSITE_GLYPH;
1052 int end = isComposite ? s->cmp_to : s->nchars; 1058 int end = isComposite ? s->cmp_to : s->nchars;
1053 1059
1060 block_input ();
1054 /* Select face based on input flags */ 1061 /* Select face based on input flags */
1055 switch (ns_tmp_flags) 1062 switch (ns_tmp_flags)
1056 { 1063 {
@@ -1273,6 +1280,7 @@ nsfont_draw (struct glyph_string *s, int from, int to, int x, int y,
1273 /* Draw underline, overline, strike-through. */ 1280 /* Draw underline, overline, strike-through. */
1274 ns_draw_text_decoration (s, face, col, r.size.width, r.origin.x); 1281 ns_draw_text_decoration (s, face, col, r.size.width, r.origin.x);
1275 1282
1283 unblock_input ();
1276 return to-from; 1284 return to-from;
1277} 1285}
1278 1286