[Development] Question about QFontconfigDatabase

Rafael Roquetto rafael.roquetto at kdab.com
Wed Dec 12 18:45:02 CET 2012


Hello,

While analyzing the source code in qfontconfigdatabase.cpp (qt4), I stumbled
upon the following piece of code (beginning on line 433):

    struct FcDefaultFont {
        const char *qtname;
        const char *rawname;
        bool fixed;
    };  
    const FcDefaultFont defaults[] = { 
        { "Serif", "serif", false },
        { "Sans Serif", "sans-serif", false },
        { "Monospace", "monospace", true },
        { 0, 0, false }
    };  
    const FcDefaultFont *f = defaults;
    // aliases only make sense for 'common', not for any of the specials
    QSupportedWritingSystems ws; 
    ws.setSupported(QFontDatabase::Latin);


    while (f->qtname) {
        registerFont(f->qtname,QLatin1String(""),QFont::Normal,QFont::StyleNormal,QFont::Unstretched,true,true,0,ws,0);
        registerFont(f->qtname,QLatin1String(""),QFont::Normal,QFont::StyleItalic,QFont::Unstretched,true,true,0,ws,0);
        registerFont(f->qtname,QLatin1String(""),QFont::Normal,QFont::StyleOblique,QFont::Unstretched,true,true,0,ws,0);
        ++f;
    }

When registerFont is called, f->qtname is passed as the family name (so
"Serif", for instance), but an empty string is passed as the foundry. My
question then follows: how does Qt know where to load these families from,
since no font path is being specifying?

Thanks,
Rafael
-- 
Rafael Roquetto | rafael.roquetto at kdab.com | Software Engineer
Klarälvdalens Datakonsult AB, a KDAB Group company
Tel. Sweden (HQ) +46-563-540090, USA +1-866-777-KDAB(5322)
KDAB - Qt Experts - Platform-independent software solutions

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 3721 bytes
Desc: not available
URL: <http://lists.qt-project.org/pipermail/development/attachments/20121212/8a17922c/attachment.bin>


More information about the Development mailing list