本文整理汇总了C++中TextRun::characters8方法的典型用法代码示例。如果您正苦于以下问题:C++ TextRun::characters8方法的具体用法?C++ TextRun::characters8怎么用?C++ TextRun::characters8使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TextRun
的用法示例。
在下文中一共展示了TextRun::characters8方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: normalizeCharacters
static void normalizeCharacters(const TextRun& run, unsigned length, UChar* destination, unsigned* destinationLength)
{
unsigned position = 0;
bool error = false;
const UChar* source;
String stringFor8BitRun;
if (run.is8Bit()) {
stringFor8BitRun = String::make16BitFrom8BitSource(run.characters8(), run.length());
source = stringFor8BitRun.characters16();
} else {
source = run.characters16();
}
*destinationLength = 0;
while (position < length) {
UChar32 character;
U16_NEXT(source, position, length, character);
// Don't normalize tabs as they are not treated as spaces for word-end.
if (run.normalizeSpace() && Character::isNormalizedCanvasSpaceCharacter(character))
character = spaceCharacter;
else if (Character::treatAsSpace(character) && character != noBreakSpaceCharacter)
character = spaceCharacter;
else if (Character::treatAsZeroWidthSpaceInComplexScript(character))
character = zeroWidthSpaceCharacter;
U16_APPEND(destination, *destinationLength, length, character, error);
ASSERT_UNUSED(error, !error);
}
}
示例2: UniscribeHelper
UniscribeHelperTextRun::UniscribeHelperTextRun(const TextRun& run,
const Font& font)
: UniscribeHelper(0, run.length(), run.rtl(),
font.primaryFont()->platformData().hfont(),
font.primaryFont()->platformData().scriptCache(),
font.primaryFont()->platformData().scriptFontProperties(),
font.primaryFont()->spaceGlyph())
, m_font(&font)
, m_fontIndex(0)
{
if (run.is8Bit()) {
m_stringFor8BitRun = String::make16BitFrom8BitSource(run.characters8(), run.length());
setInput(m_stringFor8BitRun.characters16());
} else {
setInput(run.characters16());
}
setDirectionalOverride(run.directionalOverride());
setLetterSpacing(font.letterSpacing());
setSpaceWidth(font.spaceWidth());
setWordSpacing(font.wordSpacing());
setAscent(font.fontMetrics().ascent());
setRangeProperties(font.fontDescription().featureSettings());
init();
// Expansion is the amount to add to make justification happen. This
// should be done after Init() so all the runs are already measured.
if (run.expansion() > 0)
justify(run.expansion());
}
示例3: normalizeCharacters
static void normalizeCharacters(const TextRun& run, UChar* destination, int length)
{
int position = 0;
bool error = false;
const UChar* source;
String stringFor8BitRun;
if (run.is8Bit()) {
stringFor8BitRun = String::make16BitFrom8BitSource(run.characters8(), run.length());
source = stringFor8BitRun.characters16();
} else
source = run.characters16();
while (position < length) {
UChar32 character;
int nextPosition = position;
U16_NEXT(source, nextPosition, length, character);
// Don't normalize tabs as they are not treated as spaces for word-end.
if (Font::treatAsSpace(character) && character != '\t')
character = ' ';
else if (Font::treatAsZeroWidthSpaceInComplexScript(character))
character = zeroWidthSpace;
U16_APPEND(destination, position, length, character, error);
ASSERT_UNUSED(error, !error);
position = nextPosition;
}
}
示例4: isFirstRun
bool ShapeResultSpacing::isFirstRun(const TextRun& run) const
{
if (&run == &m_textRun)
return true;
return run.is8Bit()
? run.characters8() == m_textRun.characters8()
: run.characters16() == m_textRun.characters16();
}
示例5: computeNormalizedSpaces
void computeNormalizedSpaces(const TextRun& run, bool mirror, String& normalizedSpacesStringCache)
{
if (normalizedSpacesStringCache.length() == static_cast<unsigned>(run.charactersLength()))
return;
if (run.is8Bit())
normalizedSpacesStringCache = Font::normalizeSpaces(run.characters8(), run.charactersLength());
else
normalizedSpacesStringCache = Font::normalizeSpaces(run.characters16(), run.charactersLength());
if (mirror)
normalizedSpacesStringCache = createStringWithMirroredCharacters(normalizedSpacesStringCache);
}
示例6: ASSERT
SVGTextMetrics::SVGTextMetrics(RenderSVGInlineText* textRenderer, const TextRun& run)
{
ASSERT(textRenderer);
float scalingFactor = textRenderer->scalingFactor();
ASSERT(scalingFactor);
const Font& scaledFont = textRenderer->scaledFont();
int length = 0;
// Calculate width/height using the scaled font, divide this result by the scalingFactor afterwards.
m_width = scaledFont.width(run, length, m_glyph.name) / scalingFactor;
m_height = scaledFont.fontMetrics().floatHeight() / scalingFactor;
m_glyph.unicodeString = run.is8Bit() ? String(run.characters8(), length) : String(run.characters16(), length);
m_glyph.isValid = true;
ASSERT(length >= 0);
m_length = static_cast<unsigned>(length);
}