emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] emacs/src nsfont.m


From: Adrian Robert
Subject: [Emacs-diffs] emacs/src nsfont.m
Date: Sun, 14 Jun 2009 18:58:28 +0000

CVSROOT:        /sources/emacs
Module name:    emacs
Changes by:     Adrian Robert <arobert> 09/06/14 18:58:28

Modified files:
        src            : nsfont.m 

Log message:
                * 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.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/emacs/src/nsfont.m?cvsroot=emacs&r1=1.24&r2=1.25

Patches:
Index: nsfont.m
===================================================================
RCS file: /sources/emacs/emacs/src/nsfont.m,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -b -r1.24 -r1.25
--- nsfont.m    8 Jun 2009 04:33:56 -0000       1.24
+++ nsfont.m    14 Jun 2009 18:58:28 -0000      1.25
@@ -106,21 +106,15 @@
 }
 
 
-/* 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];
 }
 
@@ -130,7 +124,7 @@
 ns_has_attribute (NSFontDescriptor *fdesc, NSString *trait)
 {
     float v = ns_attribute_fvalue (fdesc, trait);
-    return v < -0.25 || v > 0.25;
+    return v < -0.05 || v > 0.05;
 }
 
 
@@ -502,9 +496,7 @@
 
     /* 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]




reply via email to

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