-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On 3/10/07 at 11:06 PM, Edward de Jong <email@hidden> wrote:
>In an earlier email I remarked how when you draw letters one at a
>time, the string like "can't" will generate a left curved quote
>character in most fonts instead of the apostrophe character. This
>glyph remapping is a font property, and some well intentioned person
>claimed in a previous email that kAllTypographicFeaturesOffSelector in
>the style run would turn off this smart quote feature.
Actually, I didn't say "in the style run" because I wasn't quite sure
where it goes. It *has* been a while. But yes, it goes in the style
object.
>This glyph remapping is a font property, and some well intentioned
>person claimed in a previous email that
>kAllTypographicFeaturesOffSelector in the style run would turn off
>this smart quote feature.
Yes, and he was wrong - in the current (Tiger) headers, it's
kAllTypeFeaturesOffSelector. Sorry about that. This code works
for me:
ATSUFontFeatureType type = kAllTypographicFeaturesType;
ATSUFontFeatureSelector sel = kAllTypeFeaturesOffSelector;
status = ATSUSetFontFeatures(*atsuStyle, 1, &type, &sel);
...where atsuStyle is of type ATSUSTyle*, of course.
>I can assure you that that flag has no effect on the apostrophe into
>quote problem.
I did this playing around with some sample code, and I found
that you
pretty much have to do it the above way - ATSUClearFontFeatures for
kAllTypeFeaturesOnSelector doesn't seem to do the same thing.
You have
to set all type features to off with this selector. Sure
enough, when I
did this, even in Apple Chancery, all the curvy apostrophes (U+2019)
changed to foot marks (U+0027). It *does* work. I seen it.
(The sample was TypeServicesForUnicode, and I modified
Set_FontAndSizeToFirstStyle to use Apple Chancery 18 as the default
font, and turn all typographic features off by default using the above
code. When using Command-9 to pull up the features window, the checkbox
for "All Type Features" is still checked, but the features are
in fact
off. Note that checking or unchecking that checkbox makes no difference
- - it turns all features on and leaves them on. "All type features"
isn't like other features you can set and clear; you have to set
them as
"on" or "off". You may have to do that for all features; I
didn't look
too much into that. Oh, and you'll also want to change
"demotext4" in
localizable.strings to text that has some apostrophes in it so
you can
see it happen.)
<http://devworld.apple.com/samplecode/TypeServicesForUnicode/index.html>
>Certain fonts appear to have state machines inside, and the worst
>offender of all is the Apple Chancery font, which when drawn one
>letter at a time uses fancy swashes whether you want them or not, and
>you cannot turn it off.
As Rosyna notes, this sounds backwards - when glyph selection
depends on
the surrounding glyphs, it's very hard for ATSUI or any other
engine to
know what the previous and next glyphs were if you're drawing
them one
at a time.
Unless they're all part of the same layout object, of course, because
then ATSUI positioned them all before you started drawing them
individually. That could be what you mean, since it would be fairly
expensive to create and destroy layouts for each individual glyph.
Although font features are definitely at play here, there are
times when
kerning and other glyph morphs and movements might be
interfering with
what you want. If so, you'll also need to turn off ATSUI's own
machinations on glyphs with the
kATSLineDisableAllLayoutOperations flag,
for the kATSULineLayoutOptionsTag for ATSUSetLayoutControls.
<http://developer.apple.com/documentation/Carbon/Conceptual/
ATSUI_Concepts/atsui_chap3/chapter_3_section_3.html#//apple_ref/doc/uid/
TP30000029-TPXREF165>
You might also want to set kATSLineUseDeviceMetrics if you absolutely
need integer coordinates for glyph positioning, such as for a
Terminal-type program where old-style ASCII alignment is important.
>These were bad design decisions on Apple's part to do all sorts of
>glyph remapping without letting the caller control it in any way, and
>assumed that lines of text were always drawn a line at a time. It
>makes it extremely hard to do you own custom letter arrangement, when
>glyphs are remapping "under the table".
Well, you would be correct in your analysis if that was true.
In fact,
it was very important in the design that the caller be able to control
it in *every* way - there was absolutely no buy-in for a
solution where
you required a specific glyph but could not get it. It was
supposed to
do the "right" thing by default, but let you turn on or off every
feature as necessary to give you precise control of glyph
selection if
you wanted it.
It's just not very clear how to do it, and hopefully this will soon
filter into Google and it'll be easier. The fonts do have a state
machine in them, but they don't have native code - only ATSUI or other
*rendering* code can use their states to select glyphs, and all
of that
code can be controlled by appropriate layout tags.
The only "code" in a font is hinting in the TrueType language to move
control points closer to grids. The state machine stuff to choose
glyphs is just data for the layout engine to execute per the parameters
that you supply.
The font can suggest what glyphs to use in various contexts, but
it's up
to the layout engine to honor or ignore those requests. If
ATSUI (or
Cocoa Text or anything else) ignores your command not to substitute
glyphs, something's not set up right. It works for me.
>Somebody always throws up arabic as a reason why things should be done
>a certain way, frankly we aren't concerned with arabic, and would like
>English to work first properly.
A well-intentioned person might note that in a Unicode world, using
U+2019 instead of U+0027 for "apostrophe" is technically correct
according to English and typography, and that's why some font
tables say
to use it by default. He might also point out that in a rush to turn
off all typographic features just so things look the way they
"used to,"
you're giving up correct support for some other languages that
you would
otherwise get for free.
It's not that you "have to support Arabic," it's that you get it for
free (or at low cost) by default and should think carefully about
throwing that out just so you can get 1960s-vintage IBM Selectric
non-curving apostrophes. The new world is a nice place.
- --
Matt Deatherage <email@hidden>
GCSF, Incorporated <http://www.macjournals.com>
It's perfectly logical, just not in a logical way.
-----BEGIN PGP SIGNATURE-----
Version: PGP Desktop 9.5.3 (Build 5003)
Charset: UTF-8
wj8DBQFF87iC5AlL5iKAePMRAkn7AKCcZ+k5SECV8gxydW2mnBBUHuEB2gCgjuZq
L4l9i5hNfC6S7MmRskS3dQE=
=VbLr
-----END PGP SIGNATURE-----
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Carbon-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/carbon-dev/email@hidden
This email sent to email@hidden