mirror of
https://bitbucket.org/smil3y/katie.git
synced 2025-02-24 10:52:56 +00:00
remove redundant QFont::StyleStrategy::ForceOutline enum [ci reset]
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
parent
329ce21784
commit
ff3b339842
5 changed files with 8 additions and 44 deletions
|
@ -1054,7 +1054,6 @@ QFont::StyleStrategy QFont::styleStrategy() const
|
||||||
\value PreferBitmap prefers bitmap fonts (as opposed to outline
|
\value PreferBitmap prefers bitmap fonts (as opposed to outline
|
||||||
fonts).
|
fonts).
|
||||||
\value PreferOutline prefers outline fonts (as opposed to bitmap fonts).
|
\value PreferOutline prefers outline fonts (as opposed to bitmap fonts).
|
||||||
\value ForceOutline forces the use of outline fonts.
|
|
||||||
\value NoAntialias don't antialias the fonts.
|
\value NoAntialias don't antialias the fonts.
|
||||||
\value PreferAntialias antialias if possible.
|
\value PreferAntialias antialias if possible.
|
||||||
|
|
||||||
|
|
|
@ -47,10 +47,9 @@ public:
|
||||||
PreferDefault = 0x0001,
|
PreferDefault = 0x0001,
|
||||||
PreferBitmap = 0x0002,
|
PreferBitmap = 0x0002,
|
||||||
PreferOutline = 0x0004,
|
PreferOutline = 0x0004,
|
||||||
ForceOutline = 0x0008,
|
PreferAntialias = 0x0008,
|
||||||
PreferAntialias = 0x0010,
|
NoAntialias = 0x0010,
|
||||||
NoAntialias = 0x0020,
|
ForceIntegerMetrics = 0x0020
|
||||||
ForceIntegerMetrics = 0x0040
|
|
||||||
};
|
};
|
||||||
|
|
||||||
enum HintingPreference {
|
enum HintingPreference {
|
||||||
|
|
|
@ -536,7 +536,7 @@ static void qt_addPatternProps(FcPattern *pattern, int screen, QUnicodeTables::S
|
||||||
|
|
||||||
static bool preferScalable(const QFontDef &request)
|
static bool preferScalable(const QFontDef &request)
|
||||||
{
|
{
|
||||||
return request.styleStrategy & (QFont::PreferOutline|QFont::ForceOutline|QFont::PreferAntialias);
|
return request.styleStrategy & (QFont::PreferOutline|QFont::PreferAntialias);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -577,6 +577,7 @@ static FcPattern *getFcPattern(const QFontPrivate *fp, QUnicodeTables::Script sc
|
||||||
FcPatternAddInteger(pattern, FC_SPACING, pitch_value);
|
FcPatternAddInteger(pattern, FC_SPACING, pitch_value);
|
||||||
}
|
}
|
||||||
FcPatternAddBool(pattern, FC_OUTLINE, !(request.styleStrategy & QFont::PreferBitmap));
|
FcPatternAddBool(pattern, FC_OUTLINE, !(request.styleStrategy & QFont::PreferBitmap));
|
||||||
|
|
||||||
if (preferScalable(request))
|
if (preferScalable(request))
|
||||||
FcPatternAddBool(pattern, FC_SCALABLE, true);
|
FcPatternAddBool(pattern, FC_SCALABLE, true);
|
||||||
|
|
||||||
|
@ -660,40 +661,6 @@ special_char:
|
||||||
return engine;
|
return engine;
|
||||||
}
|
}
|
||||||
|
|
||||||
FcFontSet *qt_fontSetForPattern(FcPattern *pattern, const QFontDef &request)
|
|
||||||
{
|
|
||||||
FcResult result;
|
|
||||||
FcFontSet *fs = FcFontSort(0, pattern, FcTrue, 0, &result);
|
|
||||||
#ifdef FONT_MATCH_DEBUG
|
|
||||||
FM_DEBUG("first font in fontset:\n");
|
|
||||||
FcPatternPrint(fs->fonts[0]);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
FcBool forceScalable = request.styleStrategy & QFont::ForceOutline;
|
|
||||||
|
|
||||||
// remove fonts if they are not scalable (and should be)
|
|
||||||
if (forceScalable && fs) {
|
|
||||||
for (int i = 0; i < fs->nfont; ++i) {
|
|
||||||
FcPattern *font = fs->fonts[i];
|
|
||||||
FcResult res;
|
|
||||||
FcBool scalable;
|
|
||||||
res = FcPatternGetBool(font, FC_SCALABLE, 0, &scalable);
|
|
||||||
if (res != FcResultMatch || !scalable) {
|
|
||||||
FcFontSetRemove(fs, i);
|
|
||||||
#ifdef FONT_MATCH_DEBUG
|
|
||||||
FM_DEBUG("removing pattern:");
|
|
||||||
FcPatternPrint(font);
|
|
||||||
#endif
|
|
||||||
--i; // go back one
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
FM_DEBUG("final pattern contains %d fonts\n", fs->nfont);
|
|
||||||
|
|
||||||
return fs;
|
|
||||||
}
|
|
||||||
|
|
||||||
static QFontEngine *loadFc(const QFontPrivate *fp, QUnicodeTables::Script script, const QFontDef &request)
|
static QFontEngine *loadFc(const QFontPrivate *fp, QUnicodeTables::Script script, const QFontDef &request)
|
||||||
{
|
{
|
||||||
FM_DEBUG("===================== loadFc: script=%d family='%s'\n", script, request.family.toLatin1().constData());
|
FM_DEBUG("===================== loadFc: script=%d family='%s'\n", script, request.family.toLatin1().constData());
|
||||||
|
@ -708,7 +675,8 @@ static QFontEngine *loadFc(const QFontPrivate *fp, QUnicodeTables::Script script
|
||||||
FcPattern *match = FcFontMatch(0, pattern, &res);
|
FcPattern *match = FcFontMatch(0, pattern, &res);
|
||||||
QFontEngine *fe = tryPatternLoad(match, fp->screen, request, script);
|
QFontEngine *fe = tryPatternLoad(match, fp->screen, request, script);
|
||||||
if (!fe) {
|
if (!fe) {
|
||||||
FcFontSet *fs = qt_fontSetForPattern(pattern, request);
|
FcResult unused;
|
||||||
|
FcFontSet *fs = FcFontSort(0, pattern, FcTrue, 0, &unused);
|
||||||
|
|
||||||
if (match) {
|
if (match) {
|
||||||
FcPatternDestroy(match);
|
FcPatternDestroy(match);
|
||||||
|
|
|
@ -80,8 +80,6 @@ void tst_QFont::getSetCheck()
|
||||||
QCOMPARE(QFont::StyleStrategy(QFont::PreferBitmap), obj1.styleStrategy());
|
QCOMPARE(QFont::StyleStrategy(QFont::PreferBitmap), obj1.styleStrategy());
|
||||||
obj1.setStyleStrategy(QFont::StyleStrategy(QFont::PreferOutline));
|
obj1.setStyleStrategy(QFont::StyleStrategy(QFont::PreferOutline));
|
||||||
QCOMPARE(QFont::StyleStrategy(QFont::PreferOutline), obj1.styleStrategy());
|
QCOMPARE(QFont::StyleStrategy(QFont::PreferOutline), obj1.styleStrategy());
|
||||||
obj1.setStyleStrategy(QFont::StyleStrategy(QFont::ForceOutline));
|
|
||||||
QCOMPARE(QFont::StyleStrategy(QFont::ForceOutline), obj1.styleStrategy());
|
|
||||||
obj1.setStyleStrategy(QFont::StyleStrategy(QFont::PreferAntialias));
|
obj1.setStyleStrategy(QFont::StyleStrategy(QFont::PreferAntialias));
|
||||||
QCOMPARE(QFont::StyleStrategy(QFont::PreferAntialias), obj1.styleStrategy());
|
QCOMPARE(QFont::StyleStrategy(QFont::PreferAntialias), obj1.styleStrategy());
|
||||||
obj1.setStyleStrategy(QFont::StyleStrategy(QFont::NoAntialias));
|
obj1.setStyleStrategy(QFont::StyleStrategy(QFont::NoAntialias));
|
||||||
|
|
|
@ -91,7 +91,7 @@ void Chip::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWid
|
||||||
// Draw text
|
// Draw text
|
||||||
if (option->levelOfDetail >= 2) {
|
if (option->levelOfDetail >= 2) {
|
||||||
QFont font("Times", 10);
|
QFont font("Times", 10);
|
||||||
font.setStyleStrategy(QFont::ForceOutline);
|
font.setStyleStrategy(QFont::PreferOutline);
|
||||||
painter->setFont(font);
|
painter->setFont(font);
|
||||||
painter->save();
|
painter->save();
|
||||||
painter->scale(0.1, 0.1);
|
painter->scale(0.1, 0.1);
|
||||||
|
|
Loading…
Add table
Reference in a new issue