QT_BEGIN_NAMESPACE
class QFontEngineFTRawFont;
+class QFontconfigDatabase;
/*
* This struct represents one font file on disk (like Arial.ttf) and is shared between all the font engines
QGlyphSet();
~QGlyphSet();
FT_Matrix transformationMatrix;
- unsigned long id; // server sided id, GlyphSet for X11
bool outline_drawing;
void removeGlyphFromCache(glyph_t index, QFixed subPixelPosition);
private:
friend class QFontEngineFTRawFont;
+ friend class QFontconfigDatabase;
int loadFlags(QGlyphSet *set, GlyphFormat format, int flags, bool &hsubpixel, int &vfactor) const;
fid.index = fontfile->indexValue;
bool antialias = !(fontDef.styleStrategy & QFont::NoAntialias);
- QFontEngineFT::GlyphFormat format = antialias? QFontEngineFT::Format_A8 : QFontEngineFT::Format_Mono;
-
engine = new QFontEngineFT(fontDef);
+ QFontEngineFT::GlyphFormat format;
// try and get the pattern
FcPattern *pattern = FcPatternCreate();
value.u.s = (const FcChar8 *)cs.data();
FcPatternAdd(pattern,FC_FAMILY,value,true);
-
value.u.s = (const FcChar8 *)fid.filename.data();
FcPatternAdd(pattern,FC_FILE,value,true);
value.u.i = fid.index;
FcPatternAdd(pattern,FC_INDEX,value,true);
- if (FcConfigSubstitute(0,pattern,FcMatchPattern)) {
+ FcResult result;
+ FcPattern *match = FcFontMatch(0, pattern, &result);
+ if (match) {
QFontEngineFT::HintStyle default_hint_style;
//hinting
int hint_style = 0;
- if (FcPatternGetInteger (pattern, FC_HINT_STYLE, 0, &hint_style) == FcResultNoMatch)
+ if (FcPatternGetInteger (match, FC_HINT_STYLE, 0, &hint_style) == FcResultNoMatch)
hint_style = QFontEngineFT::HintFull;
switch (hint_style) {
case FC_HINT_NONE:
break;
}
engine->setDefaultHintStyle(default_hint_style);
- }
+
+ if (antialias) {
+ QFontEngineFT::SubpixelAntialiasingType subpixelType = QFontEngineFT::Subpixel_None;
+ int subpixel = FC_RGBA_NONE;
+
+ FcPatternGetInteger(match, FC_RGBA, 0, &subpixel);
+ if (subpixel == FC_RGBA_UNKNOWN)
+ subpixel = FC_RGBA_NONE;
+
+ switch (subpixel) {
+ case FC_RGBA_NONE: subpixelType = QFontEngineFT::Subpixel_None; break;
+ case FC_RGBA_RGB: subpixelType = QFontEngineFT::Subpixel_RGB; break;
+ case FC_RGBA_BGR: subpixelType = QFontEngineFT::Subpixel_BGR; break;
+ case FC_RGBA_VRGB: subpixelType = QFontEngineFT::Subpixel_VRGB; break;
+ case FC_RGBA_VBGR: subpixelType = QFontEngineFT::Subpixel_VBGR; break;
+ default: break;
+ }
+
+ format = subpixelType == QFontEngineFT::Subpixel_None
+ ? QFontEngineFT::Format_A8 : QFontEngineFT::Format_A32;
+ engine->subpixelType = subpixelType;
+ } else
+ format = QFontEngineFT::Format_Mono;
+
+ FcPatternDestroy(match);
+ } else
+ format = antialias ? QFontEngineFT::Format_A8 : QFontEngineFT::Format_Mono;
+
FcPatternDestroy(pattern);
if (!engine->init(fid,antialias,format)) {