From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Adrian Robert Newsgroups: gmane.emacs.bugs Subject: bug#3174: "italic" is underlined now (NS?) Date: Sun, 14 Jun 2009 18:53:40 +0300 Message-ID: <69986D89-E7F3-48BA-AF9E-3D8A37105834@gmail.com> References: <572FEF4D-AE1C-4805-AF88-AD9B048111C4@gmail.com> <87ws7i3kgr.fsf@cyd.mit.edu> <1AAB5F70-1F6C-4ED8-8B73-F75834BCBFFE@gmail.com> <46210028-DD72-4C1D-B95C-A23A8592A87E@gmail.com> <2779F4B4-BEF7-4AF5-B22B-7D0568649EC6@gmail.com> <78DA06D4-062E-40AC-B8D8-44B0ED0B66B0@gmail.com> <9B0EAB9B-4FD7-4B20-8F20-34F74BF1135B@gmail.com> Reply-To: Adrian Robert , 3174@emacsbugs.donarmstrong.com NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 (Apple Message framework v753.1) Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1244996257 7110 80.91.229.12 (14 Jun 2009 16:17:37 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 14 Jun 2009 16:17:37 +0000 (UTC) Cc: 3174@emacsbugs.donarmstrong.com To: David Reitter Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sun Jun 14 18:17:34 2009 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1MFsOj-0001a9-Uc for geb-bug-gnu-emacs@m.gmane.org; Sun, 14 Jun 2009 18:17:34 +0200 Original-Received: from localhost ([127.0.0.1]:54517 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MFsOi-0003bn-Um for geb-bug-gnu-emacs@m.gmane.org; Sun, 14 Jun 2009 12:17:32 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MFsOe-0003Yk-2G for bug-gnu-emacs@gnu.org; Sun, 14 Jun 2009 12:17:28 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MFsOZ-0003Mo-DN for bug-gnu-emacs@gnu.org; Sun, 14 Jun 2009 12:17:27 -0400 Original-Received: from [199.232.76.173] (port=53997 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MFsOZ-0003MS-7D for bug-gnu-emacs@gnu.org; Sun, 14 Jun 2009 12:17:23 -0400 Original-Received: from rzlab.ucr.edu ([138.23.92.77]:40531) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1MFsOY-0006Bx-Q4 for bug-gnu-emacs@gnu.org; Sun, 14 Jun 2009 12:17:23 -0400 Original-Received: from rzlab.ucr.edu (rzlab.ucr.edu [127.0.0.1]) by rzlab.ucr.edu (8.14.3/8.14.3/Debian-5) with ESMTP id n5EGHKgw029239; Sun, 14 Jun 2009 09:17:20 -0700 Original-Received: (from debbugs@localhost) by rzlab.ucr.edu (8.14.3/8.14.3/Submit) id n5EG03Xb025506; Sun, 14 Jun 2009 09:00:03 -0700 X-Loop: owner@emacsbugs.donarmstrong.com Resent-From: Adrian Robert Resent-To: bug-submit-list@donarmstrong.com Resent-CC: Emacs Bugs , owner@emacsbugs.donarmstrong.com Resent-Date: Sun, 14 Jun 2009 16:00:03 +0000 Resent-Message-ID: Resent-Sender: owner@emacsbugs.donarmstrong.com X-Emacs-PR-Message: followup 3174 X-Emacs-PR-Package: emacs,ns X-Emacs-PR-Keywords: Original-Received: via spool by 3174-submit@emacsbugs.donarmstrong.com id=B3174.124499484324549 (code B ref 3174); Sun, 14 Jun 2009 16:00:03 +0000 Original-Received: (at 3174) by emacsbugs.donarmstrong.com; 14 Jun 2009 15:54:03 +0000 X-Spam-Bayes: score:0.5 Bayes not run. spammytokens:Tokens not available. hammytokens:Tokens not available. Original-Received: from mail-ew0-f226.google.com (mail-ew0-f226.google.com [209.85.219.226]) by rzlab.ucr.edu (8.14.3/8.14.3/Debian-5) with ESMTP id n5EFrwsB024536 for <3174@emacsbugs.donarmstrong.com>; Sun, 14 Jun 2009 08:54:00 -0700 Original-Received: by ewy26 with SMTP id 26so4245724ewy.1 for <3174@emacsbugs.donarmstrong.com>; Sun, 14 Jun 2009 08:53:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:in-reply-to:references :mime-version:content-type:message-id:cc:content-transfer-encoding :from:subject:date:to:x-mailer; bh=Qklnm2fN5NKw8rsJFFo2uG9XofWic4mJyYiQGU3mJ0k=; b=cqFHtaHnHsqT1NXmZPoubAw2gSrn7ZQKKRvVuESJck19wvQfVhffZbRHeNt/fUeGNW mt17BptyfC4H3vqSpDNGTz12OZtrDatbDf0PVeF/ZdS1XM97AFRXVjL4AppxwoosnO8T K1XqqK3ISWGcUtsbodvYzm9Ec/IBAMqa2Or3U= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=in-reply-to:references:mime-version:content-type:message-id:cc :content-transfer-encoding:from:subject:date:to:x-mailer; b=qLzTGMDEdQOCQXKq/AghmoxtpoAy5yhd+mh+h6f55nqQrxQ+tbYQAOOkqMCj5ehVe5 1mmX3TvzTIefxbIxQZtE9nUHk2YE/ITbviDrEBA7t1ap7XAhpHGMf3dUMP4J/WWhvu5z TvmI/eKjyI5RrJVXKATxkbo4TLKUZWXU59mOQ= Original-Received: by 10.210.39.8 with SMTP id m8mr6976282ebm.95.1244994832720; Sun, 14 Jun 2009 08:53:52 -0700 (PDT) Original-Received: from ?88.195.69.114? (dsl-hkibrasgw-ff45c300-114.dhcp.inet.fi [88.195.69.114]) by mx.google.com with ESMTPS id 10sm464264eyd.27.2009.06.14.08.53.47 (version=TLSv1/SSLv3 cipher=RC4-MD5); Sun, 14 Jun 2009 08:53:48 -0700 (PDT) In-Reply-To: <9B0EAB9B-4FD7-4B20-8F20-34F74BF1135B@gmail.com> X-Mailer: Apple Mail (2.753.1) X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 2) Resent-Date: Sun, 14 Jun 2009 12:17:27 -0400 X-BeenThere: bug-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:28697 Archived-At: 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]