FROM : Douglas Davidson
DATE : Thu Apr 21 22:23:57 2005
On Apr 21, 2005, at 1:09 PM, Lorenzo wrote:
> Hi,
> with TextEdit application, and with the Cocoa text APIs, I can
> quite set the
> style "Outlined" to a string. But when I do so, I can choose one
> only color:
> the border color. The internal area is transparent, like a hole.
>
> How can I set a color for the border and a color for the internal
> area?
> I mean programmatically. Thank you.
See <AppKit/NSAttributedString.h>, the description of
NSStrokeWidthAttributeName. What you want is to have both stroke and
fill, so you should set a negative value for that attribute. The
fill color will be the foreground color; the stroke color will be
given by NSStrokeColorAttributeName, defaulting to the foreground
color if that attribute is absent, so you should set both
NSForegroundColorAttributeName and NSStrokeColorAttributeName.
Douglas Davidson
DATE : Thu Apr 21 22:23:57 2005
On Apr 21, 2005, at 1:09 PM, Lorenzo wrote:
> Hi,
> with TextEdit application, and with the Cocoa text APIs, I can
> quite set the
> style "Outlined" to a string. But when I do so, I can choose one
> only color:
> the border color. The internal area is transparent, like a hole.
>
> How can I set a color for the border and a color for the internal
> area?
> I mean programmatically. Thank you.
See <AppKit/NSAttributedString.h>, the description of
NSStrokeWidthAttributeName. What you want is to have both stroke and
fill, so you should set a negative value for that attribute. The
fill color will be the foreground color; the stroke color will be
given by NSStrokeColorAttributeName, defaulting to the foreground
color if that attribute is absent, so you should set both
NSForegroundColorAttributeName and NSStrokeColorAttributeName.
Douglas Davidson
| Related mails | Author | Date |
|---|---|---|
| Lorenzo | Apr 21, 22:09 | |
| Douglas Davidson | Apr 21, 22:23 |






Cocoa mail archive

