Re: NSGlyph is still a puzzle
Re: NSGlyph is still a puzzle
- Subject: Re: NSGlyph is still a puzzle
- From: Douglas Davidson <email@hidden>
- Date: Mon, 21 Jan 2002 10:34:40 -0800
On Saturday, January 19, 2002, at 12:26 PM, Anabelle Masour wrote:
I read this
file:///Developer/Documentation/Cocoa/TasksAndConcepts/ProgrammingTopics/
CharsAndGlyphs/index.html. I think I understand now, that a NSGlyph is
managed by a NSLayoutManager. I have been told that the string "fi" can
produce different glypy(s) than "if". It seems to depend on the text. I
don't understand how NSBezierPath can use a NSGlyph and NSFont to
append to its path with -
(void)appendBezierPathWithGlyph:(NSGlyph)aGlyph inFont:(NSFont
*)fontObj, and that there is no relationship to any text or
NSLayoutManager.
Another question, is the value of NSGlyph valid if there is no
NSLayoutManager ?
Can I store NSGlyph values to a file ? Is a NSGlyph of Helvetica the
same value as a NSGlyph of Courier ?
Will two NSLayoutManager always produce the same NSGlyph values for the
same text and font?
An NSGlyph is a token or index that has meaning only within the context
of a particular font; glyph 17 in Helvetica does not necessarily have
any relationship to glyph 17 in Courier (although many common fonts do
use the same values for many common glyphs). There is no necessary
relationship to any text or NSLayoutManager, except that NSLayoutManager
is the only interface we currently provide for conversion between
characters and glyphs.
The values of NSGlyphs are determined by the font, so within a given
process two different NSLayoutManagers will return the same results for
the same text with the same attributes--bearing in mind that by "same
text" I mean the same entire text, not just the same single character,
since the conversion from character to glyph does sometimes depend on
context. The extreme example here is probably Arabic, a cursive-based
writing system in which the written forms of most characters change
radically depending on the preceding and/or following characters.
I don't believe we make any guarantees about the validity of NSGlyph
values over time, so I wouldn't recommend storing them to a file.
Although it is likely that glyph 17 in Helvetica will continue to have
the same meaning from one system to another, there is no absolute
guarantee that the Helvetica font file we ship on a future system will
not be completely reorganized with an entirely different indexing. For
fonts that do not ship with the system there is even less to rely on;
potentially there might be two entirely different implementations of a
font, both named "Foo", installed on different systems, that could be
typographically identical, but still have different indexing internally.
Douglas Davidson