From bda22922f7ed5934a2c1cd9740836df1a22cbc30 Mon Sep 17 00:00:00 2001 From: corvid Date: Tue, 20 Apr 2010 16:04:24 +0000 Subject: css word-spacing property --- dw/style.cc | 4 ++++ dw/style.hh | 2 +- dw/textblock.cc | 3 ++- dw/textblock.hh | 6 +++--- 4 files changed, 10 insertions(+), 5 deletions(-) (limited to 'dw') diff --git a/dw/style.cc b/dw/style.cc index 65c51f89..cc58ce28 100644 --- a/dw/style.cc +++ b/dw/style.cc @@ -53,6 +53,7 @@ void StyleAttrs::initValues () setBorderStyle (BORDER_NONE); hBorderSpacing = 0; vBorderSpacing = 0; + wordSpacing = 0; display = DISPLAY_INLINE; whiteSpace = WHITE_SPACE_NORMAL; @@ -115,6 +116,7 @@ bool StyleAttrs::equals (object::Object *other) { textAlignChar == otherAttrs->textAlignChar && hBorderSpacing == otherAttrs->hBorderSpacing && vBorderSpacing == otherAttrs->vBorderSpacing && + wordSpacing == otherAttrs->wordSpacing && width == otherAttrs->width && height == otherAttrs->height && lineHeight == otherAttrs->lineHeight && @@ -149,6 +151,7 @@ int StyleAttrs::hashValue () { textAlignChar + hBorderSpacing + vBorderSpacing + + wordSpacing + width + height + lineHeight + @@ -236,6 +239,7 @@ void Style::copyAttrs (StyleAttrs *attrs) textAlignChar = attrs->textAlignChar; hBorderSpacing = attrs->hBorderSpacing; vBorderSpacing = attrs->vBorderSpacing; + wordSpacing = attrs->wordSpacing; width = attrs->width; height = attrs->height; lineHeight = attrs->lineHeight; diff --git a/dw/style.hh b/dw/style.hh index af55bb87..04a5e22e 100644 --- a/dw/style.hh +++ b/dw/style.hh @@ -426,7 +426,7 @@ public: VAlignType valign; char textAlignChar; /* In future, strings will be supported. */ - int hBorderSpacing, vBorderSpacing; + int hBorderSpacing, vBorderSpacing, wordSpacing; Length width, height, lineHeight; Box margin, borderWidth, padding; diff --git a/dw/textblock.cc b/dw/textblock.cc index b2772084..cc743252 100644 --- a/dw/textblock.cc +++ b/dw/textblock.cc @@ -1722,7 +1722,8 @@ void Textblock::addSpace (core::style::Style *style) if (!word->content.space) { word->content.space = true; - word->effSpace = word->origSpace = style->font->spaceWidth; + word->effSpace = word->origSpace = style->font->spaceWidth + + style->wordSpacing; //DBG_OBJ_ARRSET_NUM (page, "words.%d.orig_space", nw, // page->words[nw].orig_space); diff --git a/dw/textblock.hh b/dw/textblock.hh index 88351dbb..d05c87e2 100644 --- a/dw/textblock.hh +++ b/dw/textblock.hh @@ -163,9 +163,9 @@ protected: /* TODO: perhaps add a xLeft? */ core::Requisition size; /* Space after the word, only if it's not a break: */ - unsigned short origSpace; /* from font, set by addSpace */ - unsigned short effSpace; /* effective space, set by wordWrap, - * used for drawing etc. */ + short origSpace; /* from font, set by addSpace */ + short effSpace; /* effective space, set by wordWrap, + * used for drawing etc. */ core::Content content; core::style::Style *style; -- cgit v1.2.3