本文整理汇总了C++中InlineTextBox::object方法的典型用法代码示例。如果您正苦于以下问题:C++ InlineTextBox::object方法的具体用法?C++ InlineTextBox::object怎么用?C++ InlineTextBox::object使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类InlineTextBox
的用法示例。
在下文中一共展示了InlineTextBox::object方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: placePositionedBoxesHorizontally
static int placePositionedBoxesHorizontally(InlineFlowBox* flow, int x, int& leftPosition, int& rightPosition, int& leftAlign, int& rightAlign, bool& needsWordSpacing, int xPos, bool positioned)
{
int mn = INT_MAX;
int mx = INT_MIN;
int amn = INT_MAX;
int amx = INT_MIN;
int startx = x;
bool seenPositionedElement = false;
flow->setXPos(x);
for (InlineBox* curr = flow->firstChild(); curr; curr = curr->nextOnLine()) {
if (curr->object()->isText()) {
mn = min(mn, x);
amn = min(amn, x);
InlineTextBox* text = static_cast<InlineTextBox*>(curr);
RenderText* rt = static_cast<RenderText*>(text->object());
if (rt->textLength()) {
if (needsWordSpacing && DeprecatedChar(rt->characters()[text->start()]).isSpace())
x += rt->style(flow->isFirstLineStyle())->font().wordSpacing();
needsWordSpacing = !DeprecatedChar(rt->characters()[text->end()]).isSpace();
}
text->setXPos(x);
x += text->width();
mx = max(mx, x);
amx = max(amx, x);
} else if (curr->object()->isInlineFlow()) {
InlineFlowBox* flow = static_cast<InlineFlowBox*>(curr);
if (flow->object()->element()->hasTagName(aTag)) {
x = placePositionedBoxesHorizontally(flow, x, mn, mx, amn, amx, needsWordSpacing, xPos, false);
} else {
SVGTextPositioningElement* text = static_cast<SVGTextPositioningElement*>(flow->object()->element());
x += (int)(text->dx()->getFirst().value());
if (text->x()->numberOfItems() > 0)
x = (int)(text->x()->getFirst().value() - xPos);
if (text->x()->numberOfItems() > 0 || text->y()->numberOfItems() > 0 ||
text->dx()->numberOfItems() > 0 || text->dy()->numberOfItems() > 0) {
seenPositionedElement = true;
needsWordSpacing = false;
int ignoreX, ignoreY;
x = placePositionedBoxesHorizontally(flow, x, mn, mx, ignoreX, ignoreY, needsWordSpacing, xPos, true);
} else if (seenPositionedElement) {
int ignoreX, ignoreY;
x = placePositionedBoxesHorizontally(flow, x, mn, mx, ignoreX, ignoreY, needsWordSpacing, xPos, false);
} else
x = placePositionedBoxesHorizontally(flow, x, mn, mx, amn, amx, needsWordSpacing, xPos, false);
}
}
}
if (mn > mx)
mn = mx = startx;
if (amn > amx)
amn = amx = startx;
int width = mx - mn;
flow->setWidth(width);
int awidth = amx - amn;
int dx = 0;
if (positioned) {
switch (flow->object()->style()->svgStyle()->textAnchor()) {
case TA_MIDDLE:
translateBox(flow, dx = -awidth / 2, 0, true);
break;
case TA_END:
translateBox(flow, dx = -awidth, 0, true);
break;
case TA_START:
default:
break;
}
if (dx) {
x += dx;
mn += dx;
mx += dx;
}
}
leftPosition = min(leftPosition, mn);
rightPosition = max(rightPosition, mx);
leftAlign = min(leftAlign, amn);
rightAlign = max(rightAlign, amx);
return x;
}