aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/nsfont.m29
1 files changed, 17 insertions, 12 deletions
diff --git a/src/nsfont.m b/src/nsfont.m
index 60e217fdc24..9802b17f32d 100644
--- a/src/nsfont.m
+++ b/src/nsfont.m
@@ -244,7 +244,11 @@ ns_char_width (NSFont *sfont, int c)
244 return w; 244 return w;
245 } 245 }
246#endif 246#endif
247 w = [sfont widthOfString: cstr]; 247 {
248 NSDictionary *attrsDictionary =
249 [NSDictionary dictionaryWithObject: sfont forKey: NSFontAttributeName];
250 w = [cstr sizeWithAttributes: attrsDictionary].width;
251 }
248 return max (w, 2.0); 252 return max (w, 2.0);
249} 253}
250 254
@@ -543,7 +547,8 @@ ns_findfonts (Lisp_Object font_spec, BOOL isMatch)
543 return ns_fallback_entity (); 547 return ns_fallback_entity ();
544 548
545 if (NSFONT_TRACE) 549 if (NSFONT_TRACE)
546 fprintf (stderr, " Returning %d entities.\n", XINT (Flength (list))); 550 fprintf (stderr, " Returning %ld entities.\n",
551 (long)XINT (Flength (list)));
547 552
548 return list; 553 return list;
549} 554}
@@ -649,8 +654,8 @@ nsfont_list_family (Lisp_Object frame)
649 /* FIXME: escape the name? */ 654 /* FIXME: escape the name? */
650 655
651 if (NSFONT_TRACE) 656 if (NSFONT_TRACE)
652 fprintf (stderr, "nsfont: list families returning %d entries\n", 657 fprintf (stderr, "nsfont: list families returning %ld entries\n",
653 XINT (Flength (list))); 658 (long)XINT (Flength (list)));
654 659
655 return list; 660 return list;
656} 661}
@@ -876,7 +881,7 @@ nsfont_open (FRAME_PTR f, Lisp_Object font_entity, int pixel_size)
876 /* set up metrics portion of font struct */ 881 /* set up metrics portion of font struct */
877 font->ascent = [sfont ascender]; 882 font->ascent = [sfont ascender];
878 font->descent = -[sfont descender]; 883 font->descent = -[sfont descender];
879 font->min_width = [sfont widthOfString: @"|"]; /* FIXME */ 884 font->min_width = ns_char_width(sfont, '|');
880 font->space_width = lrint (ns_char_width (sfont, ' ')); 885 font->space_width = lrint (ns_char_width (sfont, ' '));
881 font->average_width = lrint (font_info->width); 886 font->average_width = lrint (font_info->width);
882 font->max_width = lrint (font_info->max_bounds.width); 887 font->max_width = lrint (font_info->max_bounds.width);
@@ -1332,7 +1337,7 @@ ns_uni_to_glyphs (struct nsfont_info *font_info, unsigned char block)
1332 NSGlyphGenerator *glyphGenerator = [NSGlyphGenerator sharedGlyphGenerator]; 1337 NSGlyphGenerator *glyphGenerator = [NSGlyphGenerator sharedGlyphGenerator];
1333 /*NSCharacterSet *coveredChars = [nsfont coveredCharacterSet]; */ 1338 /*NSCharacterSet *coveredChars = [nsfont coveredCharacterSet]; */
1334 unsigned int numGlyphs = [font_info->nsfont numberOfGlyphs]; 1339 unsigned int numGlyphs = [font_info->nsfont numberOfGlyphs];
1335 unsigned int gInd =0, cInd =0; 1340 NSUInteger gInd =0, cInd =0;
1336 1341
1337 [glyphStorage setString: allChars font: font_info->nsfont]; 1342 [glyphStorage setString: allChars font: font_info->nsfont];
1338 [glyphGenerator generateGlyphsForGlyphStorage: glyphStorage 1343 [glyphGenerator generateGlyphsForGlyphStorage: glyphStorage
@@ -1454,7 +1459,7 @@ ns_glyph_metrics (struct nsfont_info *font_info, unsigned char block)
1454} 1459}
1455 1460
1456/* NSGlyphStorage protocol */ 1461/* NSGlyphStorage protocol */
1457- (unsigned int)layoutOptions 1462- (NSUInteger)layoutOptions
1458{ 1463{
1459 return 0; 1464 return 0;
1460} 1465}
@@ -1464,9 +1469,9 @@ ns_glyph_metrics (struct nsfont_info *font_info, unsigned char block)
1464 return attrStr; 1469 return attrStr;
1465} 1470}
1466 1471
1467- (void)insertGlyphs: (const NSGlyph *)glyphs length: (unsigned int)length 1472- (void)insertGlyphs: (const NSGlyph *)glyphs length: (NSUInteger)length
1468 forStartingGlyphAtIndex: (unsigned int)glyphIndex 1473 forStartingGlyphAtIndex: (NSUInteger)glyphIndex
1469 characterIndex: (unsigned int)charIndex 1474 characterIndex: (NSUInteger)charIndex
1470{ 1475{
1471 len = glyphIndex+length; 1476 len = glyphIndex+length;
1472 for (i =glyphIndex; i<len; i++) 1477 for (i =glyphIndex; i<len; i++)
@@ -1475,8 +1480,8 @@ ns_glyph_metrics (struct nsfont_info *font_info, unsigned char block)
1475 maxGlyph = len; 1480 maxGlyph = len;
1476} 1481}
1477 1482
1478- (void)setIntAttribute: (int)attributeTag value: (int)val 1483- (void)setIntAttribute: (NSInteger)attributeTag value: (NSInteger)val
1479 forGlyphAtIndex: (unsigned)glyphIndex 1484 forGlyphAtIndex: (NSUInteger)glyphIndex
1480{ 1485{
1481 return; 1486 return;
1482} 1487}