aboutsummaryrefslogtreecommitdiffstats
path: root/src/nsfont.m
diff options
context:
space:
mode:
authorAdrian Robert2009-07-20 18:14:05 +0000
committerAdrian Robert2009-07-20 18:14:05 +0000
commite4e9c24b32d4e2f740e8bf67746f4f47f29438d2 (patch)
treee887aa347caa6f024b3bcc19c0fa3abbf2b6dc62 /src/nsfont.m
parent6bb90094fb48c45c2b179c0dafb44e5f081962e4 (diff)
downloademacs-e4e9c24b32d4e2f740e8bf67746f4f47f29438d2.tar.gz
emacs-e4e9c24b32d4e2f740e8bf67746f4f47f29438d2.zip
* nsfont.m (ns_attribute_value): Remove.
(ns_attribute_fvalue): Incorporate code from ns_attribute_value. (ns_has_attribute): Shrink the normal range. (ns_findfonts): Don't worry about requested spec in determining need for synthItal. (ns_get_covering_families): Retain scriptToFamilies.
Diffstat (limited to 'src/nsfont.m')
-rw-r--r--src/nsfont.m17
1 files changed, 5 insertions, 12 deletions
diff --git a/src/nsfont.m b/src/nsfont.m
index 5a1154bf5b0..788056dba83 100644
--- a/src/nsfont.m
+++ b/src/nsfont.m
@@ -119,15 +119,6 @@ ns_attribute_fvalue (NSFontDescriptor *fdesc, NSString *trait)
119} 119}
120 120
121 121
122/* Return whether font has attribute set to non-standard value. */
123static BOOL
124ns_has_attribute (NSFontDescriptor *fdesc, NSString *trait)
125{
126 float v = ns_attribute_fvalue (fdesc, trait);
127 return v < -0.05 || v > 0.05;
128}
129
130
131/* Converts FONT_WEIGHT, FONT_SLANT, FONT_WIDTH, plus family and script/lang 122/* Converts FONT_WEIGHT, FONT_SLANT, FONT_WIDTH, plus family and script/lang
132 to NSFont descriptor. Information under extra only needed for matching. */ 123 to NSFont descriptor. Information under extra only needed for matching. */
133#define STYLE_REF 100 124#define STYLE_REF 100
@@ -490,7 +481,7 @@ ns_findfonts (Lisp_Object font_spec, BOOL isMatch)
490 list = Fcons (ns_descriptor_to_entity (desc, 481 list = Fcons (ns_descriptor_to_entity (desc,
491 AREF (font_spec, FONT_EXTRA_INDEX), 482 AREF (font_spec, FONT_EXTRA_INDEX),
492 NULL), list); 483 NULL), list);
493 if (ns_has_attribute (desc, NSFontSlantTrait)) 484 if (fabs (ns_attribute_fvalue (desc, NSFontSlantTrait)) > 0.05)
494 foundItal = YES; 485 foundItal = YES;
495 } 486 }
496 487
@@ -666,9 +657,11 @@ nsfont_open (FRAME_PTR f, Lisp_Object font_entity, int pixel_size)
666 synthItal = !NILP (tem) && !strncmp ("synthItal", SDATA (SYMBOL_NAME (tem)), 657 synthItal = !NILP (tem) && !strncmp ("synthItal", SDATA (SYMBOL_NAME (tem)),
667 9); 658 9);
668 family = ns_get_family (font_entity); 659 family = ns_get_family (font_entity);
669 if (ns_has_attribute (fontDesc, NSFontWeightTrait)) 660 /* Should be > 0.23 as some font descriptors (e.g. Terminus) set to that
661 when setting family in ns_spec_to_descriptor(). */
662 if (ns_attribute_fvalue (fontDesc, NSFontWeightTrait) > 0.50)
670 traits |= NSBoldFontMask; 663 traits |= NSBoldFontMask;
671 if (ns_has_attribute (fontDesc, NSFontSlantTrait)) 664 if (fabs (ns_attribute_fvalue (fontDesc, NSFontSlantTrait) > 0.05))
672 traits |= NSItalicFontMask; 665 traits |= NSItalicFontMask;
673 666
674 /* see http://cocoadev.com/forums/comments.php?DiscussionID=74 */ 667 /* see http://cocoadev.com/forums/comments.php?DiscussionID=74 */