diff options
author | Adrian Robert <Adrian.B.Robert@gmail.com> | 2009-07-20 18:14:05 +0000 |
---|---|---|
committer | Adrian Robert <Adrian.B.Robert@gmail.com> | 2009-07-20 18:14:05 +0000 |
commit | e4e9c24b32d4e2f740e8bf67746f4f47f29438d2 (patch) | |
tree | e887aa347caa6f024b3bcc19c0fa3abbf2b6dc62 /src/nsfont.m | |
parent | 6bb90094fb48c45c2b179c0dafb44e5f081962e4 (diff) | |
download | emacs-e4e9c24b32d4e2f740e8bf67746f4f47f29438d2.tar.gz |
* 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.m | 17 |
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) } -/* Return whether font has attribute set to non-standard value. */ -static BOOL -ns_has_attribute (NSFontDescriptor *fdesc, NSString *trait) -{ - float v = ns_attribute_fvalue (fdesc, trait); - return v < -0.05 || v > 0.05; -} - - /* Converts FONT_WEIGHT, FONT_SLANT, FONT_WIDTH, plus family and script/lang to NSFont descriptor. Information under extra only needed for matching. */ #define STYLE_REF 100 @@ -490,7 +481,7 @@ ns_findfonts (Lisp_Object font_spec, BOOL isMatch) list = Fcons (ns_descriptor_to_entity (desc, AREF (font_spec, FONT_EXTRA_INDEX), NULL), list); - if (ns_has_attribute (desc, NSFontSlantTrait)) + if (fabs (ns_attribute_fvalue (desc, NSFontSlantTrait)) > 0.05) foundItal = YES; } @@ -666,9 +657,11 @@ nsfont_open (FRAME_PTR f, Lisp_Object font_entity, int pixel_size) synthItal = !NILP (tem) && !strncmp ("synthItal", SDATA (SYMBOL_NAME (tem)), 9); family = ns_get_family (font_entity); - if (ns_has_attribute (fontDesc, NSFontWeightTrait)) + /* Should be > 0.23 as some font descriptors (e.g. Terminus) set to that + when setting family in ns_spec_to_descriptor(). */ + if (ns_attribute_fvalue (fontDesc, NSFontWeightTrait) > 0.50) traits |= NSBoldFontMask; - if (ns_has_attribute (fontDesc, NSFontSlantTrait)) + if (fabs (ns_attribute_fvalue (fontDesc, NSFontSlantTrait) > 0.05)) traits |= NSItalicFontMask; /* see http://cocoadev.com/forums/comments.php?DiscussionID=74 */ |