[Fresco-devel] Text styles/cloning graphics

Tobias Hunger <[email protected]>
Newsgroups gmane.comp.video.fresco.devel
Message-ID <[email protected]>
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi!

I meet Mourad on the LinuxDays in Luxembourgh again this week and we had 
another of our usual discussions on text handling in Fresco.

Of course we would like to use decorators to encode the style of the glyphs. 
Basically we would like to use a table with entries like this (please suggest 
some better names;-):

struct StyleItem {
  Graphic_ptr style;
  size_t start;
  size_t end;
}

with style being a decorator (or sequence of decorators) that are to be 
applied to the characters in range [start, end].

Lets say we had this text: "The car is red." and this SytleItem { style = 
bold, start = 5, end = 8 }. We'd get something like this returned.

hBox
  |
  +-+-+-+--+----+-+-+-+-+-+-+-+
  | | | |  |    | | | | | | | |
  T h e _ bold  _ i s _ r e d .
           |
          hBox
           |
           +-+-+
           | | |
           c a r

I think this is a very natural approach to use for Fresco. With a bit of work 
we could use this mechanism to include buttons to generate hyperlinks, etc. 
as sytling information!

The problem is the following: There could be a linebreak happening inside a 
range covered by the style. This will result in a scenegraph layout like 
this:

vBox
  |
  +---------...---------+
  |                     |
 hBox                  hBox
  |                     |
  +-...-+               +-...-+
  |     |               |     |
       bold            bold
        |               |
       hBox            hBox
        |               |
        +-...-+         +-...-+
        |     |         |     |

You see the problem: We need to duplicate the 'bold' decorator!

How about making that possible with a clone() method on the Graphics? That 
might be useful for other things as well, don't you think? Or is the whole 
decorator approach wrong?

- -- 
Gruss,
Tobias

- ------------------------------------------------------------
Tobias Hunger           The box said: 'Windows 95 or better'
[email protected]                      So I installed Linux.
- ------------------------------------------------------------
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.0 (GNU/Linux)

iD8DBQE9nJ98v0FZW3NyoqURAh62AKCAdmaWVRalELq1cst5pG5SxyYg1ACfQ/ua
iok/esoWWl5pS6Q85jZPkcw=
=/P68
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.