Rich Text only works with word wrap option

Issue #862 new
Jim Rea repo owner created an issue

If any option other than word wrap is used, the style can only be set at the beginning of the text.

For example, consider this rich text:


If word wrap mode is used, it displays correctly.

Napkin 08-28-18, 5.46.04 PM.png

If anything other than word wrap mode is used, it displays all black:

Napkin 08-28-18, 5.44.49 PM.png

You can put styles at the front of the text, but then all of the text will be that style, no variation within the text. In other words, it can be all blue, all red, all bold, etc., but no changing of style from character to character.

I think this is an Apple bug. I stepped thru the PVRichText method, and could see with QuickLook that the correct NSAttributedString is generated.

Napkin 08-28-18, 5.43.20 PM.png

Ok, now I'm definitely sure this is an Apple issue. In the TextDisplayObject.m:calculateExpression: method I moved the line

[textView setLineBreakMode:lineBreakMode];

above the line

    [[textView textStorage] setAttributedString: formulaRichText];

With this configuration, rich text didn't work at all. So it appears that setLineBreakMode is removing all styling from the text (except for the initial styling).

This was reported by Gary Yonaites.

Comments (0)

  1. Log in to comment