5#include <private/qfontengine_p.h>
6#include <private/qfontengineglyphcache_p.h>
7#include <private/qguiapplication_p.h>
9#include <qpa/qplatformfontdatabase.h>
10#include <qpa/qplatformintegration.h>
19#include <private/qstringiterator_p.h>
21#if QT_CONFIG(harfbuzz)
41 return a.m11() ==
b.m11()
44 &&
a.m22() ==
b.m22();
76#ifdef QT_BUILD_INTERNAL
78static QList<QFontEngine *> *enginesCollector =
nullptr;
82 delete enginesCollector;
83 enginesCollector =
new QList<QFontEngine *>();
89 QList<QFontEngine *>
ret = *enginesCollector;
90 delete enginesCollector;
91 enginesCollector =
nullptr;
99#define kBearingNotInitialized std::numeric_limits<qreal>::max()
105 m_heightMetricsQueried(
false),
120#ifdef QT_BUILD_INTERNAL
121 if (enginesCollector)
122 enginesCollector->append(
this);
128#ifdef QT_BUILD_INTERNAL
129 if (enginesCollector)
130 enginesCollector->removeOne(
this);
138 int lw = score / 700;
141 if (lw < 2 && score >= 1050) lw = 2;
155#if QT_CONFIG(harfbuzz)
165#if QT_CONFIG(harfbuzz)
183#if QT_CONFIG(harfbuzz)
185 uint lenMort = 0, lenMorx = 0;
192 unsigned int script_count = HB_OT_MAX_TAGS_PER_SCRIPT;
193 hb_tag_t script_tags[HB_OT_MAX_TAGS_PER_SCRIPT];
196 &script_count, script_tags,
199 if (hb_ot_layout_table_select_script(
face, HB_OT_TAG_GSUB, script_count, script_tags,
nullptr,
nullptr))
209 while (
it.hasNext()) {
259 QVarLengthArray<glyph_t> &glyphs_out, QVarLengthArray<QFixedPoint> &
positions)
276 int totalKashidas = 0;
284 glyphs_out.resize(glyphs.
numGlyphs+totalKashidas);
297 QPointF gpos(gpos_x.toReal(), gpos_y.toReal());
304 glyphs_out[current] = glyphs.
glyphs[
i];
314 g.glyphs = &kashidaGlyph;
315 g.advances = &kashidaWidth;
319 xpos -= kashidaWidth;
324 QPointF gpos(gpos_x.toReal(), gpos_y.toReal());
331 glyphs_out[current] = kashidaGlyph;
348 glyphs_out[current] = glyphs.
glyphs[
i];
359 QPointF gpos(gpos_x.toReal(), gpos_y.toReal());
363 glyphs_out[current] = glyphs.
glyphs[
i];
372 glyphs_out.resize(current);
379 if (leftBearing !=
nullptr)
380 *leftBearing = gi.leftBearing().toReal();
381 if (rightBearing !=
nullptr)
382 *rightBearing = gi.rightBearing().toReal();
388 if (hhea.
size() >= 10) {
412 bool hasEmbeddedBitmaps =
416 if (!hasEmbeddedBitmaps) {
441 if (os2.size() >= 78) {
442 auto ptr = os2.constData();
443 quint16 fsSelection = qFromBigEndian<quint16>(
ptr + 62);
444 qint16 typoAscent = qFromBigEndian<qint16>(
ptr + 68);
445 qint16 typoDescent = qFromBigEndian<qint16>(
ptr + 70);
446 qint16 typoLineGap = qFromBigEndian<qint16>(
ptr + 72);
447 quint16 winAscent = qFromBigEndian<quint16>(
ptr + 74);
448 quint16 winDescent = qFromBigEndian<quint16>(
ptr + 76);
450 enum { USE_TYPO_METRICS = 0x80 };
454 if (typoAscent == 0 && typoDescent == 0)
461 if (winAscent == 0 && winDescent == 0)
503 return m_minLeftBearing;
506#define q16Dot16ToFloat(i) ((i) / 65536.0)
508#define kMinLeftSideBearingOffset 12
509#define kMinRightSideBearingOffset 14
518 const uchar *tableData =
reinterpret_cast<const uchar *
>(hheaTable.constData());
534 static const int largestValidBearing = 4 * unitsPerEm;
536 if (
qAbs(minLeftSideBearing) < largestValidBearing)
537 m_minLeftBearing = minLeftSideBearing * funitToPixelFactor;
538 if (
qAbs(minRightSideBearing) < largestValidBearing)
539 m_minRightBearing = minRightSideBearing * funitToPixelFactor;
548 static const ushort characterSubset[] = {
549 '(',
'C',
'F',
'K',
'V',
'X',
'Y',
']',
'_',
'f',
'r',
'|',
550 127, 205, 645, 884, 922, 1070, 12386
554 m_minLeftBearing = m_minRightBearing = std::numeric_limits<qreal>::max();
556 for (
uint i = 0;
i < (
sizeof(characterSubset) /
sizeof(
ushort)); ++
i) {
573 qWarning() <<
"Failed to compute left/right minimum bearings for"
577 return m_minRightBearing;
603 overall.x =
qMin(overall.x,
x);
604 overall.y =
qMin(overall.y,
y);
608 overall.yoff += bb.yoff;
610 overall.height =
qMax(overall.height, ymax - overall.y);
611 overall.width = xmax - overall.x;
618 QTextItem::RenderFlags
flags)
624 QVarLengthArray<glyph_t> positioned_glyphs;
630#define GRID(x, y) grid[(y)*(w+1) + (x)]
631#define SET(x, y) (*(image_data + (y)*bpl + ((x) >> 3)) & (0x80 >> ((x) & 7)))
682 path->closeSubpath();
689 for (
int y = 0;
y <=
h; ++
y) {
690 for (
int x = 0;
x <=
w; ++
x) {
691 bool topLeft = (
x == 0 ||
y == 0) ?
false :
SET(
x - 1,
y - 1);
692 bool topRight = (
x ==
w ||
y == 0) ?
false :
SET(
x,
y - 1);
693 bool bottomLeft = (
x == 0 ||
y ==
h) ?
false :
SET(
x - 1,
y);
694 bool bottomRight = (
x ==
w ||
y ==
h) ?
false :
SET(
x,
y);
697 if ((!topRight) & bottomRight)
699 if ((!bottomRight) & bottomLeft)
701 if ((!bottomLeft) & topLeft)
703 if ((!topLeft) & topRight)
709 for (
int y = 0;
y <
h; ++
y) {
710 for (
int x = 0;
x <
w; ++
x) {
739 const int w = alphaMask.
width();
740 const int h = alphaMask.
height();
743 if (alphaMask.
depth() == 1) {
751 for (
int yi = 0; yi <
h; ++yi) {
753 uchar *
dst = bitmapData + yi*destBpl;
754 for (
int xi = 0; xi <
w; ++xi) {
755 const int byte = xi / 8;
756 const int bit = xi % 8;
760 dst[byte] |= 128 >> bit;
780 for (
int i = 0;
i < nGlyphs - 1; ++
i) {
781 g.glyphs[
i] = glyphs[
i];
784 g.glyphs[nGlyphs - 1] = glyphs[nGlyphs - 1];
824 for (
int y=0;
y<alphaMask.
height(); ++
y) {
827 for (
int x=0;
x<alphaMask.
width(); ++
x) {
874 int glyph_x =
qFloor(gm.x.toReal());
875 int glyph_y =
qFloor(gm.y.toReal());
876 int glyph_width =
qCeil((gm.x + gm.width).toReal()) - glyph_x;
877 int glyph_height =
qCeil((gm.y + gm.height).toReal()) - glyph_y;
879 if (glyph_width <= 0 || glyph_height <= 0)
921 p.emSquare =
p.ascent;
924 p.capHeight =
p.ascent;
971 m_glyphCaches.
remove(context);
978 GlyphCaches &
caches = m_glyphCaches[context];
980 if (
cache == e.cache.data())
989 GlyphCacheEntry
entry;
1004 for (
auto &e : *
caches) {
1024 if (pairs[middle].left_right == left_right)
1025 return pairs[middle].
adjust;
1027 if (pairs[middle].left_right < left_right)
1078 for(
int i = 0;
i < numTables; ++
i) {
1094 if (version == 0 && coverage == 0x0001) {
1105 if (nPairs * 6 + 8 >
length - 6) {
1112 for(
int i = 0;
i < nPairs; ++
i) {
1123 p.left_right |= tmp;
1128 p.adjust =
QFixed(
int(
short(tmp))) / scalingFactor;
1146 if (maxpTable.size() < 6)
1149 const uchar *
source =
reinterpret_cast<const uchar *
>(maxpTable.constData() + 4);
1185 MicrosoftUnicodeExtended
1188 int symbolTable = -1;
1189 int tableToUse = -1;
1191 for (
int n = 0;
n < numTables; ++
n) {
1196 quint16 platformSpecificId = 0;
1200 switch (platformId) {
1202 if (score < Unicode &&
1203 (platformSpecificId == 0 ||
1204 platformSpecificId == 2 ||
1205 platformSpecificId == 3)) {
1208 }
else if (score < Unicode11 && platformSpecificId == 1) {
1214 if (score < AppleRoman && platformSpecificId == 0) {
1220 switch (platformSpecificId) {
1229 if (score < MicrosoftUnicode) {
1231 score = MicrosoftUnicode;
1235 if (score < MicrosoftUnicodeExtended) {
1237 score = MicrosoftUnicodeExtended;
1252 *isSymbolFont = (symbolTable > -1);
1286 if (symbolTable > -1 && ((score == Unicode) || (score == Unicode11))) {
1287 const uchar *selectedTable =
table + unicode_table;
1290 bool unicodeTableHasLatin1 =
false;
1291 for (
int uc=0x00; uc<0x100; ++uc) {
1293 unicodeTableHasLatin1 =
true;
1299 bool unicodeTableHasSymbols =
false;
1300 if (!unicodeTableHasLatin1) {
1301 for (
int uc=0xf000; uc<0xf100; ++uc) {
1303 unicodeTableHasSymbols =
true;
1310 if (!unicodeTableHasLatin1 && unicodeTableHasSymbols) {
1311 tableToUse = symbolTable;
1317 return table + unicode_table;
1322 const uchar *
end = cmap + cmapSize;
1328 const uchar *
ptr = cmap + 6 + unicode;
1329 if (unicode < 256 &&
ptr <
end)
1331 }
else if (
format == 4) {
1337 if (unicode >= 0xffff)
1344 const unsigned char *ends = cmap + 14;
1347 for (;
i < segCountX2/2; ++
i) {
1351 if (codePoint >= unicode)
1355 const unsigned char *idx = ends + segCountX2 + 2 + 2*
i;
1360 if (startIndex > unicode)
1377 if (idRangeoffset_t) {
1390 }
else if (
format == 6) {
1398 if (unicode < firstCode6)
1404 if (entryCount6 * 2 + 10 > tableSize)
1407 quint16 sentinel6 = firstCode6 + entryCount6;
1408 if (unicode >= sentinel6)
1411 quint16 entryIndex6 = unicode - firstCode6;
1416 }
else if (
format == 12) {
1431 if (unicode < startCharCode)
1438 if (unicode <= endCharCode) {
1443 return index + unicode - startCharCode;
1449 qDebug(
"cmap table of format %d not implemented",
format);
1486 if (gi.isValid() && gi.width > 0)
1487 return gi.leftBearing();
1498 return gi.rightBearing();
1504QFontEngine::GlyphCacheEntry::GlyphCacheEntry()
1508QFontEngine::GlyphCacheEntry::GlyphCacheEntry(
const GlyphCacheEntry &
o)
1513QFontEngine::GlyphCacheEntry::~GlyphCacheEntry()
1517QFontEngine::GlyphCacheEntry &QFontEngine::GlyphCacheEntry::operator=(
const GlyphCacheEntry &
o)
1554 if (*nglyphs <
len) {
1561 while (
it.hasNext()) {
1563 glyphs->
glyphs[ucs4Length++] = 1;
1566 *nglyphs = ucs4Length;
1587 QVarLengthArray<glyph_t> positioned_glyphs;
1591 QSize s(_size - 3, _size - 3);
1592 for (
int k = 0; k <
positions.size(); k++)
1600 overall.height = _size;
1601 overall.xoff = overall.width;
1607 if (!ti.glyphs.numGlyphs)
1611 QSize s(_size - 3, _size - 3);
1614 QVarLengthArray<glyph_t> glyphs;
1616 ti.fontEngine->getGlyphPositions(ti.glyphs,
matrix, ti.flags, glyphs,
positions);
1617 if (glyphs.size() == 0)
1627 for (
int k = 0; k <
positions.size(); k++)
1680 for (
int i=2;
i <= _size-3; ++
i) {
1682 bits[
i + (_size - 3) *
image.bytesPerLine()] = 255;
1684 bits[_size - 3 +
i *
image.bytesPerLine()] = 255;
1694{
return glyph >> 24; }
1698{
return glyph & 0x00ffffff; }
1702 m_fallbackFamilies(fallbackFamilies),
1704 m_fallbackFamiliesQueried(!m_fallbackFamilies.isEmpty())
1708 if (m_fallbackFamilies.isEmpty()) {
1710 m_fallbackFamilies <<
QString();
1713 m_engines.
resize(m_fallbackFamilies.size() + 1);
1724 for (
int i = 0;
i < m_engines.
size(); ++
i) {
1726 if (fontEngine && !fontEngine->
ref.
deref())
1741 QChar::Script(m_script)));
1746 Q_ASSERT(!m_fallbackFamiliesQueried);
1748 m_fallbackFamilies = fallbackFamilies;
1749 if (m_fallbackFamilies.isEmpty()) {
1757 m_engines.
resize(m_fallbackFamilies.size() + 1);
1760 m_fallbackFamiliesQueried =
true;
1765 if (!m_fallbackFamiliesQueried &&
at > 0)
1768 if (!m_engines.
at(
at)) {
1803 if (!m_fallbackFamiliesQueried)
1805 for (
int x = 1,
n =
qMin(m_engines.
size(), 256);
x <
n; ++
x) {
1817 glyph =
engine->glyphIndex(ucs4);
1831 QFontEngine::ShaperFlags
flags)
const
1833 const int originalNumGlyphs = glyphs->
numGlyphs;
1834 int mappedGlyphCount =
engine(0)->stringToCMap(
str,
len, glyphs, nglyphs,
flags);
1835 if (mappedGlyphCount < 0)
1841 if (contextFontMerging) {
1843 if (!m_fallbackFamiliesQueried)
1846 int maxGlyphCount = 0;
1847 uchar engineIndex = 0;
1848 for (
int x = 1,
n =
qMin(m_engines.
size(), 256);
x <
n; ++
x) {
1854 if (maxGlyphCount > mappedGlyphCount) {
1857 glyphs->
copy(&tempLayout);
1864 if (engineIndex > 0) {
1867 glyphs->
glyphs[
y] |= (engineIndex << 24);
1870 contextFontMerging =
false;
1873 mappedGlyphCount = maxGlyphCount;
1881 int lastFallback = -1;
1882 char32_t previousUcs4 = 0;
1883 while (
it.hasNext()) {
1884 const char32_t ucs4 =
it.peekNext();
1889 if (lastFallback >= 0 && (ucs4 == 0x200d || ucs4 == 0x200c)) {
1893 glyphs->
glyphs[glyph_pos] = glyph;
1900 glyphs->
glyphs[glyph_pos] |= (lastFallback << 24);
1909 if (!m_fallbackFamiliesQueried)
1911 for (
int x = contextFontMerging ? 0 : 1,
n =
qMin(m_engines.
size(), 256);
x <
n; ++
x) {
1927 glyphs->
glyphs[glyph_pos] = glyph;
1936 glyphs->
glyphs[glyph_pos] |= (
x << 24);
1944 const int variantSelectorBlock = 0xFE00;
1945 if ((ucs4 & 0xFFF0) == variantSelectorBlock && glyph_pos > 0) {
1946 int selectorFontEngine = glyphs->
glyphs[glyph_pos] >> 24;
1947 int precedingCharacterFontEngine = glyphs->
glyphs[glyph_pos - 1] >> 24;
1949 if (selectorFontEngine != precedingCharacterFontEngine) {
1955 const QFontEngine *selectedEngine = m_engines.
at(precedingCharacterFontEngine);
1956 const bool colorFont = selectedEngine->
isColorFont();
1957 const char32_t vs15 = 0xFE0E;
1958 const char32_t vs16 = 0xFE0F;
1959 bool adaptVariantSelector = ucs4 < vs15
1960 || (ucs4 == vs15 && colorFont)
1961 || (ucs4 == vs16 && !colorFont);
1963 if (adaptVariantSelector) {
1967 glyphs->
glyphs[glyph_pos - 1] = glyph;
1974 glyphs->
glyphs[glyph_pos - 1] |= (selectorFontEngine << 24);
1983 previousUcs4 = ucs4;
1986 *nglyphs = glyph_pos;
1988 return mappedGlyphCount;
2020 overall.x =
qMin(overall.x, gm.x);
2021 overall.y =
qMin(overall.y, gm.y);
2022 overall.width = overall.xoff + gm.width;
2023 overall.height =
qMax(overall.height + overall.y, gm.height + gm.y) -
2024 qMin(overall.y, gm.y);
2025 overall.xoff += gm.xoff;
2026 overall.yoff += gm.yoff;
2029 const int hi = which << 24;
2045 overall.x =
qMin(overall.x, gm.x);
2046 overall.y =
qMin(overall.y, gm.y);
2047 overall.width = overall.xoff + gm.width;
2048 overall.height =
qMax(overall.height + overall.y, gm.height + gm.y) -
2049 qMin(overall.y, gm.y);
2050 overall.xoff += gm.xoff;
2051 overall.yoff += gm.yoff;
2054 const int hi = which << 24;
2065 engine(which)->getGlyphBearings(
stripped(glyph), leftBearing, rightBearing);
2078 for (
int gl = 0; gl < glyphs.
numGlyphs; gl++)
2096 const int hi = which << 24;
2122 const int hi = which << 24;
2148 const int hi = which << 24;
2165 const int hi = which << 24;
2191 const int hi = which << 24;
2208 const int hi = which << 24;
2220{
return engine(0)->ascent(); }
2223{
return engine(0)->capHeight(); }
2226{
return engine(0)->descent(); }
2230 return engine(0)->leading();
2235 return engine(0)->xHeight();
2240 return engine(0)->averageCharWidth();
2245 return engine(0)->lineThickness();
2250 return engine(0)->underlinePosition();
2255 return engine(0)->maxCharWidth();
2260 return engine(0)->minLeftBearing();
2265 return engine(0)->minRightBearing();
2275 QVarLengthArray<glyph_t> glyphs(nglyphs);
2279 g.glyphs = glyphs.data();
2283 for (
int i = 0;
i < nglyphs;
i++) {
2303 return engine(which)->alphaMapForGlyph(
stripped(glyph), subPixelPosition);
2317 return engine(which)->alphaMapForGlyph(
stripped(glyph), subPixelPosition,
t);
2325 return engine(which)->alphaRGBMapForGlyph(
stripped(glyph), subPixelPosition,
t);
2346 const bool faceIsLocal = !fe->faceId().filename.isEmpty();
2348 end = fc->engineCache.end();
2352 if (fe == cachedEngine->engine(0) || (faceIsLocal && fe->faceId().filename == cachedEngine->engine(0)->faceId().filename)) {
2354 fc->updateHitCountAndTimeStamp(
it.value());
2361 fc->insertEngine(
key,
engine, !faceIsLocal);
qsizetype size() const noexcept
Returns the number of bytes in this byte array.
const char * constData() const noexcept
Returns a pointer to the const data stored in the byte array.
bool isEmpty() const noexcept
Returns true if the byte array has size 0; otherwise returns false.
static QByteArray number(int, int base=10)
Returns a byte-array representing the whole number n as text.
void resize(qsizetype size)
Sets the size of the byte array to size bytes.
QByteArray & replace(qsizetype index, qsizetype len, const char *s, qsizetype alen)
This is an overloaded member function, provided for convenience. It differs from the above function o...
The QColor class provides colors based on RGB, HSV or CMYK values.
static QFontCache * instance()
static QFontEngine * findFont(const QFontDef &request, int script, bool preferScriptOverFamily=false)
void draw(QPaintEngine *p, qreal x, qreal y, const QTextItemInt &si)
virtual QImage alphaMapForGlyph(glyph_t) override
virtual qreal maxCharWidth() const override
virtual QFontEngine * cloneWithSize(qreal pixelSize) const override
virtual int stringToCMap(const QChar *str, int len, QGlyphLayout *glyphs, int *nglyphs, ShaperFlags flags) const override
virtual QFixed leading() const override
virtual bool canRender(const QChar *string, int len) const override
virtual glyph_t glyphIndex(uint ucs4) const override
virtual QFixed descent() const override
virtual void recalcAdvances(QGlyphLayout *, ShaperFlags) const override
virtual glyph_metrics_t boundingBox(const QGlyphLayout &glyphs) override
virtual void addOutlineToPath(qreal x, qreal y, const QGlyphLayout &glyphs, QPainterPath *path, QTextItem::RenderFlags flags) override
virtual QFixed ascent() const override
virtual QFixed capHeight() const override
void ensureEngineAt(int at)
virtual int stringToCMap(const QChar *str, int len, QGlyphLayout *glyphs, int *nglyphs, ShaperFlags flags) const override
virtual glyph_t glyphIndex(uint ucs4) const override
virtual bool shouldLoadFontEngineForCharacter(int at, uint ucs4) const
virtual void recalcAdvances(QGlyphLayout *, ShaperFlags) const override
virtual QFixed ascent() const override
virtual QFixed capHeight() const override
QString fallbackFamilyAt(int at) const
virtual glyph_metrics_t boundingBox(const QGlyphLayout &glyphs) override
virtual QFixed descent() const override
virtual QFixed leading() const override
virtual QFixed lineThickness() const override
virtual bool canRender(const QChar *string, int len) const override
virtual qreal maxCharWidth() const override
virtual QFixed xHeight() const override
static QFontEngine * createMultiFontEngine(QFontEngine *fe, int script)
virtual void ensureFallbackFamiliesQueried()
virtual void addOutlineToPath(qreal, qreal, const QGlyphLayout &, QPainterPath *, QTextItem::RenderFlags flags) override
virtual qreal minLeftBearing() const override
virtual void doKerning(QGlyphLayout *, ShaperFlags) const override
void setFallbackFamiliesList(const QStringList &fallbackFamilies)
virtual qreal minRightBearing() const override
virtual QFixed underlinePosition() const override
virtual void getGlyphBearings(glyph_t glyph, qreal *leftBearing=nullptr, qreal *rightBearing=nullptr) override
virtual QImage alphaMapForGlyph(glyph_t) override
QFontEngineMulti(QFontEngine *engine, int script, const QStringList &fallbackFamilies=QStringList())
virtual QFontEngine * loadEngine(int at)
virtual QFixed averageCharWidth() const override
static uchar highByte(glyph_t glyph)
virtual QImage alphaRGBMapForGlyph(glyph_t, const QFixedPoint &subPixelPosition, const QTransform &t) override
glyph_metrics_t tightBoundingBox(const QGlyphLayout &glyphs)
virtual bool supportsHorizontalSubPixelPositions() const
virtual QFixed descent() const
void setGlyphCache(const void *key, QFontEngineGlyphCache *data)
virtual int getPointInOutline(glyph_t glyph, int flags, quint32 point, QFixed *xpos, QFixed *ypos, quint32 *nPoints)
virtual Properties properties() const
void loadKerningPairs(QFixed scalingFactor)
QFixed calculatedCapHeight() const
static const uchar * getCMap(const uchar *table, uint tableSize, bool *isSymbolFont, int *cmapSize)
virtual int glyphCount() const
virtual QImage bitmapForGlyph(glyph_t, const QFixedPoint &subPixelPosition, const QTransform &t, const QColor &color=QColor())
virtual Qt::HANDLE handle() const
virtual qreal minRightBearing() const
static QByteArray convertToPostscriptFontFamilyName(const QByteArray &fontFamily)
virtual bool expectsGammaCorrectedBlending() const
bool preferTypoLineMetrics() const
int m_subPixelPositionCount
virtual qreal minLeftBearing() const
bool m_heightMetricsQueried
virtual void addGlyphsToPath(glyph_t *glyphs, QFixedPoint *positions, int nglyphs, QPainterPath *path, QTextItem::RenderFlags flags)
virtual void getGlyphBearings(glyph_t glyph, qreal *leftBearing=nullptr, qreal *rightBearing=nullptr)
static bool isIgnorableChar(char32_t ucs4)
virtual Glyph * glyphData(glyph_t glyph, const QFixedPoint &subPixelPosition, GlyphFormat neededFormat, const QTransform &t)
bool supportsScript(QChar::Script script) const
virtual qreal maxCharWidth() const =0
virtual void getUnscaledGlyph(glyph_t glyph, QPainterPath *path, glyph_metrics_t *metrics)
void * harfbuzzFont() const
virtual QFixed ascent() const
bool canRender(uint ucs4) const
virtual QImage alphaMapForGlyph(glyph_t)
QFixed firstLeftBearing(const QGlyphLayout &glyphs)
struct QFontEngine::FaceData faceData
virtual QImage alphaRGBMapForGlyph(glyph_t, const QFixedPoint &subPixelPosition, const QTransform &t)
QByteArray getSfntTable(uint tag) const
virtual QFixed averageCharWidth() const
virtual void removeGlyphFromCache(glyph_t)
virtual void initializeHeightMetrics() const
virtual void addOutlineToPath(qreal, qreal, const QGlyphLayout &, QPainterPath *, QTextItem::RenderFlags flags)
virtual bool supportsVerticalSubPixelPositions() const
static bool scriptRequiresOpenType(QChar::Script script)
bool processOS2Table() const
virtual void doKerning(QGlyphLayout *, ShaperFlags) const
bool processHheaTable() const
void getGlyphPositions(const QGlyphLayout &glyphs, const QTransform &matrix, QTextItem::RenderFlags flags, QVarLengthArray< glyph_t > &glyphs_out, QVarLengthArray< QFixedPoint > &positions)
void clearGlyphCache(const void *key)
virtual glyph_t glyphIndex(uint ucs4) const =0
virtual QFixed lineThickness() const
virtual QFixed underlinePosition() const
void addBitmapFontToPath(qreal x, qreal y, const QGlyphLayout &, QPainterPath *, QTextItem::RenderFlags)
virtual bool getSfntTableData(uint tag, uchar *buffer, uint *length) const
Returns true if the font table idetified by tag exists in the font; returns false otherwise.
virtual bool supportsTransformation(const QTransform &transform) const
bool supportsSubPixelPositions() const
static quint32 getTrueTypeGlyphIndex(const uchar *cmap, int cmapSize, uint unicode)
virtual glyph_metrics_t boundingBox(const QGlyphLayout &glyphs)
QFixed lastRightBearing(const QGlyphLayout &glyphs)
virtual void recalcAdvances(QGlyphLayout *, ShaperFlags) const
QList< KernPair > kerning_pairs
QFontEngineGlyphCache * glyphCache(const void *key, GlyphFormat format, const QTransform &transform, const QColor &color=QColor()) const
virtual QFixed leading() const
void * harfbuzzFace() const
virtual bool hasUnreliableGlyphOutline() const
virtual QFixed xHeight() const
virtual QFixed emSquareSize() const
virtual QFixedPoint subPixelPositionFor(const QFixedPoint &position) const
StyleHint
Style hints are used by the \l{QFont}{font matching} algorithm to find an appropriate default family ...
Style
This enum describes the different styles of glyphs that are used to display text.
static QGuiApplicationPrivate * instance()
bool remove(const Key &key)
Removes the item that has the key from the hash.
const_iterator constFind(const Key &key) const noexcept
const_iterator cend() const noexcept
qsizetype bytesPerLine() const
Returns the number of bytes per image scanline.
int width() const
Returns the width of the image.
uchar * bits()
Returns a pointer to the first pixel data.
int height() const
Returns the height of the image.
@ Format_ARGB32_Premultiplied
void fill(uint pixel)
Fills the entire image with the given pixelValue.
const uchar * constScanLine(int) const
Returns a pointer to the pixel data at the scanline with index i.
qsizetype size() const noexcept
const_reference at(qsizetype i) const noexcept
void resize(qsizetype size)
The QPainter class performs low-level painting on widgets and other paint devices.
const QPen & pen() const
Returns the painter's current pen.
void drawRect(const QRectF &rect)
Draws the current rectangle with the current pen and brush.
void setPen(const QColor &color)
This is an overloaded member function, provided for convenience. It differs from the above function o...
void restore()
Restores the current painter state (pops a saved state off the stack).
void save()
Saves the current painter state (pushes the state onto a stack).
void setBrush(const QBrush &brush)
Sets the painter's brush to the given brush.
void setWidthF(qreal width)
Sets the pen width to the given width in pixels with floating point precision.
\inmodule QtCore\reentrant
\inmodule QtCore\reentrant
iterator find(const T &value)
\macro QT_RESTRICTED_CAST_FROM_ASCII
QTestFontEngine(int size)
QCache< int, Employee > cache
[0]
QSet< QString >::iterator it
Combined button and popup list for selecting options.
QList< QString > QStringList
Constructs a string list that contains the given string, str.
static const QCssKnownValue positions[NumKnownPositionModes - 1]
DBusConnection const char DBusError DBusBusType DBusError return DBusConnection DBusHandleMessageFunction void * user_data
static QString header(const QString &name)
typedef QByteArray(EGLAPIENTRYP PFNQGSGETDISPLAYSPROC)()
EGLOutputLayerEXT EGLint EGLAttrib value
[5]
int qRound(qfloat16 d) noexcept
QStringList qt_fallbacksForFamily(const QString &family, QFont::Style style, QFont::StyleHint styleHint, QChar::Script script)
static bool qt_get_font_table_default(void *user_data, uint tag, uchar *buffer, uint *length)
static bool qSafeFromBigEndian(const uchar *source, const uchar *end, T *output)
static QT_BEGIN_NAMESPACE bool qtransform_equals_no_translate(const QTransform &a, const QTransform &b)
static QFixed kerning(int left, int right, const QFontEngine::KernPair *pairs, int numPairs)
static void collectSingleContour(qreal x0, qreal y0, uint *grid, int x, int y, int w, int h, QPainterPath *path)
QStringList qt_fallbacksForFamily(const QString &family, QFont::Style style, QFont::StyleHint styleHint, QChar::Script script)
static glyph_t stripped(glyph_t glyph)
Q_GUI_EXPORT void qt_addBitmapToPath(qreal x0, qreal y0, const uchar *image_data, int bpl, int w, int h, QPainterPath *path)
#define kBearingNotInitialized
#define kMinLeftSideBearingOffset
#define q16Dot16ToFloat(i)
#define kMinRightSideBearingOffset
void qt_addBitmapToPath(qreal x0, qreal y0, const uchar *image_data, int bpl, int w, int h, QPainterPath *path)
hb_script_t hb_qt_script_to_script(QChar::Script script)
hb_font_t * hb_qt_font_get_for_engine(QFontEngine *fe)
hb_face_t * hb_qt_face_get_for_engine(QFontEngine *fe)
struct hb_face_t hb_face_t
static ControlElement< T > * ptr(QWidget *widget)
QT_BEGIN_NAMESPACE constexpr const T & qMin(const T &a, const T &b)
constexpr const T & qMax(const T &a, const T &b)
constexpr T qAbs(const T &t)
GLboolean GLboolean GLboolean b
GLsizei const GLfloat * v
[13]
GLint GLint GLint GLint GLint x
[0]
GLfloat GLfloat GLfloat w
[0]
GLboolean GLboolean GLboolean GLboolean a
[7]
GLenum GLuint GLintptr GLsizeiptr size
[1]
GLenum GLuint GLenum GLsizei length
GLenum GLenum GLsizei count
GLint GLsizei GLsizei GLenum GLenum GLsizei void * data
GLenum const void GLbitfield GLsizei numGlyphs
GLsizei GLenum const void GLuint GLsizei GLfloat * metrics
GLenum GLuint GLintptr offset
GLint GLsizei GLsizei GLenum format
GLuint GLfloat GLfloat y0
GLfloat GLfloat GLfloat GLfloat h
GLsizei GLsizei GLchar * source
GLuint GLenum GLenum transform
GLsizei GLfixed GLfixed GLfixed GLfixed const GLubyte * bitmap
GLenum GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const void * bits
GLsizei const GLchar *const * path
GLenum GLenum GLsizei void * table
static qreal position(const QQuickItem *item, QQuickAnchors::Anchor anchorLine)
constexpr QRgb qRgb(int r, int g, int b)
constexpr int qAlpha(QRgb rgb)
#define Q_AUTOTEST_EXPORT
QT_BEGIN_NAMESPACE typedef uchar * output
QNetworkRequest request(url)
static constexpr QFixed fromReal(qreal r)
static constexpr QFixed fromFixed(int fixed)
constexpr QFixed round() const
constexpr QFixed ceil() const
constexpr qreal toReal() const
QByteArray postscriptName
The QFont::Tag type provides access to advanced font features.
QGlyphJustification * justifications
QFixed effectiveAdvance(int item) const
void copy(QGlyphLayout *other)
QGlyphAttributes * attributes
QGlyphLayout mid(int position, int n=-1) const
QFixed rightBearing() const
QFixed leftBearing() const
QThreadStorage< QCache< QString, SomeClass > > caches
[7]