Use harfbuzz feature to check for HarfBuzz
instead of defining a special macro for it. Change-Id: I715380717f7d871571f663be30b73f7d95d83d71 Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
This commit is contained in:
parent
72ed34b792
commit
0861c2176c
@ -53,7 +53,7 @@
|
||||
#include <qendian.h>
|
||||
#include <private/qstringiterator_p.h>
|
||||
|
||||
#ifdef QT_ENABLE_HARFBUZZ_NG
|
||||
#if QT_CONFIG(harfbuzz)
|
||||
# include "qharfbuzzng_p.h"
|
||||
# include <harfbuzz/hb-ot.h>
|
||||
#endif
|
||||
@ -93,7 +93,7 @@ static inline bool qSafeFromBigEndian(const uchar *source, const uchar *end, T *
|
||||
|
||||
// Harfbuzz helper functions
|
||||
|
||||
#ifdef QT_ENABLE_HARFBUZZ_NG
|
||||
#if QT_CONFIG(harfbuzz)
|
||||
Q_GLOBAL_STATIC_WITH_ARGS(bool, useHarfbuzzNG,(qgetenv("QT_HARFBUZZ") != "old"))
|
||||
|
||||
bool qt_useHarfbuzzNG()
|
||||
@ -296,7 +296,7 @@ QFixed QFontEngine::underlinePosition() const
|
||||
void *QFontEngine::harfbuzzFont() const
|
||||
{
|
||||
Q_ASSERT(type() != QFontEngine::Multi);
|
||||
#ifdef QT_ENABLE_HARFBUZZ_NG
|
||||
#if QT_CONFIG(harfbuzz)
|
||||
if (qt_useHarfbuzzNG())
|
||||
return hb_qt_font_get_for_engine(const_cast<QFontEngine *>(this));
|
||||
#endif
|
||||
@ -331,7 +331,7 @@ void *QFontEngine::harfbuzzFont() const
|
||||
void *QFontEngine::harfbuzzFace() const
|
||||
{
|
||||
Q_ASSERT(type() != QFontEngine::Multi);
|
||||
#ifdef QT_ENABLE_HARFBUZZ_NG
|
||||
#if QT_CONFIG(harfbuzz)
|
||||
if (qt_useHarfbuzzNG())
|
||||
return hb_qt_face_get_for_engine(const_cast<QFontEngine *>(this));
|
||||
#endif
|
||||
@ -363,7 +363,7 @@ bool QFontEngine::supportsScript(QChar::Script script) const
|
||||
return true;
|
||||
}
|
||||
|
||||
#ifdef QT_ENABLE_HARFBUZZ_NG
|
||||
#if QT_CONFIG(harfbuzz)
|
||||
if (qt_useHarfbuzzNG()) {
|
||||
#if defined(Q_OS_DARWIN)
|
||||
// in AAT fonts, 'gsub' table is effectively replaced by 'mort'/'morx' table
|
||||
|
@ -53,6 +53,9 @@
|
||||
//
|
||||
|
||||
#include <QtGui/private/qtguiglobal_p.h>
|
||||
|
||||
QT_REQUIRE_CONFIG(harfbuzz);
|
||||
|
||||
#include <QtCore/qchar.h>
|
||||
|
||||
#include <harfbuzz/hb.h>
|
||||
|
@ -37,6 +37,7 @@
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include <QtGui/private/qtguiglobal_p.h>
|
||||
#include "qdebug.h"
|
||||
#include "qtextformat.h"
|
||||
#include "qtextformat_p.h"
|
||||
@ -837,7 +838,7 @@ enum JustificationClass {
|
||||
Justification_Arabic_Kashida = 13 // User-inserted Kashida(U+0640)
|
||||
};
|
||||
|
||||
#ifdef QT_ENABLE_HARFBUZZ_NG
|
||||
#if QT_CONFIG(harfbuzz)
|
||||
|
||||
/*
|
||||
Adds an inter character justification opportunity after the number or letter
|
||||
@ -916,7 +917,7 @@ static inline void qt_getJustificationOpportunities(const ushort *string, int le
|
||||
qt_getDefaultJustificationOpportunities(string, length, g, log_clusters, spaceAs);
|
||||
}
|
||||
|
||||
#endif // QT_ENABLE_HARFBUZZ_NG
|
||||
#endif // harfbuzz
|
||||
|
||||
|
||||
// shape all the items that intersect with the line, taking tab widths into account to find out what text actually fits in the line.
|
||||
@ -950,7 +951,7 @@ void QTextEngine::shapeLine(const QScriptLine &line)
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef QT_ENABLE_HARFBUZZ_NG
|
||||
#if QT_CONFIG(harfbuzz)
|
||||
extern bool qt_useHarfbuzzNG(); // defined in qfontengine.cpp
|
||||
#endif
|
||||
|
||||
@ -1063,7 +1064,7 @@ void QTextEngine::shapeText(int item) const
|
||||
letterSpacing *= font.d->dpi / qt_defaultDpiY();
|
||||
}
|
||||
|
||||
#ifdef QT_ENABLE_HARFBUZZ_NG
|
||||
#if QT_CONFIG(harfbuzz)
|
||||
if (Q_LIKELY(qt_useHarfbuzzNG()))
|
||||
si.num_glyphs = shapeTextWithHarfbuzzNG(si, string, itemLength, fontEngine, itemBoundaries, kerningEnabled, letterSpacing != 0);
|
||||
else
|
||||
@ -1079,7 +1080,7 @@ void QTextEngine::shapeText(int item) const
|
||||
|
||||
QGlyphLayout glyphs = shapedGlyphs(&si);
|
||||
|
||||
#ifdef QT_ENABLE_HARFBUZZ_NG
|
||||
#if QT_CONFIG(harfbuzz)
|
||||
if (Q_LIKELY(qt_useHarfbuzzNG()))
|
||||
qt_getJustificationOpportunities(string, itemLength, si, glyphs, logClusters(&si));
|
||||
#endif
|
||||
@ -1119,7 +1120,7 @@ void QTextEngine::shapeText(int item) const
|
||||
si.width += glyphs.advances[i] * !glyphs.attributes[i].dontPrint;
|
||||
}
|
||||
|
||||
#ifdef QT_ENABLE_HARFBUZZ_NG
|
||||
#if QT_CONFIG(harfbuzz)
|
||||
|
||||
QT_BEGIN_INCLUDE_NAMESPACE
|
||||
|
||||
@ -1313,7 +1314,7 @@ int QTextEngine::shapeTextWithHarfbuzzNG(const QScriptItem &si,
|
||||
return glyphs_shaped;
|
||||
}
|
||||
|
||||
#endif // QT_ENABLE_HARFBUZZ_NG
|
||||
#endif // harfbuzz
|
||||
|
||||
|
||||
QT_BEGIN_INCLUDE_NAMESPACE
|
||||
@ -1669,7 +1670,7 @@ void QTextEngine::itemize() const
|
||||
analysis->flags = QScriptAnalysis::None;
|
||||
break;
|
||||
}
|
||||
#ifndef QT_ENABLE_HARFBUZZ_NG
|
||||
#if !QT_CONFIG(harfbuzz)
|
||||
analysis->script = hbscript_to_script(script_to_hbscript(analysis->script));
|
||||
#endif
|
||||
++uc;
|
||||
@ -1678,7 +1679,7 @@ void QTextEngine::itemize() const
|
||||
if (option.flags() & QTextOption::ShowLineAndParagraphSeparators) {
|
||||
(analysis-1)->flags = QScriptAnalysis::LineOrParagraphSeparator; // to exclude it from width
|
||||
}
|
||||
#ifdef QT_ENABLE_HARFBUZZ_NG
|
||||
#if QT_CONFIG(harfbuzz)
|
||||
analysis = scriptAnalysis.data();
|
||||
if (qt_useHarfbuzzNG()) {
|
||||
// ### pretend HB-old behavior for now
|
||||
|
@ -649,7 +649,7 @@ private:
|
||||
void setBoundary(int strPos) const;
|
||||
void addRequiredBoundaries() const;
|
||||
void shapeText(int item) const;
|
||||
#ifdef QT_ENABLE_HARFBUZZ_NG
|
||||
#if QT_CONFIG(harfbuzz)
|
||||
int shapeTextWithHarfbuzzNG(const QScriptItem &si,
|
||||
const ushort *string,
|
||||
int itemLength,
|
||||
|
@ -78,9 +78,7 @@ SOURCES += \
|
||||
HEADERS += \
|
||||
text/qplatformfontdatabase.h
|
||||
|
||||
qtConfig(harfbuzz)|qtConfig(system-harfbuzz) {
|
||||
DEFINES += QT_ENABLE_HARFBUZZ_NG
|
||||
|
||||
qtConfig(harfbuzz) {
|
||||
QMAKE_USE_PRIVATE += harfbuzz
|
||||
|
||||
SOURCES += text/qharfbuzzng.cpp
|
||||
|
Loading…
Reference in New Issue
Block a user