Exemple #1
0
static
QFontEngine *loadSingleEngine(int script,
                              const QFontDef &request,
                              QtFontFoundry *foundry,
                              QtFontStyle *style, QtFontSize *size)
{
    Q_UNUSED(foundry);

    Q_ASSERT(size);
    int pixelSize = size->pixelSize;
    if (!pixelSize || (style->smoothScalable && pixelSize == SMOOTH_SCALABLE))
        pixelSize = request.pixelSize;

    QFontDef def = request;
    def.pixelSize = pixelSize;

    QFontCache::Key key(def,script);
    QFontEngine *engine = QFontCache::instance()->findEngine(key);
    if (!engine) {
        QPlatformFontDatabase *pfdb = QApplicationPrivate::platformIntegration()->fontDatabase();
        engine = pfdb->fontEngine(def,QUnicodeTables::Script(script),size->handle);
        if (engine) {
            QFontCache::Key key(def,script);
            QFontCache::instance()->instance()->insertEngine(key,engine);
        }
    }
    return engine;
}
Exemple #2
0
/*!
    \internal
*/
void QRawFontPrivate::loadFromData(const QByteArray &fontData, qreal pixelSize,
                                           QFont::HintingPreference hintingPreference)
{
    Q_ASSERT(fontEngine == 0);

    QPlatformFontDatabase *pfdb = QGuiApplicationPrivate::platformIntegration()->fontDatabase();
    setFontEngine(pfdb->fontEngine(fontData, pixelSize, hintingPreference));
}
Exemple #3
0
void QRawFontPrivate::platformLoadFromData(const QByteArray &fontData, int pixelSize,
                                           QFont::HintingPreference hintingPreference)
{
    Q_ASSERT(fontEngine == 0);

    QPlatformFontDatabase *pfdb = QApplicationPrivate::platformIntegration()->fontDatabase();
    fontEngine = pfdb->fontEngine(fontData, pixelSize, hintingPreference);
    if (fontEngine != 0)
        fontEngine->ref.ref();
}