Re: Can I add my own characters to strings in text fields?
Re: Can I add my own characters to strings in text fields?
- Subject: Re: Can I add my own characters to strings in text fields?
- From: Mike Abdullah <email@hidden>
- Date: Wed, 24 Mar 2010 19:14:02 +0000
On 24 Mar 2010, at 16:16, Jerry Krinock wrote:
>
> On 2010 Mar 24, at 08:15, Mike Abdullah wrote:
>
>> Have you tried using an attributed string to render that character at a particular size or font? Rather than resort to an image attachment, it might well allow you to force the arrow to show up as you want it.
>
> Thank you, Mike. Not with this particular character. I just looked at it in a few dozen different fonts and found that it looks best, indeed probably good enough, in Arial font.
>
> But shlepping around an attributed string is going to make my code really ugly, and in general this approach is going to be hit-or-miss. One easy fix would be to change the font of the entire text fields and menus where this character might be used. Arial font is fine with me, but then my app is going to start looking different than other apps, and may break if Arial is not available?
>
> Maybe I could write a value transformer which would take in a NSString, search it for certain characters, and output an attributed string with runs to make these characters Arial.
Even better, write an NSFormatter subclass which has -attributedStringForObjectValue:withDefaultAttributes: exactly for your sort of scenario.
Use the default attributes to create an attributed string from your model string. Then, modify any special characters to use Arial.
>
> But it sure would be nice if there was a way to do this by making my own character as I proposed in my first paragraph. That would seem to keep the problem encapsulated into the proper domain. Any fontologists out there?
I'm not convinced it would be "encapsulated" since you are talking setting some global state for your app._______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden