* "italic" is underlined now (NS?)
@ 2009-06-11 3:51 David Reitter
[not found] ` <87ws7i3kgr.fsf@cyd.mit.edu>
0 siblings, 1 reply; 9+ messages in thread
From: David Reitter @ 2009-06-11 3:51 UTC (permalink / raw
To: Emacs-Devel devel
[-- Attachment #1: Type: text/plain, Size: 403 bytes --]
The italic face no longer has slant: italic as specified in faces.el,
but it has "underline" set instead. This can be verified with M-x
customize-face RET italic RET.
Last known "good" revision was 2c0a1f1 (Mon Jun 8, 15:04).
My current revision is 2583fe5 (Jun 11 02:34).
I believe this may have come with teh recent changes to the font
selection mechanism by Adrian. I've tested on NS only.
[-- Attachment #2: smime.p7s --]
[-- Type: application/pkcs7-signature, Size: 2193 bytes --]
^ permalink raw reply [flat|nested] 9+ messages in thread
* bug#3174: "italic" is underlined now (NS?)
[not found] ` <87ws7i3kgr.fsf@cyd.mit.edu>
@ 2009-06-12 12:15 ` Adrian Robert
2009-06-12 12:49 ` David Reitter
0 siblings, 1 reply; 9+ messages in thread
From: Adrian Robert @ 2009-06-12 12:15 UTC (permalink / raw
To: Chong Yidong; +Cc: David Reitter, 3174
On Jun 11, 2009, at 9:37 PM, Chong Yidong wrote:
> Could you take a look at this problem? Thanks.
>
>
> David Reitter <david.reitter@gmail.com> writes:
>
>> The italic face no longer has slant: italic as specified in faces.el,
>> but it has "underline" set instead. This can be verified with M-x
>> customize-face RET italic RET.
I saw this at one point while I was working on the updated font
driver but it went away once I fixed a couple of other problems. If
it persists for OP after running "make recompile" in lisp and a "make
install" from the top level emacs directory, could he/she try
changing the line near the top of nsfont.m to:
#define NSFONT_TRACE 1
and send the output when running Emacs -Q and then immediately doing
the replication steps outlined above?
thanks,
Adrian
^ permalink raw reply [flat|nested] 9+ messages in thread
* bug#3174: "italic" is underlined now (NS?)
2009-06-12 12:15 ` bug#3174: " Adrian Robert
@ 2009-06-12 12:49 ` David Reitter
2009-06-12 13:14 ` Adrian Robert
0 siblings, 1 reply; 9+ messages in thread
From: David Reitter @ 2009-06-12 12:49 UTC (permalink / raw
To: Adrian Robert; +Cc: 3174, Chong Yidong
[-- Attachment #1: Type: text/plain, Size: 5141 bytes --]
On Jun 12, 2009, at 8:15 AM, Adrian Robert wrote:
> I saw this at one point while I was working on the updated font
> driver but it went away once I fixed a couple of other problems. If
> it persists for OP after running "make recompile" in lisp and a
> "make install" from the top level emacs directory,
No change. I even tried a bootstrapped build.
> could he/she try changing the line near the top of nsfont.m to:
>
> #define NSFONT_TRACE 1
>
> and send the output when running Emacs -Q and then immediately doing
> the replication steps outlined above?
This is -Q, then M-x customize-face RET italic RET:
~/em23$ nextstep/Emacs.app/Contents/MacOS/Emacs -Q
nsfont: list for fontspec:
#<font-spec ns nil Monaco nil iso10646-1 nil nil nil nil nil nil
nil ((:name . "Monaco"))>
2009-06-12 08:43:22.617 Emacs[2654:10b] Request covering families for
script: ''
2009-06-12 08:43:22.676 Emacs[2654:10b] returning 287 families
2009-06-12 08:43:22.677 Emacs[2654:10b] Got desc NSCTFontDescriptor
<0x16446a0> = {
NSFontFamilyAttribute = Monaco;
} and found 1 matching fonts from it:
created font_entity:
#<font-entity ns apple Monaco nil iso10646-1 medium normal normal
0 nil 100 0 ((:name . "Monaco"))>
Returning 1 entities.
nsfont: open size 0 of fontentity:
#<font-entity ns apple Monaco nil iso10646-1 medium normal normal
0 nil 100 0 ((:name . "Monaco"))>
2009-06-12 08:43:22.680 Emacs[2654:10b] "Monaco 12.00 pt. P []
(0x01645690) fobj=0x01644f80, spc=7.20"
nsfont: list for fontspec:
#<font-spec ns apple Monaco nil iso10646-1 nil nil nil nil nil
nil nil ((:name))>
2009-06-12 08:43:22.716 Emacs[2654:10b] Request covering families for
script: ''
2009-06-12 08:43:22.717 Emacs[2654:10b] returning 287 families
2009-06-12 08:43:22.718 Emacs[2654:10b] Got desc NSCTFontDescriptor
<0x166a2e0> = {
NSFontFamilyAttribute = Monaco;
} and found 1 matching fonts from it:
created font_entity:
#<font-entity ns apple Monaco nil iso10646-1 medium normal normal
0 nil 100 0 ((:name))>
Returning 1 entities.
nsfont: open size 12 of fontentity:
#<font-entity ns apple Monaco nil iso10646-1 medium normal normal
0 nil 100 0 ((:name))>
2009-06-12 08:43:22.720 Emacs[2654:10b] "Monaco 12.00 pt. P []
(0x01645690) fobj=0x01644f80, spc=7.20"
*** nsfont_open CACHE HIT!
nsfont: open size 12 of fontentity:
#<font-entity ns apple Monaco nil iso10646-1 medium normal normal
0 nil 100 0 ((:name))>
2009-06-12 08:43:22.721 Emacs[2654:10b] "Monaco 12.00 pt. P []
(0x01645690) fobj=0x01644f80, spc=7.20"
*** nsfont_open CACHE HIT!
nsfont: list for fontspec:
#<font-spec ns apple Monaco nil iso10646-1 nil nil nil nil nil
100 nil ((:name))>
2009-06-12 08:43:22.743 Emacs[2654:10b] Request covering families for
script: ''
2009-06-12 08:43:22.744 Emacs[2654:10b] returning 287 families
2009-06-12 08:43:22.745 Emacs[2654:10b] Got desc NSCTFontDescriptor
<0x166de50> = {
NSFontFamilyAttribute = Monaco;
} and found 1 matching fonts from it:
created font_entity:
#<font-entity ns apple Monaco nil iso10646-1 medium normal normal
0 nil 100 0 ((:name))>
Returning 1 entities.
nsfont: open size 12 of fontentity:
#<font-entity ns apple Monaco nil iso10646-1 medium normal normal
0 nil 100 0 ((:name))>
2009-06-12 08:43:22.746 Emacs[2654:10b] "Monaco 12.00 pt. P []
(0x01645690) fobj=0x01644f80, spc=7.20"
*** nsfont_open CACHE HIT!
nsfont: open size 12 of fontentity:
#<font-entity ns apple Monaco nil iso10646-1 medium normal normal
0 nil 100 0 ((:name))>
2009-06-12 08:43:22.768 Emacs[2654:10b] "Monaco 12.00 pt. P []
(0x01645690) fobj=0x01644f80, spc=7.20"
*** nsfont_open CACHE HIT!
0x16457d0 Finding glyphs for glyphs in block 0
0x16457d0 Computing metrics for glyphs in block 0
nsfont: open size 12 of fontentity:
#<font-entity ns apple Monaco nil iso10646-1 medium normal normal
0 nil 100 0 ((:name))>
2009-06-12 08:43:22.825 Emacs[2654:10b] "Monaco 12.00 pt. P []
(0x01645690) fobj=0x01644f80, spc=7.20"
*** nsfont_open CACHE HIT!
nsfont: open size 12 of fontentity:
#<font-entity ns apple Monaco nil iso10646-1 medium normal normal
0 nil 100 0 ((:name))>
2009-06-12 08:43:30.544 Emacs[2654:10b] "Monaco 12.00 pt. P []
(0x01645690) fobj=0x01644f80, spc=7.20"
*** nsfont_open CACHE HIT!
nsfont: open size 12 of fontentity:
#<font-entity ns apple Monaco nil iso10646-1 medium normal normal
0 nil 100 0 ((:name))>
2009-06-12 08:43:30.547 Emacs[2654:10b] "Monaco 12.00 pt. P []
(0x01645690) fobj=0x01644f80, spc=7.20"
*** nsfont_open CACHE HIT!
nsfont: open size 12 of fontentity:
#<font-entity ns apple Monaco nil iso10646-1 medium normal normal
0 nil 100 0 ((:name))>
2009-06-12 08:43:31.931 Emacs[2654:10b] "Monaco 12.00 pt. P []
(0x01645690) fobj=0x01644f80, spc=7.20"
*** nsfont_open CACHE HIT!
nsfont: open size 12 of fontentity:
#<font-entity ns apple Monaco nil iso10646-1 medium normal normal
0 nil 100 0 ((:name))>
2009-06-12 08:43:32.028 Emacs[2654:10b] "Monaco 12.00 pt. P []
(0x01645690) fobj=0x01644f80, spc=7.20"
*** nsfont_open CACHE HIT!
[-- Attachment #2: smime.p7s --]
[-- Type: application/pkcs7-signature, Size: 2193 bytes --]
^ permalink raw reply [flat|nested] 9+ messages in thread
* bug#3174: "italic" is underlined now (NS?)
2009-06-12 12:49 ` David Reitter
@ 2009-06-12 13:14 ` Adrian Robert
2009-06-12 15:20 ` David Reitter
0 siblings, 1 reply; 9+ messages in thread
From: Adrian Robert @ 2009-06-12 13:14 UTC (permalink / raw
To: David Reitter; +Cc: 3174
> This is -Q, then M-x customize-face RET italic RET:
OK, no synthItal font is being returned from list() for Monaco, and I
believe this causes ital face to be "rewritten" to use underline as
the next available emphasis method if no italic is available.
The problem is the if () at nsfont.m: 505 is not firing.
Can you try changing the line just above where family is set to
family = ns_get_family (font_spec);
If that does NOT fix it (see below for what you should see in the
console output) then could you experiment to find out what other
condition is causing the if () not to fire?
If it DOES fix it it must be a Leopard difference. I don't like
calling ns_get_family() twice so I'll look into rewriting some
function signatures to avoid this.
> ~/em23$ nextstep/Emacs.app/Contents/MacOS/Emacs -Q
> nsfont: list for fontspec:
> #<font-spec ns nil Monaco nil iso10646-1 nil nil nil nil nil
> nil nil ((:name . "Monaco"))>
> 2009-06-12 08:43:22.617 Emacs[2654:10b] Request covering families
> for script: ''
> 2009-06-12 08:43:22.676 Emacs[2654:10b] returning 287 families
> 2009-06-12 08:43:22.677 Emacs[2654:10b] Got desc NSCTFontDescriptor
> <0x16446a0> = {
> NSFontFamilyAttribute = Monaco;
> } and found 1 matching fonts from it:
> created font_entity:
> #<font-entity ns apple Monaco nil iso10646-1 medium normal
> normal 0 nil 100 0 ((:name . "Monaco"))>
Should now have:
created font_entity:
#<font-entity ns apple Monaco synthItal iso10646-1 medium italic
normal 0 nil 0 0 ((:name . "Monaco"))>
Returning 2 entities.
^ permalink raw reply [flat|nested] 9+ messages in thread
* bug#3174: "italic" is underlined now (NS?)
2009-06-12 13:14 ` Adrian Robert
@ 2009-06-12 15:20 ` David Reitter
2009-06-13 11:34 ` Adrian Robert
0 siblings, 1 reply; 9+ messages in thread
From: David Reitter @ 2009-06-12 15:20 UTC (permalink / raw
To: Adrian Robert; +Cc: 3174
[-- Attachment #1: Type: text/plain, Size: 875 bytes --]
On Jun 12, 2009, at 9:14 AM, Adrian Robert wrote:
>
> Can you try changing the line just above where family is set to
>
> family = ns_get_family (font_spec);
>
> If that does NOT fix it (see below for what you should see in the
> console output) then could you experiment to find out what other
> condition is causing the if () not to fire?
Doesn't fix it. If I shortcut the "if" condition, it works, as you say.
The reason is that the last part of the "and" fails:
(gdb) print family
$12 = (NSString *) 0xa07d0590
(gdb) print ns_has_attribute (fdesc, NSFontSlantTrait)
$13 = 0 '\000'
(gdb) print ns_attribute_value (fdesc, NSFontSlantTrait)
$14 = (NSNumber *) 0x1644f70
Doesn't that mean that the font has a Slanted trait and shouldn't that
be used rather than making a synthetic one?
Apologies if I'm not making sense, I don't know the font code at all.
- David
[-- Attachment #2: smime.p7s --]
[-- Type: application/pkcs7-signature, Size: 2193 bytes --]
^ permalink raw reply [flat|nested] 9+ messages in thread
* bug#3174: "italic" is underlined now (NS?)
2009-06-12 15:20 ` David Reitter
@ 2009-06-13 11:34 ` Adrian Robert
2009-06-14 14:37 ` David Reitter
0 siblings, 1 reply; 9+ messages in thread
From: Adrian Robert @ 2009-06-13 11:34 UTC (permalink / raw
To: David Reitter; +Cc: 3174
On Jun 12, 2009, at 6:20 PM, David Reitter wrote:
> On Jun 12, 2009, at 9:14 AM, Adrian Robert wrote:
>>
>> Can you try changing the line just above where family is set to
>>
>> family = ns_get_family (font_spec);
>>
>> If that does NOT fix it (see below for what you should see in the
>> console output) then could you experiment to find out what other
>> condition is causing the if () not to fire?
>
> Doesn't fix it. If I shortcut the "if" condition, it works, as you
> say.
>
> The reason is that the last part of the "and" fails:
>
> (gdb) print family
> $12 = (NSString *) 0xa07d0590
> (gdb) print ns_has_attribute (fdesc, NSFontSlantTrait)
> $13 = 0 '\000'
> (gdb) print ns_attribute_value (fdesc, NSFontSlantTrait)
> $14 = (NSNumber *) 0x1644f70
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.
> Doesn't that mean that the font has a Slanted trait and shouldn't
> that be used rather than making a synthetic one?
'fdesc' is the template descriptor that is being matched against,
created by converting from the font_spec passed in by emacs. So we
only want to create and add a synthetic italic member if either (a)
an italic font was requested (fdesc has font slant trait) or (b)
nothing was specified about italic, in which case we should return
both italic and nonitalic fonts (and bold / nonbold).
^ permalink raw reply [flat|nested] 9+ messages in thread
* bug#3174: "italic" is underlined now (NS?)
2009-06-13 11:34 ` Adrian Robert
@ 2009-06-14 14:37 ` David Reitter
2009-06-14 15:53 ` Adrian Robert
0 siblings, 1 reply; 9+ messages in thread
From: David Reitter @ 2009-06-14 14:37 UTC (permalink / raw
To: Adrian Robert; +Cc: 3174
[-- Attachment #1: Type: text/plain, Size: 1622 bytes --]
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 #2: smime.p7s --]
[-- Type: application/pkcs7-signature, Size: 2193 bytes --]
^ permalink raw reply related [flat|nested] 9+ messages in thread
* bug#3174: "italic" is underlined now (NS?)
2009-06-14 14:37 ` David Reitter
@ 2009-06-14 15:53 ` Adrian Robert
2009-06-14 17:37 ` David Reitter
0 siblings, 1 reply; 9+ messages in thread
From: Adrian Robert @ 2009-06-14 15:53 UTC (permalink / raw
To: David Reitter; +Cc: 3174
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]
^ permalink raw reply [flat|nested] 9+ messages in thread
* bug#3174: "italic" is underlined now (NS?)
2009-06-14 15:53 ` Adrian Robert
@ 2009-06-14 17:37 ` David Reitter
0 siblings, 0 replies; 9+ messages in thread
From: David Reitter @ 2009-06-14 17:37 UTC (permalink / raw
To: Adrian Robert; +Cc: 3174
[-- Attachment #1: Type: text/plain, Size: 1978 bytes --]
On Jun 14, 2009, at 11:53 AM, Adrian Robert wrote:
>
> 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.)
OK, this seems to work for Monaco.
However...
I identified (using Font Book) a font (Garamond) that seems to have
its own Italic variant.
I then did M-x customize-face RET default RET and switched to Garamond
14pt.
Looking at some italic text (\emph{...} in a latex-mode buffer), C-u C-
x = gives me:
display: by this font (glyph code)
nil:-apple-Garamond-medium-italic-normal-synthItal-14-*-*-*-p-0-
iso10646-1 (#x57)
There are text properties here:
charset iso-8859-1
face (italic)
fontified t
Why is this synthItal?
Shouldn't it use the provided font?
Some debugging reveals that it can't see the italics because your
[-0.25;0.25] bracket is too strict (that's +-7.5 degrees - a
reasonable minimum).
#<font-entity ns apple Garamond nil iso10646-1 medium italic
normal 0 nil 0 0 ((:name))>
2009-06-14 13:31:42.779 Aquamacs[40351:813] no ital found - 0.06944444
created font_entity:
#<font-entity ns apple Garamond nil iso10646-1 medium italic
normal 0 nil 0 0 ((:name))>
2009-06-14 13:31:42.779 Aquamacs[40351:813] no ital found - 0.06944444
created font_entity:
#<font-entity ns apple Garamond nil iso10646-1 medium italic
normal 0 nil 0 0 ((:name))>
2009-06-14 13:31:42.780 Aquamacs[40351:813] no ital found - 0.06944444
So I'm changing this to
static BOOL
ns_has_attribute (NSFontDescriptor *fdesc, NSString *trait)
{
float v = ns_attribute_fvalue (fdesc, trait);
return v < -0.05 || v > 0.05;
}
How I get
nil:-apple-Garamond-medium-italic-normal-*-14-*-*-*-p-0-iso10646-1
(#x4C)
and Garamond italic looks noticeably better. The synthetic italic
slant was quite a bit too slanted.
Hope we've got it nailed now.
- David
[-- Attachment #2: smime.p7s --]
[-- Type: application/pkcs7-signature, Size: 2193 bytes --]
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2009-06-14 17:37 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
2009-06-14 17:37 ` David Reitter
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.