[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#3174: "italic" is underlined now (NS?)
From: |
Adrian Robert |
Subject: |
bug#3174: "italic" is underlined now (NS?) |
Date: |
Sun, 14 Jun 2009 18:53:40 +0300 |
On Jun 14, 2009, at 5:37 PM, David Reitter wrote:
This seems to be the case though. NSFontSlantTrait is 0.0. It's
still in line with the documentation, even though nil would make
more sense...
I suggest the patch below - this makes it work for me.
OK, but the behavior makes the way I set up ns_attribute_value()
pretty much useless, so does the below work on your system? (Sorry I
have no Leopard to test.)
--- nsfont.m.~1.24.~ 2009-06-08 07:08:19.000000000 +0300
+++ nsfont.m 2009-06-14 18:50:50.000000000 +0300
@@ -106,21 +106,15 @@ ns_get_family (Lisp_Object font_spec)
}
-/* Return NSNumber or nil if attr is not set. */
-static NSNumber
-*ns_attribute_value (NSFontDescriptor *fdesc, NSString *trait)
-{
- NSDictionary *tdict = [fdesc objectForKey: NSFontTraitsAttribute];
- NSNumber *val = [tdict objectForKey: trait];
- return val;
-}
-
-
-/* Return 0 if attr not set, else value (which might also be 0). */
+/* Return 0 if attr not set, else value (which might also be 0).
+ On Leopard 0 gets returned even on descriptors where the attribute
+ was never set, so there's no way to distinguish between unspecified
+ and set to not have. Callers should assume 0 means unspecified. */
static float
ns_attribute_fvalue (NSFontDescriptor *fdesc, NSString *trait)
{
- NSNumber *val = ns_attribute_value (fdesc, trait);
+ NSDictionary *tdict = [fdesc objectForKey: NSFontTraitsAttribute];
+ NSNumber *val = [tdict objectForKey: trait];
return val == nil ? 0.0 : [val floatValue];
}
@@ -502,9 +496,7 @@ ns_findfonts (Lisp_Object font_spec, BOO
/* Add synthItal member if needed. */
family = [fdesc objectForKey: NSFontFamilyAttribute];
- if (family != nil && !foundItal && XINT (Flength (list)) > 0
- && (ns_attribute_value (fdesc, NSFontSlantTrait) == nil
- || ns_has_attribute (fdesc, NSFontSlantTrait)))
+ if (family != nil && !foundItal && XINT (Flength (list)) > 0)
{
NSFontDescriptor *sDesc = [[[NSFontDescriptor new]
fontDescriptorWithSymbolicTraits: NSFontItalicTrait]