Changeset 846 for trunk/src/gui/text/qfontengine_ft.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_ft.cpp
r651 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 201 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation ([email protected]) … … 52 52 #include "qthreadstorage.h" 53 53 #include <qmath.h> 54 #include <private/qpdf_p.h>55 54 #include <private/qharfbuzz_p.h> 56 55 … … 59 58 #include FT_FREETYPE_H 60 59 #include FT_OUTLINE_H 60 61 61 #include FT_TRUETYPE_TABLES_H 62 62 #include FT_TYPE1_TABLES_H … … 92 92 #define X_SIZE(face,i) ((face)->available_sizes[i].width << 6) 93 93 #define Y_SIZE(face,i) ((face)->available_sizes[i].height << 6) 94 95 96 97 98 99 100 94 101 #endif 95 102 … … 618 625 kerning_pairs_loaded = false; 619 626 transform = false; 627 620 628 antialias = true; 621 629 freetype = 0; 622 default_load_flags = 0;630 default_load_flags = ; 623 631 default_hint_style = HintNone; 624 632 subpixelType = Subpixel_None; … … 680 688 FT_Face face = lockFace(); 681 689 682 //underline metrics683 690 if (FT_IS_SCALABLE(face)) { 684 line_thickness = QFixed::fromFixed(FT_MulFix(face->underline_thickness, face->size->metrics.y_scale));685 underline_position = QFixed::fromFixed(-FT_MulFix(face->underline_position, face->size->metrics.y_scale));686 691 bool fake_oblique = (fontDef.style != QFont::StyleNormal) && !(face->style_flags & FT_STYLE_FLAG_ITALIC); 687 692 if (fake_oblique) … … 691 696 if (fake_oblique) 692 697 transform = true; 698 699 700 701 702 703 693 704 } else { 694 705 // copied from QFontEngineQPF … … 747 758 QFontEngineFT::Glyph *QFontEngineFT::loadGlyphMetrics(QGlyphSet *set, uint glyph) const 748 759 { 749 Glyph *g = set->g lyph_data.value(glyph);760 Glyph *g = set->g(glyph); 750 761 if (g) 751 762 return g; … … 790 801 791 802 FT_GlyphSlot slot = face->glyph; 803 792 804 int left = slot->metrics.horiBearingX; 793 805 int right = slot->metrics.horiBearingX + slot->metrics.width; … … 859 871 } 860 872 861 Glyph *g = set->g lyph_data.value(glyph);873 Glyph *g = set->g(glyph); 862 874 if (g && g->format == format) { 863 875 if (uploadToServer && !g->uploadedToServer) { 864 set-> glyph_data[glyph] = 0;876 set->; 865 877 delete g; 866 878 g = 0; … … 935 947 936 948 FT_GlyphSlot slot = face->glyph; 949 937 950 FT_Library library = qt_getFreetype(); 938 951 … … 1159 1172 } 1160 1173 1161 set-> glyph_data[glyph] = g;1174 set->; 1162 1175 1163 1176 return g; … … 1183 1196 Properties p = freetype->properties(); 1184 1197 if (p.postscriptName.isEmpty()) { 1185 p.postscriptName = fontDef.family.toUtf8(); 1186 #ifndef QT_NO_PRINTER 1187 p.postscriptName = QPdf::stripSpecialCharacters(p.postscriptName); 1188 #endif 1198 p.postscriptName = QFontEngine::convertToPostscriptFontFamilyName(fontDef.family.toUtf8()); 1189 1199 } 1190 1200 … … 1210 1220 if ((fontDef.style != QFont::StyleNormal) && !(freetype->face->style_flags & FT_STYLE_FLAG_ITALIC)) 1211 1221 s = SynthesizedItalic; 1222 1223 1212 1224 if (fontDef.stretch != 100 && FT_IS_SCALABLE(freetype->face)) 1213 1225 s |= SynthesizedStretch; … … 1369 1381 if (!gs) { 1370 1382 // don't try to load huge fonts 1371 bool draw_as_outline = fontDef.pixelSize * qSqrt( matrix.det()) >= 64;1383 bool draw_as_outline = fontDef.pixelSize * qSqrt()) >= 64; 1372 1384 if (draw_as_outline) 1373 1385 return 0; … … 1382 1394 gs = &transformedGlyphSets[0]; 1383 1395 1384 qDeleteAll(gs->glyph_data); 1385 gs->glyph_data.clear(); 1396 gs->clear(); 1386 1397 1387 1398 gs->id = allocateServerGlyphSet(); … … 1399 1410 1400 1411 for (int i = 0; i < num_glyphs; ++i) { 1401 Glyph *glyph = gs->g lyph_data.value(glyphs[i]);1412 Glyph *glyph = gs->g(glyphs[i]); 1402 1413 if (glyph == 0 || glyph->format != format) { 1403 1414 if (!face) { … … 1551 1562 for ( int i = 0; i < len; ++i ) { 1552 1563 unsigned int uc = getChar(str, i, len); 1553 if (mirrored)1554 uc = QChar::mirroredChar(uc);1555 1564 glyphs->glyphs[glyph_pos] = uc < QFreetypeFace::cmapCacheSize ? freetype->cmapCache[uc] : 0; 1556 1565 if ( !glyphs->glyphs[glyph_pos] ) { … … 1636 1645 if (flags & QTextEngine::DesignMetrics) { 1637 1646 for (int i = 0; i < glyphs->numGlyphs; i++) { 1638 Glyph *g = defaultGlyphSet.g lyph_data.value(glyphs->glyphs[i]);1647 Glyph *g = defaultGlyphSet.g(glyphs->glyphs[i]); 1639 1648 if (g) { 1640 1649 glyphs->advances_x[i] = QFixed::fromFixed(g->linearAdvance); … … 1649 1658 } else { 1650 1659 for (int i = 0; i < glyphs->numGlyphs; i++) { 1651 Glyph *g = defaultGlyphSet.g lyph_data.value(glyphs->glyphs[i]);1660 Glyph *g = defaultGlyphSet.g(glyphs->glyphs[i]); 1652 1661 if (g) { 1653 1662 glyphs->advances_x[i] = QFixed(g->advance); … … 1678 1687 QFixed xmax = 0; 1679 1688 for (int i = 0; i < glyphs.numGlyphs; i++) { 1680 Glyph *g = defaultGlyphSet.g lyph_data.value(glyphs.glyphs[i]);1689 Glyph *g = defaultGlyphSet.g(glyphs.glyphs[i]); 1681 1690 if (!g) { 1682 1691 if (!face) … … 1720 1729 FT_Face face = 0; 1721 1730 glyph_metrics_t overall; 1722 Glyph *g = defaultGlyphSet.g lyph_data.value(glyph);1731 Glyph *g = defaultGlyphSet.g(glyph); 1723 1732 if (!g) { 1724 1733 face = lockFace(); … … 1784 1793 } 1785 1794 glyphSet = &transformedGlyphSets[0]; 1786 qDeleteAll(glyphSet->glyph_data); 1787 glyphSet->glyph_data.clear(); 1795 glyphSet->clear(); 1788 1796 glyphSet->id = allocateServerGlyphSet(); 1789 1797 glyphSet->transformationMatrix = m; … … 1793 1801 glyphSet = &defaultGlyphSet; 1794 1802 } 1795 Glyph * g = glyphSet->g lyph_data.value(glyph);1803 Glyph * g = glyphSet->g(glyph); 1796 1804 if (!g) { 1797 1805 face = lockFace(); … … 1882 1890 void QFontEngineFT::removeGlyphFromCache(glyph_t glyph) 1883 1891 { 1884 de lete defaultGlyphSet.glyph_data.take(glyph);1892 dee(glyph); 1885 1893 } 1886 1894 … … 1938 1946 transformationMatrix.xy = 0; 1939 1947 transformationMatrix.yx = 0; 1948 1949 1940 1950 } 1941 1951 1942 1952 QFontEngineFT::QGlyphSet::~QGlyphSet() 1943 1953 { 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1944 1968 qDeleteAll(glyph_data); 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1945 1995 } 1946 1996
Note:
See TracChangeset
for help on using the changeset viewer.