Make Division support the StyledParagraph component

This commit is contained in:
Adrian-George Bostan 2018-09-24 19:43:48 +03:00
parent 8e498d43c8
commit 660139b59a

View File

@ -590,7 +590,7 @@ func (cell *TableCell) Width(ctx DrawContext) float64 {
} }
// SetContent sets the cell's content. The content is a VectorDrawable, i.e. a Drawable with a known height and width. // SetContent sets the cell's content. The content is a VectorDrawable, i.e. a Drawable with a known height and width.
// The currently supported VectorDrawable is: *Paragraph. // The currently supported VectorDrawable is: *Paragraph, *StyledParagraph.
func (cell *TableCell) SetContent(vd VectorDrawable) error { func (cell *TableCell) SetContent(vd VectorDrawable) error {
switch t := vd.(type) { switch t := vd.(type) {
case *Paragraph: case *Paragraph:
@ -599,6 +599,13 @@ func (cell *TableCell) SetContent(vd VectorDrawable) error {
t.enableWrap = false // No wrapping. t.enableWrap = false // No wrapping.
} }
cell.content = vd
case *StyledParagraph:
if t.defaultWrap {
// Default styled paragraph settings in table: no wrapping.
t.enableWrap = false // No wrapping.
}
cell.content = vd cell.content = vd
case *Image: case *Image:
cell.content = vd cell.content = vd