void Text31::init () { LayoutKit* layout = LayoutKit::instance(); PolyGlyph* col = layout->vbox(); PolyGlyph* line = layout->hbox(); FontBoundingBox bbox; _font->font_bbox(bbox); Coord lineheight = bbox.ascent() + bbox.descent(); char ch; for (int i = 0; (*_text)[i] != '\0'; i++) { ch = (*_text)[i]; if (ch == '\n') { line->append(layout->strut(_font)); col->append(layout->fixed_dimension(line, Dimension_Y,lineheight)); line = layout->hbox(); } else if (ch == ' ') { line->append(new Character(' ', _font, _stroke)); } else if (ch != ')' && ch != '(') { if (ch == '\\') { ch = (*_text)[++i]; if (isdigit(ch)) { ch -= '0'; ch *= 8; char digit; digit = (*_text)[i++]; ch = (ch * 8) + digit - '0'; digit = (*_text)[i++]; ch = (ch * 8) + digit - '0'; } } line->append(new Character(ch, _font, _stroke)); } } Transformer fixtext; fixtext.translate(0, bbox.descent()); _t->premultiply(fixtext); _body->append(col); }
TextLineAdjuster::TextLineAdjuster(TextLine* textLine) : Patch(0), Observer() { LayoutKit* lkit = LayoutKit::instance(); adjustable_ = textLine; adjustable_->attach(Dimension_X, this); adjustable_->attach(Dimension_Y, this); updating_ = false; have_ = false; box_ = lkit->hbox(textLine); body(box_); }