Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > Ligature in NSTextView

Ligature in NSTextView
Thread Tools
Dedicated MacNNer
Join Date: Nov 2000
Status: Offline
Reply With Quote
Jan 20, 2003, 12:59 AM
 
Hello ...

I've created a rich-text NSTextView that I load with plain text from a file (and then manipulate: setting foreground colors and such for different characters).

Two files contain the word "flask". Loading the first file into the NSTextView renders the character pair "fl" as a single-character ligature; loading the other renders the pair as "f" and "l" ... which is what I want.

How can I get the text view to stop with the ligatures and just load the text as-is?

I've tried programmatically selecting all of the text and then using the
"turnOffLigatures" method, but that doesn't work.

I suppose I could read the text file into a string and append each character to the text view one by one, but this terribly inefficient (especially for long files).


Pointers?


Thanks and regards,

DayLateDon
     
Clinically Insane
Join Date: Oct 2001
Location: San Diego, CA, USA
Status: Offline
Reply With Quote
Jan 20, 2003, 02:38 AM
 
I think ligatures are a property of NSAttributedString. So you ought to be able to turn them off in the view's NSTextContainer (which is a subclass of NSMutableAttributedString).
Chuck
___
"Instead of either 'multi-talented' or 'multitalented' use 'bisexual'."
     
Dedicated MacNNer
Join Date: Nov 2000
Status: Offline
Reply With Quote
Jan 20, 2003, 02:55 AM
 
Hello ...


*DING!*


The attribute value

[NSNumber numberWithInt:0]

for the NSLigatureAttributeName key did it.

(I never even noticed the ligature attribute, even though I've been using just about all of the other attributes pretty liberally.)



Thanks!

DayLateDon
     
   
Thread Tools
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 02:04 PM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2