本文整理汇总了C++中SVGRootInlineBox::svgTextChunks方法的典型用法代码示例。如果您正苦于以下问题:C++ SVGRootInlineBox::svgTextChunks方法的具体用法?C++ SVGRootInlineBox::svgTextChunks怎么用?C++ SVGRootInlineBox::svgTextChunks使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SVGRootInlineBox
的用法示例。
在下文中一共展示了SVGRootInlineBox::svgTextChunks方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SVGInlineTextBoxQueryWalker
static inline SVGInlineTextBoxQueryWalker executeTextQuery(const SVGTextContentElement* element, SVGInlineTextBoxQueryWalker::QueryMode mode,
long startPosition = 0, long length = 0, FloatPoint referencePoint = FloatPoint())
{
SVGRootInlineBox* rootBox = rootInlineBoxForTextContentElement(element);
if (!rootBox)
return SVGInlineTextBoxQueryWalker(0, mode);
// Find all inline text box associated with our renderer
Vector<SVGInlineTextBox*> textBoxes = findInlineTextBoxInTextChunks(element, rootBox->svgTextChunks());
// Walk text chunks to find chunks associated with our inline text box
SVGInlineTextBoxQueryWalker walkerCallback(element, mode);
walkerCallback.setQueryInputParameters(startPosition, length, referencePoint);
SVGTextChunkWalker<SVGInlineTextBoxQueryWalker> walker(&walkerCallback, &SVGInlineTextBoxQueryWalker::chunkPortionCallback);
Vector<SVGInlineTextBox*>::iterator it = textBoxes.begin();
Vector<SVGInlineTextBox*>::iterator end = textBoxes.end();
for (; it != end; ++it) {
rootBox->walkTextChunks(&walker, *it);
if (walkerCallback.stopProcessing())
break;
}
return walkerCallback;
}
示例2: writeRenderSVGTextBox
static void writeRenderSVGTextBox(TextStream& ts, const RenderBlock& text)
{
SVGRootInlineBox* box = static_cast<SVGRootInlineBox*>(text.firstRootBox());
if (!box)
return;
Vector<SVGTextChunk>& chunks = const_cast<Vector<SVGTextChunk>& >(box->svgTextChunks());
ts << " at (" << text.x() << "," << text.y() << ") size " << box->width() << "x" << box->height() << " contains " << chunks.size() << " chunk(s)";
if (text.parent() && (text.parent()->style()->color() != text.style()->color()))
writeNameValuePair(ts, "color", text.style()->color().name());
}
示例3: at
static TextStream& operator<<(TextStream& ts, const RenderSVGText& text)
{
SVGRootInlineBox* box = static_cast<SVGRootInlineBox*>(text.firstRootBox());
if (!box)
return ts;
Vector<SVGTextChunk>& chunks = const_cast<Vector<SVGTextChunk>& >(box->svgTextChunks());
ts << " at (" << text.xPos() << "," << text.yPos() << ") size " << box->width() << "x" << box->height() << " contains " << chunks.size() << " chunk(s)";
if (text.parent() && (text.parent()->style()->color() != text.style()->color()))
ts << " [color=" << text.style()->color().name() << "]";
return ts;
}
示例4: writeSVGInlineTextBox
static inline void writeSVGInlineTextBox(TextStream& ts, SVGInlineTextBox* textBox, int indent)
{
SVGRootInlineBox* rootBox = textBox->svgRootInlineBox();
if (!rootBox)
return;
Vector<SVGTextChunk>& chunks = const_cast<Vector<SVGTextChunk>& >(rootBox->svgTextChunks());
Vector<SVGTextChunk>::iterator it = chunks.begin();
Vector<SVGTextChunk>::iterator end = chunks.end();
// Write text chunks
unsigned int i = 1;
for (; it != end; ++it) {
SVGTextChunk& cur = *it;
// Write inline box character ranges
Vector<SVGInlineBoxCharacterRange>::iterator boxIt = cur.boxes.begin();
Vector<SVGInlineBoxCharacterRange>::iterator boxEnd = cur.boxes.end();
if (!containsInlineTextBox(cur, textBox)) {
i++;
continue;
}
writeIndent(ts, indent + 1);
unsigned int j = 1;
ts << "chunk " << i << " ";
if (cur.anchor == TA_MIDDLE) {
ts << "(middle anchor";
if (cur.isVerticalText)
ts << ", vertical";
ts << ") ";
} else if (cur.anchor == TA_END) {
ts << "(end anchor";
if (cur.isVerticalText)
ts << ", vertical";
ts << ") ";
} else if (cur.isVerticalText)
ts << "(vertical) ";
unsigned int totalOffset = 0;
for (; boxIt != boxEnd; ++boxIt) {
SVGInlineBoxCharacterRange& range = *boxIt;
unsigned int offset = range.endOffset - range.startOffset;
ASSERT(cur.start + totalOffset <= cur.end);
totalOffset += offset;
if (textBox != static_cast<SVGInlineTextBox*>(range.box)) {
j++;
continue;
}
FloatPoint topLeft = topLeftPositionOfCharacterRange(cur.start + totalOffset - offset, cur.start + totalOffset);
ts << "text run " << j << " at (" << topLeft.x() << "," << topLeft.y() << ") ";
ts << "startOffset " << range.startOffset << " endOffset " << range.endOffset;
if (cur.isVerticalText)
ts << " height " << cummulatedHeightOfInlineBoxCharacterRange(range);
else
ts << " width " << cummulatedWidthOfInlineBoxCharacterRange(range);
if (textBox->direction() == RTL || textBox->m_dirOverride) {
ts << (textBox->direction() == RTL ? " RTL" : " LTR");
if (textBox->m_dirOverride)
ts << " override";
}
ts << ": " << quoteAndEscapeNonPrintables(String(textBox->textRenderer()->text()).substring(textBox->start() + range.startOffset, offset)) << "\n";
j++;
}
i++;
}
}