2 * This file is part of the html renderer for KDE.
4 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
5 * (C) 1999 Antti Koivisto (koivisto@kde.org)
6 * (C) 2000 Dirk Mueller (mueller@kde.org)
7 * Copyright (C) 2003, 2006 Apple Computer, Inc.
9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Library General Public
11 * License as published by the Free Software Foundation; either
12 * version 2 of the License, or (at your option) any later version.
14 * This library is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * Library General Public License for more details.
19 * You should have received a copy of the GNU Library General Public License
20 * along with this library; see the file COPYING.LIB. If not, write to
21 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
22 * Boston, MA 02110-1301, USA.
29 #include "CharacterNames.h"
30 #include "FloatRect.h"
31 #include "FontCache.h"
32 #include "FontFallbackList.h"
34 #include "GlyphBuffer.h"
35 #include "FontStyle.h"
36 #include <wtf/unicode/Unicode.h>
37 #include <wtf/MathExtras.h>
40 #include <unicode/unorm.h>
44 using namespace Unicode;
48 // According to http://www.unicode.org/Public/UNIDATA/UCD.html#Canonical_Combining_Class_Values
49 const uint8_t hiraganaKatakanaVoicingMarksCombiningClass = 8;
51 const uint8_t Font::gRoundingHackCharacterTable[256] = {
52 0, 0, 0, 0, 0, 0, 0, 0, 0, 1 /*\t*/, 1 /*\n*/, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
53 1 /*space*/, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1 /*-*/, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1 /*?*/,
54 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
55 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
56 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
57 1 /*no-break space*/, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
58 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
59 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
62 Font::CodePath Font::codePath = Auto;
64 struct WidthIterator {
65 WidthIterator(const Font* font, const TextRun& run, const FontStyle& style);
67 void advance(int to, GlyphBuffer* glyphBuffer = 0);
68 bool advanceOneCharacter(float& width, GlyphBuffer* glyphBuffer = 0);
75 const FontStyle& m_style;
77 unsigned m_currentCharacter;
78 float m_runWidthSoFar;
81 float m_finalRoundingWidth;
84 UChar32 normalizeVoicingMarks(int currentCharacter);
87 WidthIterator::WidthIterator(const Font* font, const TextRun& run, const FontStyle& style)
92 , m_currentCharacter(0)
94 , m_finalRoundingWidth(0)
96 // If the padding is non-zero, count the number of spaces in the run
97 // and divide that by the padding for per space addition.
98 m_padding = m_style.padding();
103 for (int i = 0; i < run.length(); i++)
104 if (Font::treatAsSpace(m_run[i]))
110 m_padPerSpace = ceilf(m_style.padding() / numSpaces);
114 void WidthIterator::advance(int offset, GlyphBuffer* glyphBuffer)
119 int currentCharacter = m_currentCharacter;
120 const UChar* cp = m_run.data(currentCharacter);
122 bool rtl = m_style.rtl();
123 bool hasExtraSpacing = m_font->letterSpacing() || m_font->wordSpacing() || m_padding;
125 float runWidthSoFar = m_runWidthSoFar;
126 float lastRoundingWidth = m_finalRoundingWidth;
128 while (currentCharacter < offset) {
130 unsigned clusterLength = 1;
133 // Deal with Hiragana and Katakana voiced and semi-voiced syllables.
134 // Normalize into composed form, and then look for glyph with base + combined mark.
135 // Check above for character range to minimize performance impact.
136 UChar32 normalized = normalizeVoicingMarks(currentCharacter);
141 } else if (U16_IS_SURROGATE(c)) {
142 if (!U16_IS_SURROGATE_LEAD(c))
145 // Do we have a surrogate pair? If so, determine the full Unicode (32 bit)
146 // code point before glyph lookup.
147 // Make sure we have another character and it's a low surrogate.
148 if (currentCharacter + 1 >= m_run.length())
151 if (!U16_IS_TRAIL(low))
153 c = U16_GET_SUPPLEMENTARY(c, low);
158 const GlyphData& glyphData = m_font->glyphDataForCharacter(c, rtl);
159 Glyph glyph = glyphData.glyph;
160 const FontData* fontData = glyphData.fontData;
164 // Now that we have a glyph and font data, get its width.
166 if (c == '\t' && m_style.allowTabs()) {
167 float tabWidth = m_font->tabWidth();
168 width = tabWidth - fmodf(m_style.xPos() + runWidthSoFar, tabWidth);
170 width = fontData->widthForGlyph(glyph);
171 // We special case spaces in two ways when applying word rounding.
172 // First, we round spaces to an adjusted width in all fonts.
173 // Second, in fixed-pitch fonts we ensure that all characters that
174 // match the width of the space character have the same width as the space character.
175 if (width == fontData->m_spaceWidth && (fontData->m_treatAsFixedPitch || glyph == fontData->m_spaceGlyph) && m_style.applyWordRounding())
176 width = fontData->m_adjustedSpaceWidth;
179 if (hasExtraSpacing && !m_style.spacingDisabled()) {
180 // Account for letter-spacing.
181 if (width && m_font->letterSpacing())
182 width += m_font->letterSpacing();
184 if (Font::treatAsSpace(c)) {
185 // Account for padding. WebCore uses space padding to justify text.
186 // We distribute the specified padding over the available spaces in the run.
188 // Use left over padding if not evenly divisible by number of spaces.
189 if (m_padding < m_padPerSpace) {
193 width += m_padPerSpace;
194 m_padding -= m_padPerSpace;
198 // Account for word spacing.
199 // We apply additional space between "words" by adding width to the space character.
200 if (currentCharacter != 0 && !Font::treatAsSpace(cp[-1]) && m_font->wordSpacing())
201 width += m_font->wordSpacing();
205 // Advance past the character we just dealt with.
207 currentCharacter += clusterLength;
209 // Account for float/integer impedance mismatch between CG and KHTML. "Words" (characters
210 // followed by a character defined by isRoundingHackCharacter()) are always an integer width.
211 // We adjust the width of the last character of a "word" to ensure an integer width.
212 // If we move KHTML to floats we can remove this (and related) hacks.
214 float oldWidth = width;
216 // Force characters that are used to determine word boundaries for the rounding hack
217 // to be integer width, so following words will start on an integer boundary.
218 if (m_style.applyWordRounding() && Font::isRoundingHackCharacter(c))
219 width = ceilf(width);
221 // Check to see if the next character is a "rounding hack character", if so, adjust
222 // width so that the total run width will be on an integer boundary.
223 if ((m_style.applyWordRounding() && currentCharacter < m_run.length() && Font::isRoundingHackCharacter(*cp))
224 || (m_style.applyRunRounding() && currentCharacter >= m_end)) {
225 float totalWidth = runWidthSoFar + width;
226 width += ceilf(totalWidth) - totalWidth;
229 runWidthSoFar += width;
232 glyphBuffer->add(glyph, fontData, (rtl ? oldWidth + lastRoundingWidth : width));
234 lastRoundingWidth = width - oldWidth;
237 m_currentCharacter = currentCharacter;
238 m_runWidthSoFar = runWidthSoFar;
239 m_finalRoundingWidth = lastRoundingWidth;
242 bool WidthIterator::advanceOneCharacter(float& width, GlyphBuffer* glyphBuffer)
244 glyphBuffer->clear();
245 advance(m_currentCharacter + 1, glyphBuffer);
247 for (int i = 0; i < glyphBuffer->size(); ++i)
248 w += glyphBuffer->advanceAt(i);
250 return !glyphBuffer->isEmpty();
253 UChar32 WidthIterator::normalizeVoicingMarks(int currentCharacter)
255 if (currentCharacter + 1 < m_end) {
256 if (combiningClass(m_run[currentCharacter + 1]) == hiraganaKatakanaVoicingMarksCombiningClass) {
258 // Normalize into composed form using 3.2 rules.
259 UChar normalizedCharacters[2] = { 0, 0 };
260 UErrorCode uStatus = U_ZERO_ERROR;
261 int32_t resultLength = unorm_normalize(m_run.data(currentCharacter), 2,
262 UNORM_NFC, UNORM_UNICODE_3_2, &normalizedCharacters[0], 2, &uStatus);
263 if (resultLength == 1 && uStatus == 0)
264 return normalizedCharacters[0];
265 #elif USE(QT4_UNICODE)
266 QString tmp(reinterpret_cast<const QChar*>(m_run.data(currentCharacter)), 2);
267 QString res = tmp.normalized(QString::NormalizationForm_C, QChar::Unicode_3_2);
268 if (res.length() == 1)
269 return res.at(0).unicode();
276 // ============================================================================================
277 // Font Implementation (Cross-Platform Portion)
278 // ============================================================================================
284 , m_isPlatformFont(false)
288 Font::Font(const FontDescription& fd, short letterSpacing, short wordSpacing)
289 : m_fontDescription(fd)
291 , m_letterSpacing(letterSpacing)
292 , m_wordSpacing(wordSpacing)
293 , m_isPlatformFont(false)
297 Font::Font(const FontPlatformData& fontData, bool isPrinterFont)
298 : m_fontList(new FontFallbackList)
302 , m_isPlatformFont(true)
304 m_fontDescription.setUsePrinterFont(isPrinterFont);
305 m_fontList->setPlatformFont(fontData);
308 Font::Font(const Font& other)
309 : m_fontDescription(other.m_fontDescription)
310 , m_fontList(other.m_fontList)
311 , m_pages(other.m_pages)
312 , m_pageZero(other.m_pageZero)
313 , m_letterSpacing(other.m_letterSpacing)
314 , m_wordSpacing(other.m_wordSpacing)
315 , m_isPlatformFont(other.m_isPlatformFont)
319 Font& Font::operator=(const Font& other)
321 m_fontDescription = other.m_fontDescription;
322 m_fontList = other.m_fontList;
323 m_pages = other.m_pages;
324 m_pageZero = other.m_pageZero;
325 m_letterSpacing = other.m_letterSpacing;
326 m_wordSpacing = other.m_wordSpacing;
327 m_isPlatformFont = other.m_isPlatformFont;
335 bool Font::operator==(const Font& other) const
337 // Our FontData don't have to be checked, since checking the font description will be fine.
338 // FIXME: This does not work if the font was made with the FontPlatformData constructor.
339 if ((m_fontList && m_fontList->loadingCustomFonts()) ||
340 (other.m_fontList && other.m_fontList->loadingCustomFonts()))
343 FontSelector* first = m_fontList ? m_fontList->fontSelector() : 0;
344 FontSelector* second = other.m_fontList ? other.m_fontList->fontSelector() : 0;
346 return first == second
347 && m_fontDescription == other.m_fontDescription
348 && m_letterSpacing == other.m_letterSpacing
349 && m_wordSpacing == other.m_wordSpacing;
352 // FIXME: It is unfortunate that this function needs to be passed the original cluster.
353 // It is only required for the platform's FontCache::getFontDataForCharacters(), and it means
354 // that this function is not correct if it transforms the character to uppercase and calls
355 // FontCache::getFontDataForCharacters() afterwards.
356 const GlyphData& Font::glyphDataForCharacter(UChar32 c, bool mirror) const
358 bool useSmallCapsFont = false;
359 if (m_fontDescription.smallCaps()) {
360 UChar32 upperC = Unicode::toUpper(c);
363 useSmallCapsFont = true;
370 unsigned pageNumber = (c / GlyphPage::size);
372 GlyphPageTreeNode* node = pageNumber ? m_pages.get(pageNumber) : m_pageZero;
374 node = GlyphPageTreeNode::getRootChild(primaryFont(), pageNumber);
376 m_pages.set(pageNumber, node);
382 if (!useSmallCapsFont) {
383 // Fastest loop, for the common case (not small caps).
387 const GlyphData& data = page->glyphDataForCharacter(c);
390 if (node->isSystemFallback())
394 // Proceed with the fallback list.
395 node = node->getChild(fontDataAt(node->level()), pageNumber);
397 m_pages.set(pageNumber, node);
405 const GlyphData& data = page->glyphDataForCharacter(c);
407 // The smallCapsFontData function should not normally return 0.
408 // But if it does, we will just render the capital letter big.
409 const FontData* smallCapsFontData = data.fontData->smallCapsFontData(m_fontDescription);
410 if (!smallCapsFontData)
413 GlyphPageTreeNode* smallCapsNode = GlyphPageTreeNode::getRootChild(smallCapsFontData, pageNumber);
414 const GlyphData& data = smallCapsNode->page()->glyphDataForCharacter(c);
418 // Do not attempt system fallback off the smallCapsFontData. This is the very unlikely case that
419 // a font has the lowercase character but the small caps font does not have its uppercase version.
420 return smallCapsFontData->missingGlyphData();
423 if (node->isSystemFallback())
427 // Proceed with the fallback list.
428 node = node->getChild(fontDataAt(node->level()), pageNumber);
430 m_pages.set(pageNumber, node);
437 ASSERT(node->isSystemFallback());
439 // System fallback is character-dependent. When we get here, we
440 // know that the character in question isn't in the system fallback
441 // font's glyph page. Try to lazily create it here.
446 if (Font::treatAsSpace(c16))
448 else if (Font::treatAsZeroWidthSpace(c16))
449 codeUnits[0] = zeroWidthSpace;
454 codeUnits[0] = U16_LEAD(c);
455 codeUnits[1] = U16_TRAIL(c);
458 const FontData* characterFontData = FontCache::getFontDataForCharacters(*this, codeUnits, codeUnitsLength);
459 if (useSmallCapsFont)
460 characterFontData = characterFontData->smallCapsFontData(m_fontDescription);
461 if (characterFontData) {
462 // Got the fallback glyph and font.
463 GlyphPage* fallbackPage = GlyphPageTreeNode::getRootChild(characterFontData, pageNumber)->page();
464 const GlyphData& data = fallbackPage && fallbackPage->glyphDataForCharacter(c).fontData ? fallbackPage->glyphDataForCharacter(c) : characterFontData->missingGlyphData();
465 // Cache it so we don't have to do system fallback again next time.
466 if (!useSmallCapsFont)
467 page->setGlyphDataForCharacter(c, data.glyph, data.fontData);
471 // Even system fallback can fail; use the missing glyph in that case.
472 // FIXME: It would be nicer to use the missing glyph from the last resort font instead.
473 const GlyphData& data = primaryFont()->missingGlyphData();
474 if (!useSmallCapsFont)
475 page->setGlyphDataForCharacter(c, data.glyph, data.fontData);
479 const FontData* Font::primaryFont() const
482 return m_fontList->primaryFont(this);
485 const FontData* Font::fontDataAt(unsigned index) const
488 return m_fontList->fontDataAt(this, index);
491 const FontData* Font::fontDataForCharacters(const UChar* characters, int length) const
494 return m_fontList->fontDataForCharacters(this, characters, length);
497 void Font::update(PassRefPtr<FontSelector> fontSelector) const
499 // FIXME: It is pretty crazy that we are willing to just poke into a RefPtr, but it ends up
500 // being reasonably safe (because inherited fonts in the render tree pick up the new
501 // style anyway. Other copies are transient, e.g., the state in the GraphicsContext, and
502 // won't stick around long enough to get you in trouble). Still, this is pretty disgusting,
503 // and could eventually be rectified by using RefPtrs for Fonts themselves.
505 m_fontList = new FontFallbackList();
506 m_fontList->invalidate(fontSelector);
511 int Font::width(const TextRun& run) const
513 return width(run, FontStyle());
516 int Font::width(const TextRun& run, const FontStyle& style) const
518 return lroundf(floatWidth(run, style));
521 int Font::ascent() const
523 return primaryFont()->ascent();
526 int Font::descent() const
528 return primaryFont()->descent();
531 int Font::lineSpacing() const
533 return primaryFont()->lineSpacing();
536 float Font::xHeight() const
538 return primaryFont()->xHeight();
541 unsigned Font::unitsPerEm() const
543 return primaryFont()->unitsPerEm();
546 int Font::spaceWidth() const
548 return (int)ceilf(primaryFont()->m_adjustedSpaceWidth + m_letterSpacing);
551 bool Font::isFixedPitch() const
554 return m_fontList->isFixedPitch(this);
557 void Font::setCodePath(CodePath p)
562 bool Font::canUseGlyphCache(const TextRun& run) const
573 // Start from 0 since drawing and highlighting also measure the characters before run->from
574 for (int i = 0; i < run.length(); i++) {
575 const UChar c = run[i];
576 if (c < 0x300) // U+0300 through U+036F Combining diacritical marks
581 if (c < 0x0591 || c == 0x05BE) // U+0591 through U+05CF excluding U+05BE Hebrew combining marks, Hebrew punctuation Paseq, Sof Pasuq and Nun Hafukha
586 if (c < 0x0600) // U+0600 through U+1059 Arabic, Syriac, Thaana, Devanagari, Bengali, Gurmukhi, Gujarati, Oriya, Tamil, Telugu, Kannada, Malayalam, Sinhala, Thai, Lao, Tibetan, Myanmar
591 if (c < 0x1100) // U+1100 through U+11FF Hangul Jamo (only Ancient Korean should be left here if you precompose; Modern Korean will be precomposed as a result of step A)
596 if (c < 0x1780) // U+1780 through U+18AF Khmer, Mongolian
601 if (c < 0x1900) // U+1900 through U+194F Limbu (Unicode 4.0)
606 if (c < 0x20D0) // U+20D0 through U+20FF Combining marks for symbols
611 if (c < 0xFE20) // U+FE20 through U+FE2F Combining half marks
621 void Font::drawSimpleText(GraphicsContext* context, const TextRun& run, const FontStyle& style, const FloatPoint& point, int from, int to) const
623 // This glyph buffer holds our glyphs+advances+font data for each glyph.
624 GlyphBuffer glyphBuffer;
626 float startX = point.x();
627 WidthIterator it(this, run, style);
629 float beforeWidth = it.m_runWidthSoFar;
630 it.advance(to, &glyphBuffer);
632 // We couldn't generate any glyphs for the run. Give up.
633 if (glyphBuffer.isEmpty())
636 float afterWidth = it.m_runWidthSoFar;
639 float finalRoundingWidth = it.m_finalRoundingWidth;
640 it.advance(run.length());
641 startX += finalRoundingWidth + it.m_runWidthSoFar - afterWidth;
643 startX += beforeWidth;
645 // Swap the order of the glyphs if right-to-left.
647 for (int i = 0, end = glyphBuffer.size() - 1; i < glyphBuffer.size() / 2; ++i, --end)
648 glyphBuffer.swap(i, end);
650 // Calculate the starting point of the glyphs to be displayed by adding
651 // all the advances up to the first glyph.
652 FloatPoint startPoint(startX, point.y());
653 drawGlyphBuffer(context, glyphBuffer, run, style, startPoint);
656 void Font::drawGlyphBuffer(GraphicsContext* context, const GlyphBuffer& glyphBuffer,
657 const TextRun& run, const FontStyle& style, const FloatPoint& point) const
659 // Draw each contiguous run of glyphs that use the same font data.
660 const FontData* fontData = glyphBuffer.fontDataAt(0);
661 FloatSize offset = glyphBuffer.offsetAt(0);
662 FloatPoint startPoint(point);
663 float nextX = startPoint.x();
666 while (nextGlyph < glyphBuffer.size()) {
667 const FontData* nextFontData = glyphBuffer.fontDataAt(nextGlyph);
668 FloatSize nextOffset = glyphBuffer.offsetAt(nextGlyph);
669 if (nextFontData != fontData || nextOffset != offset) {
670 drawGlyphs(context, fontData, glyphBuffer, lastFrom, nextGlyph - lastFrom, startPoint);
671 lastFrom = nextGlyph;
672 fontData = nextFontData;
674 startPoint.setX(nextX);
676 nextX += glyphBuffer.advanceAt(nextGlyph);
679 drawGlyphs(context, fontData, glyphBuffer, lastFrom, nextGlyph - lastFrom, startPoint);
682 void Font::drawText(GraphicsContext* context, const TextRun& run, const FontStyle& style, const FloatPoint& point, int from, int to) const
684 // Don't draw anything while we are using custom fonts that are in the process of loading.
685 if (m_fontList && m_fontList->loadingCustomFonts())
688 to = (to == -1 ? run.length() : to);
689 if (canUseGlyphCache(run))
690 drawSimpleText(context, run, style, point, from, to);
692 drawComplexText(context, run, style, point, from, to);
695 float Font::floatWidth(const TextRun& run, const FontStyle& style) const
697 if (canUseGlyphCache(run))
698 return floatWidthForSimpleText(run, style, 0);
699 return floatWidthForComplexText(run, style);
702 float Font::floatWidthForSimpleText(const TextRun& run, const FontStyle& style, GlyphBuffer* glyphBuffer) const
704 WidthIterator it(this, run, style);
705 it.advance(run.length(), glyphBuffer);
706 return it.m_runWidthSoFar;
709 FloatRect Font::selectionRectForText(const TextRun& run, const FontStyle& style, const IntPoint& point, int h, int from, int to) const
711 to = (to == -1 ? run.length() : to);
712 if (canUseGlyphCache(run))
713 return selectionRectForSimpleText(run, style, point, h, from, to);
714 return selectionRectForComplexText(run, style, point, h, from, to);
717 FloatRect Font::selectionRectForSimpleText(const TextRun& run, const FontStyle& style, const IntPoint& point, int h, int from, int to) const
719 WidthIterator it(this, run, style);
721 float beforeWidth = it.m_runWidthSoFar;
723 float afterWidth = it.m_runWidthSoFar;
725 // Using roundf() rather than ceilf() for the right edge as a compromise to ensure correct caret positioning
727 it.advance(run.length());
728 float totalWidth = it.m_runWidthSoFar;
729 return FloatRect(point.x() + floorf(totalWidth - afterWidth), point.y(), roundf(totalWidth - beforeWidth) - floorf(totalWidth - afterWidth), h);
731 return FloatRect(point.x() + floorf(beforeWidth), point.y(), roundf(afterWidth) - floorf(beforeWidth), h);
735 int Font::offsetForPosition(const TextRun& run, const FontStyle& style, int x, bool includePartialGlyphs) const
737 if (canUseGlyphCache(run))
738 return offsetForPositionForSimpleText(run, style, x, includePartialGlyphs);
739 return offsetForPositionForComplexText(run, style, x, includePartialGlyphs);
742 int Font::offsetForPositionForSimpleText(const TextRun& run, const FontStyle& style, int x, bool includePartialGlyphs) const
744 float delta = (float)x;
746 WidthIterator it(this, run, style);
747 GlyphBuffer localGlyphBuffer;
750 delta -= floatWidthForSimpleText(run, style, 0);
752 offset = it.m_currentCharacter;
754 if (!it.advanceOneCharacter(w, &localGlyphBuffer))
757 if (includePartialGlyphs) {
758 if (delta - w / 2 >= 0)
767 offset = it.m_currentCharacter;
769 if (!it.advanceOneCharacter(w, &localGlyphBuffer))
772 if (includePartialGlyphs) {
773 if (delta + w / 2 <= 0)