Ignore:
Timestamp:
May 5, 2011, 5:36:53 AM (14 years ago)
Author:
Dmitry A. Kuminov
Message:

trunk: Merged in qt 4.7.2 sources from branches/vendor/nokia/qt.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk

  • trunk/src/gui/text/qfontengine.cpp

    r769 r846  
    11/****************************************************************************
    22**
    3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
     3** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
    44** All rights reserved.
    55** Contact: Nokia Corporation (qt-info@nokia.com)
     
    4747#include "qpainterpath.h"
    4848#include "qvarlengtharray.h"
    49 #include <private/qpdf_p.h>
    5049#include <qmath.h>
    5150#include <qendian.h>
     
    597596    QImage i = alphaMapForGlyph(glyph);
    598597    if (t.type() > QTransform::TxTranslate)
    599         i = i.transformed(t);
     598        i = i.transformed(t).convertToFormat(QImage::Format_Indexed8);
    600599    Q_ASSERT(i.depth() <= 8); // To verify that transformed didn't change the format...
     600
    601601    return i;
    602602}
     
    607607    QImage rgbMask(alphaMask.width(), alphaMask.height(), QImage::Format_RGB32);
    608608
     609    QVector<QRgb> colorTable = alphaMask.colorTable();
    609610    for (int y=0; y<alphaMask.height(); ++y) {
    610611        uint *dst = (uint *) rgbMask.scanLine(y);
    611612        uchar *src = (uchar *) alphaMask.scanLine(y);
    612         for (int x=0; x<alphaMask.width(); ++x)
    613             dst[x] = qRgb(src[x], src[x], src[x]);
     613        for (int x=0; x<alphaMask.width(); ++x) {
     614            int val = qAlpha(colorTable.at(src[x]));
     615            dst[x] = qRgb(val, val, val);
     616        }
    614617    }
    615618
     
    628631        return QImage();
    629632    QFixedPoint pt;
    630     pt.x = 0;
     633    pt.x = -glyph_x;
    631634    pt.y = -glyph_y; // the baseline
    632635    QPainterPath path;
    633     QImage im(glyph_width + qAbs(glyph_x) + 4, glyph_height, QImage::Format_ARGB32_Premultiplied);
     636    QImage im(glyph_width + 4, glyph_height, QImage::Format_ARGB32_Premultiplied);
    634637    im.fill(Qt::transparent);
    635638    QPainter p(&im);
     
    664667{
    665668    Properties p;
    666 #ifndef QT_NO_PRINTER
    667     QByteArray psname = QPdf::stripSpecialCharacters(fontDef.family.toUtf8());
    668 #else
    669     QByteArray psname = fontDef.family.toUtf8();
    670 #endif
     669    QByteArray psname = QFontEngine::convertToPostscriptFontFamilyName(fontDef.family.toUtf8());
    671670    psname += '-';
    672671    psname += QByteArray::number(fontDef.style);
     
    718717
    719718    // Limit the glyph caches to 4. This covers all 90 degree rotations and limits
    720     // memory use when there is continous or random rotation
     719    // memory use when there is continuous or random rotation
    721720    if (m_glyphCaches.size() == 4)
    722721        delete m_glyphCaches.takeLast().cache;
     
    871870    enum {
    872871        Invalid,
     872        AppleRoman,
    873873        Symbol,
    874         AppleRoman,
    875874        Unicode11,
    876875        Unicode,
     
    936935
    937936resolveTable:
    938     *isSymbolFont = (score == Symbol);
     937    *isSymbolFont = (symbolTable > -1);
    939938
    940939    unsigned int unicode_table = qFromBigEndian<quint32>(maps + 8*tableToUse + 4);
     
    10781077}
    10791078
     1079QByteArray QFontEngine::convertToPostscriptFontFamilyName(const QByteArray &family)
     1080{
     1081    QByteArray f = family;
     1082    f.replace(' ', "");
     1083    f.replace('(', "");
     1084    f.replace(')', "");
     1085    f.replace('<', "");
     1086    f.replace('>', "");
     1087    f.replace('[', "");
     1088    f.replace(']', "");
     1089    f.replace('{', "");
     1090    f.replace('}', "");
     1091    f.replace('/', "");
     1092    f.replace('%', "");
     1093    return f;
     1094}
     1095
    10801096Q_GLOBAL_STATIC_WITH_INITIALIZER(QVector<QRgb>, qt_grayPalette, {
    10811097    x->resize(256);
     
    10881104{
    10891105    return *qt_grayPalette();
     1106}
     1107
     1108QFixed QFontEngine::lastRightBearing(const QGlyphLayout &glyphs, bool round)
     1109{
     1110    if (glyphs.numGlyphs >= 1) {
     1111        glyph_t glyph = glyphs.glyphs[glyphs.numGlyphs - 1];
     1112        glyph_metrics_t gi = boundingBox(glyph);
     1113        if (gi.isValid())
     1114            return round ? QFixed(qRound(gi.xoff - gi.x - gi.width))
     1115                         : QFixed(gi.xoff - gi.x - gi.width);
     1116    }
     1117    return 0;
    10901118}
    10911119
Note: See TracChangeset for help on using the changeset viewer.