本文整理汇总了C++中SVGTextFragment::isTransformed方法的典型用法代码示例。如果您正苦于以下问题:C++ SVGTextFragment::isTransformed方法的具体用法?C++ SVGTextFragment::isTransformed怎么用?C++ SVGTextFragment::isTransformed使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SVGTextFragment
的用法示例。
在下文中一共展示了SVGTextFragment::isTransformed方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: glyphSize
static inline void calculateGlyphBoundaries(const QueryData* queryData, const SVGTextFragment& fragment, int startPosition, FloatRect& extent)
{
float scalingFactor = queryData->textLineLayout.scalingFactor();
ASSERT(scalingFactor);
FloatPoint glyphPosition = calculateGlyphPositionWithoutTransform(queryData, fragment, startPosition);
glyphPosition.move(0, -queryData->textLineLayout.scaledFont().fontMetrics().floatAscent() / scalingFactor);
extent.setLocation(glyphPosition);
// Use the SVGTextMetrics computed by SVGTextMetricsBuilder (which spends
// time attempting to compute more correct glyph bounds already, handling
// cursive scripts to some degree.)
const Vector<SVGTextMetrics>& textMetricsValues = queryData->textLineLayout.layoutAttributes()->textMetricsValues();
const SVGTextMetrics& metrics = findMetricsForCharacter(textMetricsValues, fragment, startPosition);
// TODO(fs): Negative glyph extents seems kind of weird to have, but
// presently it can occur in some cases (like Arabic.)
FloatSize glyphSize(std::max<float>(metrics.width(), 0), std::max<float>(metrics.height(), 0));
extent.setSize(glyphSize);
// If RTL, adjust the starting point to align with the LHS of the glyph bounding box.
if (!queryData->textBox->isLeftToRightDirection()) {
if (queryData->isVerticalText)
extent.move(0, -glyphSize.height());
else
extent.move(-glyphSize.width(), 0);
}
if (fragment.isTransformed()) {
AffineTransform fragmentTransform = fragment.buildFragmentTransform(SVGTextFragment::TransformIgnoringTextLength);
extent = fragmentTransform.mapRect(extent);
}
}
示例2: offsetForPositionInFragment
int SVGInlineTextBox::offsetForPositionInFragment(
const SVGTextFragment& fragment,
LayoutUnit position,
bool includePartialGlyphs) const {
LineLayoutSVGInlineText lineLayoutItem =
LineLayoutSVGInlineText(this->getLineLayoutItem());
float scalingFactor = lineLayoutItem.scalingFactor();
ASSERT(scalingFactor);
const ComputedStyle& style = lineLayoutItem.styleRef();
TextRun textRun = constructTextRun(style, fragment);
// Eventually handle lengthAdjust="spacingAndGlyphs".
// FIXME: Handle vertical text.
if (fragment.isTransformed()) {
AffineTransform fragmentTransform = fragment.buildFragmentTransform();
textRun.setHorizontalGlyphStretch(
clampTo<float>(fragmentTransform.xScale()));
}
return fragment.characterOffset - start() +
lineLayoutItem.scaledFont().offsetForPosition(
textRun, position * scalingFactor, includePartialGlyphs);
}
示例3: calculateGlyphPosition
static FloatPoint calculateGlyphPosition(const QueryData* queryData, const SVGTextFragment& fragment, int offsetInFragment)
{
FloatPoint glyphPosition = calculateGlyphPositionWithoutTransform(queryData, fragment, offsetInFragment);
if (fragment.isTransformed()) {
AffineTransform fragmentTransform = fragment.buildFragmentTransform(SVGTextFragment::TransformIgnoringTextLength);
glyphPosition = fragmentTransform.mapPoint(glyphPosition);
}
return glyphPosition;
}
示例4: rotationOfCharacterCallback
static bool rotationOfCharacterCallback(QueryData* queryData, const SVGTextFragment& fragment)
{
RotationOfCharacterData* data = static_cast<RotationOfCharacterData*>(queryData);
int startPosition = data->position;
int endPosition = startPosition + 1;
if (!mapStartEndPositionsIntoFragmentCoordinates(queryData, fragment, startPosition, endPosition))
return false;
if (!fragment.isTransformed()) {
data->rotation = 0;
} else {
AffineTransform fragmentTransform = fragment.buildFragmentTransform(SVGTextFragment::TransformIgnoringTextLength);
fragmentTransform.scale(1 / fragmentTransform.xScale(), 1 / fragmentTransform.yScale());
data->rotation = narrowPrecisionToFloat(rad2deg(atan2(fragmentTransform.b(), fragmentTransform.a())));
}
return true;
}