本文整理汇总了C++中GlyphPage::fill方法的典型用法代码示例。如果您正苦于以下问题:C++ GlyphPage::fill方法的具体用法?C++ GlyphPage::fill怎么用?C++ GlyphPage::fill使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GlyphPage
的用法示例。
在下文中一共展示了GlyphPage::fill方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: fillGlyphPage
static bool fillGlyphPage(GlyphPage& pageToFill, UChar* buffer, unsigned bufferLength, const Font* font)
{
#if ENABLE(SVG_FONTS)
if (auto* svgData = font->svgData())
return svgData->fillSVGGlyphPage(&pageToFill, buffer, bufferLength, font);
#endif
bool hasGlyphs = pageToFill.fill(buffer, bufferLength, font);
#if ENABLE(OPENTYPE_VERTICAL)
if (hasGlyphs && font->verticalData())
font->verticalData()->substituteWithVerticalGlyphs(font, &pageToFill);
#endif
return hasGlyphs;
}
示例2: initializePage
void GlyphPageTreeNode::initializePage(const FontData* fontData, unsigned pageNumber)
{
ASSERT(!m_page);
// This function must not be called for the root of the tree, because that
// level does not contain any glyphs.
ASSERT(m_level > 0 && m_parent);
// The parent's page will be 0 if we are level one or the parent's font data
// did not contain any glyphs for that page.
GlyphPage* parentPage = m_parent->page();
// NULL FontData means we're being asked for the system fallback font.
if (fontData) {
if (m_level == 1) {
// Children of the root hold pure pages. These will cover only one
// font data's glyphs, and will have glyph index 0 if the font data does not
// contain the glyph.
unsigned start = pageNumber * GlyphPage::size;
UChar buffer[GlyphPage::size * 2 + 2];
unsigned bufferLength;
unsigned i;
// Fill in a buffer with the entire "page" of characters that we want to look up glyphs for.
if (start < 0x10000) {
bufferLength = GlyphPage::size;
for (i = 0; i < GlyphPage::size; i++)
buffer[i] = start + i;
if (start == 0) {
// Control characters must not render at all.
for (i = 0; i < 0x20; ++i)
buffer[i] = zeroWidthSpace;
for (i = 0x7F; i < 0xA0; i++)
buffer[i] = zeroWidthSpace;
// \n, \t, and nonbreaking space must render as a space.
buffer[(int)'\n'] = ' ';
buffer[(int)'\t'] = ' ';
buffer[noBreakSpace] = ' ';
} else if (start == (leftToRightMark & ~(GlyphPage::size - 1))) {
// LRM, RLM, LRE, RLE and PDF must not render at all.
buffer[leftToRightMark - start] = zeroWidthSpace;
buffer[rightToLeftMark - start] = zeroWidthSpace;
buffer[leftToRightEmbed - start] = zeroWidthSpace;
buffer[rightToLeftEmbed - start] = zeroWidthSpace;
buffer[leftToRightOverride - start] = zeroWidthSpace;
buffer[rightToLeftOverride - start] = zeroWidthSpace;
buffer[popDirectionalFormatting - start] = zeroWidthSpace;
} else if (start == (objectReplacementCharacter & ~(GlyphPage::size - 1))) {
// Object replacement character must not render at all.
buffer[objectReplacementCharacter - start] = zeroWidthSpace;
}
} else {
bufferLength = GlyphPage::size * 2;
for (i = 0; i < GlyphPage::size; i++) {
int c = i + start;
buffer[i * 2] = U16_LEAD(c);
buffer[i * 2 + 1] = U16_TRAIL(c);
}
}
m_page = GlyphPage::create(this);
// Now that we have a buffer full of characters, we want to get back an array
// of glyph indices. This part involves calling into the platform-specific
// routine of our glyph map for actually filling in the page with the glyphs.
// Success is not guaranteed. For example, Times fails to fill page 260, giving glyph data
// for only 128 out of 256 characters.
bool haveGlyphs;
if (fontData->isSegmented()) {
haveGlyphs = false;
const SegmentedFontData* segmentedFontData = static_cast<const SegmentedFontData*>(fontData);
unsigned numRanges = segmentedFontData->numRanges();
bool zeroFilled = false;
RefPtr<GlyphPage> scratchPage;
GlyphPage* pageToFill = m_page.get();
for (unsigned i = 0; i < numRanges; i++) {
const FontDataRange& range = segmentedFontData->rangeAt(i);
int from = max(0, range.from() - static_cast<int>(start));
int to = 1 + min(range.to() - static_cast<int>(start), static_cast<int>(GlyphPage::size) - 1);
if (from < static_cast<int>(GlyphPage::size) && to > 0) {
if (haveGlyphs && !scratchPage) {
scratchPage = GlyphPage::create(this);
pageToFill = scratchPage.get();
}
if (!zeroFilled) {
if (from > 0 || to < static_cast<int>(GlyphPage::size)) {
for (unsigned i = 0; i < GlyphPage::size; i++)
pageToFill->setGlyphDataForIndex(i, 0, 0);
}
zeroFilled = true;
}
haveGlyphs |= pageToFill->fill(from, to - from, buffer + from * (start < 0x10000 ? 1 : 2), (to - from) * (start < 0x10000 ? 1 : 2), range.fontData());
if (scratchPage) {
for (int j = from; j < to; j++) {
if (!m_page->m_glyphs[j].glyph && pageToFill->m_glyphs[j].glyph)
m_page->m_glyphs[j] = pageToFill->m_glyphs[j];
//.........这里部分代码省略.........