all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Adrian Robert <adrian.b.robert@gmail.com>
To: David Reitter <david.reitter@gmail.com>
Cc: 3174@emacsbugs.donarmstrong.com
Subject: bug#3174: "italic" is underlined now (NS?)
Date: Sun, 14 Jun 2009 18:53:40 +0300	[thread overview]
Message-ID: <69986D89-E7F3-48BA-AF9E-3D8A37105834@gmail.com> (raw)
In-Reply-To: <9B0EAB9B-4FD7-4B20-8F20-34F74BF1135B@gmail.com>


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]







  reply	other threads:[~2009-06-14 15:53 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-06-11  3:51 "italic" is underlined now (NS?) David Reitter
     [not found] ` <87ws7i3kgr.fsf@cyd.mit.edu>
2009-06-12 12:15   ` bug#3174: " Adrian Robert
2009-06-12 12:49     ` David Reitter
2009-06-12 13:14       ` Adrian Robert
2009-06-12 15:20         ` David Reitter
2009-06-13 11:34           ` Adrian Robert
2009-06-14 14:37             ` David Reitter
2009-06-14 15:53               ` Adrian Robert [this message]
2009-06-14 17:37                 ` David Reitter

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=69986D89-E7F3-48BA-AF9E-3D8A37105834@gmail.com \
    --to=adrian.b.robert@gmail.com \
    --cc=3174@emacsbugs.donarmstrong.com \
    --cc=david.reitter@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.