40 #ifndef QFONTENGINE_P_H
41 #define QFONTENGINE_P_H
54 #include <QtGui/private/qtguiglobal_p.h>
55 #include "QtCore/qatomic.h"
56 #include <QtCore/qvarlengtharray.h>
57 #include <QtCore/qhashfunctions.h>
58 #include "private/qtextengine_p.h"
59 #include "private/qfont_p.h"
68 #define MAKE_TAG(ch1, ch2, ch3, ch4) (\
69 (((quint32)(ch1)) << 24) | \
70 (((quint32)(ch2)) << 16) | \
71 (((quint32)(ch3)) << 8) | \
108 TestFontEngine = 0x1000
113 Format_Render = Format_None,
121 DesignMetrics = 0x0002,
122 GlyphIndicesOnly = 0x0004
130 short linearAdvance = 0;
174 SynthesizedItalic = 0x1,
175 SynthesizedBold = 0x2,
176 SynthesizedStretch = 0x4
181 return supportsHorizontalSubPixelPositions() || supportsVerticalSubPixelPositions();
197 virtual void doKerning(
QGlyphLayout *, ShaperFlags)
const;
223 return boundingBox(glyph,
matrix);
226 virtual void removeGlyphFromCache(
glyph_t);
233 virtual QFixed ascent()
const;
235 virtual QFixed descent()
const;
236 virtual QFixed leading()
const;
237 virtual QFixed xHeight()
const;
238 virtual QFixed averageCharWidth()
const;
240 virtual QFixed lineThickness()
const;
241 virtual QFixed underlinePosition()
const;
244 virtual qreal minLeftBearing()
const;
245 virtual qreal minRightBearing()
const;
247 virtual void getGlyphBearings(
glyph_t glyph,
qreal *leftBearing =
nullptr,
qreal *rightBearing =
nullptr);
250 virtual bool canRender(
const QChar *
str,
int len)
const;
254 virtual int glyphCount()
const;
261 void *harfbuzzFont()
const;
262 void *harfbuzzFace()
const;
273 void clearGlyphCache(
const void *
key);
277 static const uchar *getCMap(
const uchar *
table,
uint tableSize,
bool *isSymbolFont,
int *cmapSize);
278 static quint32 getTrueTypeGlyphIndex(
const uchar *cmap,
int cmapSize,
uint unicode);
282 virtual bool hasUnreliableGlyphOutline()
const;
283 virtual bool expectsGammaCorrectedBlending()
const;
314 ~Holder() {
if (ptr && destroy_func) destroy_func(ptr); }
316 : ptr(qExchange(
other.ptr,
nullptr)),
317 destroy_func(qExchange(
other.destroy_func,
nullptr))
332 destroy_func =
nullptr;
359 return left_right <
other.left_right;
363 void loadKerningPairs(
QFixed scalingFactor);
373 QFixed calculatedCapHeight()
const;
380 virtual void initializeHeightMetrics()
const;
381 bool processHheaTable()
const;
382 bool processOS2Table()
const;
385 struct GlyphCacheEntry {
387 GlyphCacheEntry(
const GlyphCacheEntry &);
390 GlyphCacheEntry &operator=(
const GlyphCacheEntry &);
395 typedef std::list<GlyphCacheEntry> GlyphCaches;
399 mutable qreal m_minLeftBearing;
400 mutable qreal m_minRightBearing;
408 return f1.index == f2.index && f1.encoding == f2.encoding && f1.filename == f2.filename && f1.uuid == f2.uuid;
450 inline int size()
const {
return _size; }
466 virtual glyph_t glyphIndex(
uint ucs4)
const override;
472 virtual void recalcAdvances(
QGlyphLayout *, ShaperFlags)
const override;
473 virtual void doKerning(
QGlyphLayout *, ShaperFlags)
const override;
475 virtual void getGlyphBearings(
glyph_t glyph,
qreal *leftBearing =
nullptr,
qreal *rightBearing =
nullptr)
override;
477 virtual QFixed ascent()
const override;
478 virtual QFixed capHeight()
const override;
479 virtual QFixed descent()
const override;
480 virtual QFixed leading()
const override;
481 virtual QFixed xHeight()
const override;
482 virtual QFixed averageCharWidth()
const override;
489 virtual QFixed lineThickness()
const override;
490 virtual QFixed underlinePosition()
const override;
491 virtual qreal maxCharWidth()
const override;
492 virtual qreal minLeftBearing()
const override;
493 virtual qreal minRightBearing()
const override;
495 virtual bool canRender(
const QChar *
string,
int len)
const override;
500 void setFallbackFamiliesList(
const QStringList &fallbackFamilies);
505 {
Q_ASSERT(
at < m_engines.size());
return m_engines.at(
at); }
507 void ensureEngineAt(
int at);
512 virtual void ensureFallbackFamiliesQueried();
513 virtual bool shouldLoadFontEngineForCharacter(
int at,
uint ucs4)
const;
520 bool m_fallbackFamiliesQueried;
xD9 x84 xD8 xAD xD9 x80 xF0 x90 xAC x9A xE0 xA7 xA6 xE0 xA7 xAA xF0 x91 x84 xA4 xF0 x91 x84 x89 xF0 x91 x84 x9B xF0 x90 x8A xAB xF0 x90 x8B x89 xE2 xB2 x9E xE2 xB2 x9F xD0 xBE xD0 x9E xF0 x90 x90 x84 xF0 x90 x90 xAC xE1 x83 x98 xE1 x83 x94 xE1 x83 x90 xE1 xB2 xBF xE2 xB0 x95 xE2 xB1 x85 xCE xBF xCE x9F xE0 xA8 xA0 xE0 xA8 xB0 xE0 xA9 xA6 Kayah xEA xA4 x8D xEA xA4 x80 Khmer xE1 xA7 xA1 xE1 xA7 xAA xE0 xBB x90 Latin Subscript xE2 x82 x92 xE2 x82 x80 xEA x93 xB3 xF0 x96 xB9 xA1 xF0 x96 xB9 x9B xF0 x96 xB9 xAF xE1 x80 x9D xE1 x80 x84 xE1 x80 x82 no script
The QAtomicInt class provides platform-independent atomic operations on int.
The QByteArray class provides an array of bytes.
The QChar class provides a 16-bit Unicode character.
The QColor class provides colors based on RGB, HSV or CMYK values.
template< typename Enum > size_t qHash(QFlags< Enum > flags, size_t seed=0) noexcept
qt_destroy_func_t get_deleter() const noexcept
void * get() const noexcept
Holder(void *p, qt_destroy_func_t d)
void swap(Holder &other) noexcept
bool operator!() const noexcept
void * release() noexcept
Holder(Holder &&other) noexcept
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 qreal minLeftBearing() 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 bool stringToCMap(const QChar *str, int len, QGlyphLayout *glyphs, int *nglyphs, ShaperFlags flags) 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
virtual qreal minRightBearing() const override
QFixed subPixelPositionForX(const QFixed &x) const
virtual bool supportsHorizontalSubPixelPositions() const
virtual QFixed capHeight() const =0
virtual glyph_metrics_t boundingBox(glyph_t glyph)=0
virtual glyph_metrics_t boundingBox(const QGlyphLayout &glyphs)=0
virtual glyph_metrics_t alphaMapBoundingBox(glyph_t glyph, const QFixedPoint &, const QTransform &matrix, GlyphFormat)
int m_subPixelPositionCount
bool m_heightMetricsQueried
virtual FaceId faceId() const
virtual qreal maxCharWidth() const =0
virtual int glyphMargin(GlyphFormat format)
bool canRender(uint ucs4) const
virtual void setDefaultHintStyle(HintStyle)
virtual bool supportsVerticalSubPixelPositions() const
static bool scriptRequiresOpenType(QChar::Script script)
virtual glyph_t glyphIndex(uint ucs4) const =0
virtual QFontEngine * cloneWithSize(qreal) const
bool supportsSubPixelPositions() const
virtual void recalcAdvances(QGlyphLayout *, ShaperFlags) const
QList< KernPair > kerning_pairs
virtual int synthesized() const
virtual bool hasInternalCaching() const
virtual bool stringToCMap(const QChar *str, int len, QGlyphLayout *glyphs, int *nglyphs, ShaperFlags flags) const =0
virtual QFixed emSquareSize() const
QString fallbackFamilyAt(int at) const
QFontEngine * engine(int at) const
int fallbackFamilyCount() const
template< typename... T > size_t qHashMulti(size_t seed, const T &...args)
The QImage class provides a hardware-independent image representation that allows direct access to th...
The QPaintEngine class provides an abstract definition of how QPainter draws to a given device on a g...
The QPainterPath class provides a container for painting operations, enabling graphical shapes to be ...
The QRectF class defines a finite rectangle in the plane using floating point precision.
The QString class provides a Unicode character string.
const QChar at(qsizetype i) const
The QStringList class provides a list of strings.
QTestFontEngine(int size)
QCache< int, Employee > cache
[0]
auto it unsigned count const
QHighDpiScaling::Point position(T, QHighDpiScaling::Point::Kind)
QList< QString > QStringList
#define Q_DECLARE_FLAGS(Flags, Enum)
#define Q_DECLARE_OPERATORS_FOR_FLAGS(Flags)
bool(* qt_get_font_table_func_t)(void *user_data, uint tag, uchar *buffer, uint *length)
bool operator==(const QFontEngine::FaceId &f1, const QFontEngine::FaceId &f2)
void(* qt_destroy_func_t)(void *user_data)
Q_DECLARE_TYPEINFO(QFontEngine::KernPair, Q_PRIMITIVE_TYPE)
@ Err_Invalid_SubTable_Format
QT_BEGIN_INCLUDE_NAMESPACE typedef unsigned char uchar
QT_END_INCLUDE_NAMESPACE typedef double qreal
#define Q_DISABLE_COPY(Class)
#define QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_PURE_SWAP(Class)
GLenum GLuint GLenum GLsizei length
GLuint64 GLenum void * handle
GLint GLint GLint GLint GLint x
[0]
GLint GLsizei GLsizei height
GLenum GLuint GLintptr GLsizeiptr size
[1]
GLsizei GLenum const void GLuint GLsizei GLfloat * metrics
GLint GLsizei GLsizei GLenum GLenum GLsizei void * data
GLint GLsizei GLsizei GLenum format
GLuint GLenum GLenum transform
GLsizei const GLchar *const * path
GLenum GLenum GLsizei void * table
HB_EXTERN hb_font_get_glyph_func_t void * user_data
qt_get_font_table_func_t get_font_table
bool operator<(const KernPair &other) const
QByteArray postscriptName
XmlOutput::xml_output tag(const QString &name)