- char_type c = par_->getChar(pos);
-
- // The most special cases are handled first.
- if (c == Paragraph::META_INSET)
- return par_->getInset(pos)->width();
-
- if (!isPrintable(c))
- return theFontMetrics(font).width(c);
-
- Language const * language = font.language();
- if (language->rightToLeft()) {
- if (language->lang() == "arabic_arabtex" ||
- language->lang() == "arabic_arabi" ||
- language->lang() == "farsi") {
- if (Encodings::isComposeChar_arabic(c))
- return 0;
- c = par_->transformChar(c, pos);
- } else if (language->lang() == "hebrew" &&
- Encodings::isComposeChar_hebrew(c))
- return 0;
+ if (!par_->isHfill(pos))
+ return false;
+
+ LASSERT(pos >= row.pos() && pos < row.endpos(), return false);
+
+ // expand at the end of a row only if there is another hfill on the same row
+ if (pos == row.endpos() - 1) {
+ for (pos_type i = row.pos(); i < pos; i++) {
+ if (par_->isHfill(i))
+ return true;
+ }
+ return false;