[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#3174: "italic" is underlined now (NS?)

From: David Reitter
Subject: bug#3174: "italic" is underlined now (NS?)
Date: Sun, 14 Jun 2009 10:37:16 -0400

On Jun 13, 2009, at 7:34 AM, Adrian Robert wrote:

Don't understand this. The lines above in the log say that a font is requested with only the family specified, nothing about slant. Then fdesc, the result of ns_spec_to_descriptor, is printed out, also showing no slant trait. So why/how does ns_attribute_value() return something? Could you add:

NSLog(@"slant: %@", ns_attribute_value (fdesc, NSFontSlantTrait));

And see what that prints? If it prints 0, it makes some kind of sense, but on Tiger at least nsfont.m:114 gets nil, indicating no possession either way of the attribute. Returning an explicit NSNumber of 0 is such a semantically different behavior I can't believe that changed from Tiger to Leopard.

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.

- D

diff --git a/src/nsfont.m b/src/nsfont.m
index 990d58e..06beb99 100644
--- a/src/nsfont.m
+++ b/src/nsfont.m
@@ -504,6 +504,8 @@ ns_findfonts (Lisp_Object font_spec, BOOL isMatch)
     family = [fdesc objectForKey: NSFontFamilyAttribute];
     if (family != nil && !foundItal && XINT (Flength (list)) > 0
        && (ns_attribute_value (fdesc, NSFontSlantTrait) == nil
+ /* from OSX 10.5 on, 0.0 is returned if no italic trait is available */ + || ([ns_attribute_value (fdesc, NSFontSlantTrait) floatValue] == 0.0)
            || ns_has_attribute (fdesc, NSFontSlantTrait)))
        NSFontDescriptor *sDesc = [[[NSFontDescriptor new]

Attachment: smime.p7s
Description: S/MIME cryptographic signature

reply via email to

[Prev in Thread] Current Thread [Next in Thread]