Re: Fwd: Smart quotes patch

From: Tomas Frydrych <tf_at_o-hand.com>
Date: Fri Feb 08 2008 - 08:53:27 CET

Hi Martin,

Martin Sevior wrote:
> The we need to create a new subclass of fp_TextRun.cpp, call it
> fp_SmartQuoteRun.cpp. All this does to draw the appropriate curly quote
> INSTEAD of the regular quote.

We have been down this road before; there used to be code in the
gr_ContextGlyph class (now long gone) that did quote replacement on the
fly on-screen only, and it worked fine. However, when I did that, number
of folk objected that the typographic quotes should be physically
replaced with the appropriate unicode code points. (I personally am not
that fussed, but there is some merit in that argument.)

> So I envisage this happening:
>
> Current code to detect a smart quote replacement identifies said quote.
>
> The text run before and after the quote is split. A new
> fp_SmartQuoteRun.cpp is inserted over the top of the smart quote. The
> only thing this run does different from a regular fp_TextRun.cpp is it
> just draws the appropriate smart quote instead of the character located
> in the document model at this position.

Sorry, but unless I misunderstood you, this will not work as intended,
for two reasons: (a) the smartquote replacement will not be persistent,
and (b) you will get a bogus undo record on document load.

The fp_SmartQuoteRun will need to be matched with a corresponding piece
table element that to store the status of the quote (i.e., if I insert a
quote, it gets turned into a smart one and then I press undo to revert
to the plain one, I expect to see a plain quote the next time I load the
document).

Tomas
Received on Fri Feb 8 08:54:44 2008

This archive was generated by hypermail 2.1.8 : Fri Feb 08 2008 - 08:54:45 CET