Our DNA is written in Swift

Radar: Support Multiple Shadows in NSHTMLWriter

That was an easy Radar for me to file. It’s not a bug, but it is bugging me nevertheless.

I am disturbed by the disparity between the NSShadowAttributeName attribute (which can only hold a single NSShadow) and CSS where you can have multiple shadows. Because NSHTMLWriter simply copies these to the CSS style of a span it should be quite easy to to also let NSHTMLWriter take an array.

It’s not a very important feature to have, but hey … it would give me some peace of mind. 😉

Filed as Radar#12908144.

Support multiple Shadows in NSHTMLWriter

The current implementation of NSHTMLWriter only supports a single shadow. This shadow is an NSShadow instance set with attribute key NSShadowAttributeName.

NSHTMLWriter maps those core text attributes to their CSS counterparts for display in e.g. UITextView. CSS supports multiple shadows, e.g.

<p style="text-shadow:0.2em 0.5em 0.1em #600,
 -0.3em 0.1em 0.1em #060,
 0.4em -0.3em 0.1em #006">Multiple Shadows</p>

My enhancement request is to allow the NSShadowAttributeName to also be an array of multiple NSShadow instances. Those would simply be transferred to the css style for the span.

This enhancement would make shadows work the same in HTML and CoreText.

Categories: Bug Reports