Re: [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
On Thursday 03 October 2002 22:04, Stefan Seefeld wrote:
> who is 'we' and what do you get this returned from ? Or, could you
> please provide some more context as to the situation you'd want this
> to be used ? (a html parser that generates a scene graph, an editor that
> wants to change the style of a marked text range, a user who asks the
> TextKit for a paragraph, etc...)
Basically I want there to be a TextInput, a TextView and a TextBuffer with
some associated table of StyleItems. I do not want to have a special
TextViewer for HTML, another one for a TextEditor, one for a Single-line text
edit filed, etc. I think that's not very economic and -- more important --
not very consistent.
A simple Editor is basically a TextBuffer (plus a table of StyleItems), a
TextInput and a TextViewer. I'll ignore linebreaking for now. So far there is
no big change to how we'd do it now, the only addition is a table of
StyleItems that is associated to the TextBuffer. To set some text to bold you
would simply add a 'bold decorator' and the range you want to have affected.
A HTML-Viewer would basically be a TextBuffer, a table of StyleItems and a
TextViewer. The application would preset the StyleTable according to the HTML
tags it found. A link would be marked by a some sequence like this:
button(linkCOmmand)
|
color(blue)
|
underline
and the range of characters this link applies to.
<snip>
> > You see the problem: We need to duplicate the 'bold' decorator!
>
> right. But I think it's a bit early to jump to the conclusion that we
> need a clone method. I don't yet fully understand the context in which
> that could happen. Just 'clone' won't be enough, anyway. How do you
> specify whether you want a shallow or a deep clone (or any specific
> depth) ?
It needs to be a deep copy, doesen't it? You cannot use a shallow copied
object in some place of the scenegraph and the 'original' in another, can
you?
> > 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?
>
> Dunno. It's not trivial, to say the least. An editor that lets you
> change text style would just insert new decorator nodes,
It does in a checked way (won't work if the range is invalid).
> when done
> naively, which results in undefined behavior if the style precedence
> isn't well defined.
It is well defined: You specify the sequence of decoraters to apply together
with the range to apply it to. How can those be not well defined.
> But the real problem is that you don't have any
> control over the 'style' nodes in the graph, i.e. you can't normalize
> it, i.e. remove dead nodes (such as a 'blue' decorator wrapping a 'red'
> decorator...).
Yes... but you cannot do so all over Fresco right now. So why do you allways
bring this up wrt. text? Of course you can specify a arbitrary long sequence
of red/blue decorators, as you can do apply to any graphic. A text is
somewhat more user-editable (and thus abusable) then the static graphics in
the demo, but a interactive graphic editor has exactly the same problems,
doesen't it?
The whole thing is inspired a bit by how GTK/Gnome handles styles. They use
something like the styletable I am proposing (using some tag instead of the
decorators) and have an additional table that associates (one or more) text
attributes with each tag.
- --
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)
iD8DBQE9nLV6v0FZW3NyoqURAmZQAJwM+HxQBq4/l8Rc/Jh8POMovd0+lACdGEIh
WK/sz+QOWHitVHL2qeP1Rng=
=P+GH
-----END PGP SIGNATURE-----