aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAdrian Robert2009-06-14 18:58:38 +0000
committerAdrian Robert2009-06-14 18:58:38 +0000
commit4b7f335c113bf32ecd1a81a5bdc4e5c0899e233b (patch)
treed4ba8fa9b5f5edea8b4ebf7e592914092754a940
parenta1539cd75999eb11c13404b9492bb9b3618e5af6 (diff)
downloademacs-4b7f335c113bf32ecd1a81a5bdc4e5c0899e233b.tar.gz
emacs-4b7f335c113bf32ecd1a81a5bdc4e5c0899e233b.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.
-rw-r--r--src/ChangeLog8
-rw-r--r--src/nsfont.m24
2 files changed, 16 insertions, 16 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index ab357bda4ce..8b3ebdc763e 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,11 @@
12009-06-14 Adrian Robert <Adrian.B.Robert@gmail.com>
2
3 * nsfont.m (ns_attribute_value): Remove.
4 (ns_attribute_fvalue): Incorporate code from ns_attribute_value.
5 (ns_has_attribute): Shrink the normal range.
6 (ns_findfonts): Don't worry about requested spec in determining
7 need for synthItal.
8
12009-06-14 Seiji Zenitani <zenitani@mac.com> 92009-06-14 Seiji Zenitani <zenitani@mac.com>
2 10
3 * xdisp.c [USE_MAC_TOOLBAR]: Remove obsolete definition for Mac Carbon. 11 * xdisp.c [USE_MAC_TOOLBAR]: Remove obsolete definition for Mac Carbon.
diff --git a/src/nsfont.m b/src/nsfont.m
index dde21ccd019..c5e73604e7a 100644
--- a/src/nsfont.m
+++ b/src/nsfont.m
@@ -106,21 +106,15 @@ ns_get_family (Lisp_Object font_spec)
106} 106}
107 107
108 108
109/* Return NSNumber or nil if attr is not set. */ 109/* Return 0 if attr not set, else value (which might also be 0).
110static NSNumber 110 On Leopard 0 gets returned even on descriptors where the attribute
111*ns_attribute_value (NSFontDescriptor *fdesc, NSString *trait) 111 was never set, so there's no way to distinguish between unspecified
112{ 112 and set to not have. Callers should assume 0 means unspecified. */
113 NSDictionary *tdict = [fdesc objectForKey: NSFontTraitsAttribute];
114 NSNumber *val = [tdict objectForKey: trait];
115 return val;
116}
117
118
119/* Return 0 if attr not set, else value (which might also be 0). */
120static float 113static float
121ns_attribute_fvalue (NSFontDescriptor *fdesc, NSString *trait) 114ns_attribute_fvalue (NSFontDescriptor *fdesc, NSString *trait)
122{ 115{
123 NSNumber *val = ns_attribute_value (fdesc, trait); 116 NSDictionary *tdict = [fdesc objectForKey: NSFontTraitsAttribute];
117 NSNumber *val = [tdict objectForKey: trait];
124 return val == nil ? 0.0 : [val floatValue]; 118 return val == nil ? 0.0 : [val floatValue];
125} 119}
126 120
@@ -130,7 +124,7 @@ static BOOL
130ns_has_attribute (NSFontDescriptor *fdesc, NSString *trait) 124ns_has_attribute (NSFontDescriptor *fdesc, NSString *trait)
131{ 125{
132 float v = ns_attribute_fvalue (fdesc, trait); 126 float v = ns_attribute_fvalue (fdesc, trait);
133 return v < -0.25 || v > 0.25; 127 return v < -0.05 || v > 0.05;
134} 128}
135 129
136 130
@@ -502,9 +496,7 @@ ns_findfonts (Lisp_Object font_spec, BOOL isMatch)
502 496
503 /* Add synthItal member if needed. */ 497 /* Add synthItal member if needed. */
504 family = [fdesc objectForKey: NSFontFamilyAttribute]; 498 family = [fdesc objectForKey: NSFontFamilyAttribute];
505 if (family != nil && !foundItal && XINT (Flength (list)) > 0 499 if (family != nil && !foundItal && XINT (Flength (list)) > 0)
506 && (ns_attribute_value (fdesc, NSFontSlantTrait) == nil
507 || ns_has_attribute (fdesc, NSFontSlantTrait)))
508 { 500 {
509 NSFontDescriptor *sDesc = [[[NSFontDescriptor new] 501 NSFontDescriptor *sDesc = [[[NSFontDescriptor new]
510 fontDescriptorWithSymbolicTraits: NSFontItalicTrait] 502 fontDescriptorWithSymbolicTraits: NSFontItalicTrait]