Skip navigation.
 
mlManipulating glyphs in text layout
FROM : Aleksandr Skobelev
DATE : Mon Jun 05 18:48:56 2006

Hello,

I am trying implement a custom hyphenation support in NSTextView. There
are some methods in NSTypesetter and NSAttributedString that can be used
for this purpose (shouldBreakLineByHyphenatingBeforeCharacterAtIndex: and
hyphenCharacterForGlyphAtIndex: for NSTypesetter,
lineBreakByHyphenatingBeforeIndex:withinRange: for NSAttrinbutedString).

But there is a problem. Just inserting a hyphen is not enough sometime,
in some languages it might require to replace/remove/add some characters
around the hyphen.

So, I suppose I could use NSLayoutManager's deleteGlyphsInRange:,
insertGlyph:atGlyphIndex:characterIndex:, etc. But I can not figure out
when is a proper moment for this. Could anybody help me with this,
please?

And it is not clear to me also, if it is possible at all to implement
this basing on the existed hyphenation support in Cocoa's text system? Or
I need to subclass NSATSTypesetter (or even worse NSTypesetter) and
implement layoutParagraphAtPoint: by myself?


Thanks in advance,
Aleksandr

Related mailsAuthorDate
No related mails found.