Thank you very much, I think my situation makes some of the potential
problems you mentioned probably not too problematic. None of the
markings I want to suppress are precomposed, I believe. Also, the text
shouldn't have any other decorations such as you mentioned and the
text won't be user editable. I think your solution sounds very doable
and elegant.
Thank you everyone for the help on this,
Philip White
On Jun 5, 2009, at 5:12 PM, Douglas Davidson wrote:
As I understand it, what you want to do is not to affect layout at
all, but simply to cause certain glyphs not to be displayed. In
general this can be problematic, because without knowledge of the
font involved one can't necessarily guarantee that a particular
character will be represented by a single glyph or vice versa; if
the diacritic you are interested in is only a part of a single
precomposed glyph in the font, then suppressing it would be
difficult. With that caveat, though, what you're asking should be
possible.
There is a glyph-level attribute maintained by the layout manager
via -setNotShownAttribute:forGlyphAtIndex:/
notShownAttributeForGlyphAtIndex:, that could in principle be used
for something of this sort, but it is usually used exclusively by
the typesetter and it might be difficult to coordinate independent
use of it. What might be cleaner, if you can readily identify the
glyphs you are interested in, would be to subclass NSLayoutManager
and override one of the drawing methods, such as -
drawGlyphsForGlyphRange:atPoint: or -showPackedGlyphs:..., and
simply suppress drawing of certain glyphs.
Some issues: you would in general need to split up the range passed
in and call the super method with the remaining ranges; you might
need to decide what to do about decorations such as underlines or
strikethroughs for the affected ranges; depending on what you were
doing, you might produce odd user experiences when editing the
glyphs involved. I've presented examples at past WWDCs of the use
of overriding these methods to add extra decoration near or around
the glyphs in question, and I would imagine they would be equally
suitable to subtracting from the displayed glyphs.
Douglas Davidson
_______________________________________________
Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com
This email sent to arch...@mail-archive.com