[haiku-development] Re: Styled Text, beyond R5 features

  • From: Simon Taylor <simontaylor1@xxxxxxxxxxxx>
  • To: haiku-development@xxxxxxxxxxxxx
  • Date: Tue, 04 May 2010 13:31:51 +0100

Ithamar R. Adema wrote:
> Hi,
> 
> I got a very rudimentary ODF Text Translator working that can import as
> much as the BTextView features allow.

Nice!

> I'm interested in supporting more
> though, and (IMHO) the BTextView support for styled text is very, very
> rudimentary. I'd like to extend BTextView / the StyledText format to
> support more style information, and even custom objects.
> 
> This would include extending StyledEdit to support those features.
> 
> Would anybody have opinions about doing this? Too much bloat for an API,
> or useful enough?

The translation kit works very well for images, but no so much for text,
as there is no common "base" format for text documents. I wouldn't want
StyledEdit/BTextView to have to support all of the features of whatever
formats we want to import. Either the translation kit is just never
really going to be suitable for text, or we need to define the base
format that translators will use. Perhaps ODF is a possible choice here.

Then say if StyledEdit wants to open an ODF file the translation kit
would first convert that to the base format (a null operation if that's
ODF obviously) and then the BTextView translator would strip out
whatever was not possible to display with the BTextView API and load that.

It's hard to imagine a scheme that could support that and also remain
somewhat lossless when saving back to the original format though.

Back to what features should be added to BTextView - I think the API as
it stands is sufficient for that class. It is about viewing text after
all, and the styledtext allows to set the text properties for any run of
characters. If there's something missing from that set of properties
then I'm all for adding it though. What do you mean by "more style
information"?

As for more features like adding images and tables etc, I don't think
that belongs in BTextView, but it would be nice to have a new class is
for that IMHO.

Simon

Other related posts: