Changeset 846 for trunk/src/gui/text/qfontengine.cpp
- Timestamp:
- May 5, 2011, 5:36:53 AM (14 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk
- Property svn:mergeinfo changed
/branches/vendor/nokia/qt/4.7.2 (added) merged: 845 /branches/vendor/nokia/qt/current merged: 844 /branches/vendor/nokia/qt/4.6.3 removed
- Property svn:mergeinfo changed
-
trunk/src/gui/text/qfontengine.cpp
r769 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) … … 47 47 #include "qpainterpath.h" 48 48 #include "qvarlengtharray.h" 49 #include <private/qpdf_p.h>50 49 #include <qmath.h> 51 50 #include <qendian.h> … … 597 596 QImage i = alphaMapForGlyph(glyph); 598 597 if (t.type() > QTransform::TxTranslate) 599 i = i.transformed(t) ;598 i = i.transformed(t).convertToFormat(QImage::Format_Indexed8); 600 599 Q_ASSERT(i.depth() <= 8); // To verify that transformed didn't change the format... 600 601 601 return i; 602 602 } … … 607 607 QImage rgbMask(alphaMask.width(), alphaMask.height(), QImage::Format_RGB32); 608 608 609 QVector<QRgb> colorTable = alphaMask.colorTable(); 609 610 for (int y=0; y<alphaMask.height(); ++y) { 610 611 uint *dst = (uint *) rgbMask.scanLine(y); 611 612 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 } 614 617 } 615 618 … … 628 631 return QImage(); 629 632 QFixedPoint pt; 630 pt.x = 0;633 pt.x = -glyph_x; 631 634 pt.y = -glyph_y; // the baseline 632 635 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); 634 637 im.fill(Qt::transparent); 635 638 QPainter p(&im); … … 664 667 { 665 668 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()); 671 670 psname += '-'; 672 671 psname += QByteArray::number(fontDef.style); … … 718 717 719 718 // Limit the glyph caches to 4. This covers all 90 degree rotations and limits 720 // memory use when there is contin ous or random rotation719 // memory use when there is continuous or random rotation 721 720 if (m_glyphCaches.size() == 4) 722 721 delete m_glyphCaches.takeLast().cache; … … 871 870 enum { 872 871 Invalid, 872 AppleRoman, 873 873 Symbol, 874 AppleRoman,875 874 Unicode11, 876 875 Unicode, … … 936 935 937 936 resolveTable: 938 *isSymbolFont = (s core == Symbol);937 *isSymbolFont = (symbolTable > -1); 939 938 940 939 unsigned int unicode_table = qFromBigEndian<quint32>(maps + 8*tableToUse + 4); … … 1078 1077 } 1079 1078 1079 QByteArray 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 1080 1096 Q_GLOBAL_STATIC_WITH_INITIALIZER(QVector<QRgb>, qt_grayPalette, { 1081 1097 x->resize(256); … … 1088 1104 { 1089 1105 return *qt_grayPalette(); 1106 } 1107 1108 QFixed 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; 1090 1118 } 1091 1119
Note:
See TracChangeset
for help on using the changeset viewer.