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
|
||||
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 PreferAntialias antialias if possible.
|
||||
|
||||
|
|
|
@ -47,10 +47,9 @@ public:
|
|||
PreferDefault = 0x0001,
|
||||
PreferBitmap = 0x0002,
|
||||
PreferOutline = 0x0004,
|
||||
ForceOutline = 0x0008,
|
||||
PreferAntialias = 0x0010,
|
||||
NoAntialias = 0x0020,
|
||||
ForceIntegerMetrics = 0x0040
|
||||
PreferAntialias = 0x0008,
|
||||
NoAntialias = 0x0010,
|
||||
ForceIntegerMetrics = 0x0020
|
||||
};
|
||||
|
||||
enum HintingPreference {
|
||||
|
|
|
@ -536,7 +536,7 @@ static void qt_addPatternProps(FcPattern *pattern, int screen, QUnicodeTables::S
|
|||
|
||||
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);
|
||||
}
|
||||
FcPatternAddBool(pattern, FC_OUTLINE, !(request.styleStrategy & QFont::PreferBitmap));
|
||||
|
||||
if (preferScalable(request))
|
||||
FcPatternAddBool(pattern, FC_SCALABLE, true);
|
||||
|
||||
|
@ -660,40 +661,6 @@ special_char:
|
|||
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)
|
||||
{
|
||||
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);
|
||||
QFontEngine *fe = tryPatternLoad(match, fp->screen, request, script);
|
||||
if (!fe) {
|
||||
FcFontSet *fs = qt_fontSetForPattern(pattern, request);
|
||||
FcResult unused;
|
||||
FcFontSet *fs = FcFontSort(0, pattern, FcTrue, 0, &unused);
|
||||
|
||||
if (match) {
|
||||
FcPatternDestroy(match);
|
||||
|
|
|
@ -80,8 +80,6 @@ void tst_QFont::getSetCheck()
|
|||
QCOMPARE(QFont::StyleStrategy(QFont::PreferBitmap), obj1.styleStrategy());
|
||||
obj1.setStyleStrategy(QFont::StyleStrategy(QFont::PreferOutline));
|
||||
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));
|
||||
QCOMPARE(QFont::StyleStrategy(QFont::PreferAntialias), obj1.styleStrategy());
|
||||
obj1.setStyleStrategy(QFont::StyleStrategy(QFont::NoAntialias));
|
||||
|
|
|
@ -91,7 +91,7 @@ void Chip::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWid
|
|||
// Draw text
|
||||
if (option->levelOfDetail >= 2) {
|
||||
QFont font("Times", 10);
|
||||
font.setStyleStrategy(QFont::ForceOutline);
|
||||
font.setStyleStrategy(QFont::PreferOutline);
|
||||
painter->setFont(font);
|
||||
painter->save();
|
||||
painter->scale(0.1, 0.1);
|
||||
|
|
Loading…
Add table
Reference in a new issue