You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pivot.apache.org by Noel Grandin <no...@gmail.com> on 2010/06/20 22:20:54 UTC

textarea document model and location of font styling data

Hi

Greg, are you particularly attached to having font styling in the
Element class? The way the code is working out, it's going to be a lot
simpler if I push font styling attributes down into the TextNode
class.

In particular, line breaking in the skin becomes a lot simpler (at the
moment it will break), and it's not like font styling can be applied
to anything else.

-- Noel Grandin

Re: textarea document model and location of font styling data

Posted by Greg Brown <gk...@mac.com>.
> OK, but that means that when a paragraph has multiple styles, we end up
> with the following structure:
> 
> <Paragraph>
>  <Span>
>    <Text>some styled text</Text>
>  </Span>
>  <Text>unstyled text</Text>
>  <Span>
>    <Text>more styled text</Text>
>  </Span>
> </Paragraph>

Right. This is similar to how it would work in HTML:

<p>
  <span>some styled text</span>
  unstyled text
  <span>more styled text</span>
</p>

(The <TextNode> elements are actually optional in Pivot's text model as well)

> And we don't currently support Span in TextAreaSkin.
> I'm trying to implement it, but it's turning out pretty complicated,
> because now the line-breaking is going to be split between ParagraphView
> and SpanView.

I haven't tried it yet, but I am guessing that wrapping in SpanView shouldn't be all that different from wrapping in TexNodeView. It doesn't actually need to perform the wrapping - it just needs to know where to break and return the next view so that ParagraphView can wrap.


Re: textarea document model and location of font styling data

Posted by Noel Grandin <no...@gmail.com>.
OK, but that means that when a paragraph has multiple styles, we end up
with the following structure:

<Paragraph>
  <Span>
    <Text>some styled text</Text>
  </Span>
  <Text>unstyled text</Text>
  <Span>
    <Text>more styled text</Text>
  </Span>
</Paragraph>

And we don't currently support Span in TextAreaSkin.
I'm trying to implement it, but it's turning out pretty complicated,
because now the line-breaking is going to be split between ParagraphView
and SpanView.

Anyhow, I'll keep working on it, but it's going to take me a little longer.

Greg Brown wrote:
> I'd prefer to keep it in Element, for a couple of reasons:
>
> 1) It allows sub-nodes to inherit the styles.
>
> 2) A TextNode is simply meant to represent a run of text independent of styling. It should determine any and all styles from its parent (generally either a Paragraph or a Span).
>
> G
>
> On Jun 20, 2010, at 4:20 PM, Noel Grandin wrote:
>
>   
>> Hi
>>
>> Greg, are you particularly attached to having font styling in the
>> Element class? The way the code is working out, it's going to be a lot
>> simpler if I push font styling attributes down into the TextNode
>> class.
>>
>> In particular, line breaking in the skin becomes a lot simpler (at the
>> moment it will break), and it's not like font styling can be applied
>> to anything else.
>>
>> -- Noel Grandin
>>     
>   


Re: textarea document model and location of font styling data

Posted by Greg Brown <gk...@mac.com>.
I'd prefer to keep it in Element, for a couple of reasons:

1) It allows sub-nodes to inherit the styles.

2) A TextNode is simply meant to represent a run of text independent of styling. It should determine any and all styles from its parent (generally either a Paragraph or a Span).

G

On Jun 20, 2010, at 4:20 PM, Noel Grandin wrote:

> Hi
> 
> Greg, are you particularly attached to having font styling in the
> Element class? The way the code is working out, it's going to be a lot
> simpler if I push font styling attributes down into the TextNode
> class.
> 
> In particular, line breaking in the skin becomes a lot simpler (at the
> moment it will break), and it's not like font styling can be applied
> to anything else.
> 
> -- Noel Grandin