diff options
author | Caleb Tennis <caleb@gentoo.org> | 2003-09-08 02:16:00 +0000 |
---|---|---|
committer | Caleb Tennis <caleb@gentoo.org> | 2003-09-08 02:16:00 +0000 |
commit | 7ef84ccf3a02d48d20e1314a42f6c4ef961c0344 (patch) | |
tree | 543f4dca93c1b30981c5906da13ef837550dd5aa /x11-libs | |
parent | bootstrap fixes (bug #28119); cleanup (diff) | |
download | gentoo-2-7ef84ccf3a02d48d20e1314a42f6c4ef961c0344.tar.gz gentoo-2-7ef84ccf3a02d48d20e1314a42f6c4ef961c0344.tar.bz2 gentoo-2-7ef84ccf3a02d48d20e1314a42f6c4ef961c0344.zip |
add some cjk complextext patches
Diffstat (limited to 'x11-libs')
-rw-r--r-- | x11-libs/qt/ChangeLog | 5 | ||||
-rw-r--r-- | x11-libs/qt/Manifest | 40 | ||||
-rw-r--r-- | x11-libs/qt/files/qt-3.1.2-qfont-jp-family-subst-20030421.patch | 692 | ||||
-rw-r--r-- | x11-libs/qt/files/qt-3.1.2-qpsprinter-ttc-otf-italic-20030429.patch | 701 | ||||
-rw-r--r-- | x11-libs/qt/qt-3.1.2-r4.ebuild | 4 |
5 files changed, 1421 insertions, 21 deletions
diff --git a/x11-libs/qt/ChangeLog b/x11-libs/qt/ChangeLog index 3d6012491639..753914ad288f 100644 --- a/x11-libs/qt/ChangeLog +++ b/x11-libs/qt/ChangeLog @@ -1,6 +1,9 @@ # ChangeLog for x11-libs/qt # Copyright 2002-2003 Gentoo Technologies, Inc.; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo-x86/x11-libs/qt/ChangeLog,v 1.81 2003/08/28 03:20:39 caleb Exp $ +# $Header: /var/cvsroot/gentoo-x86/x11-libs/qt/ChangeLog,v 1.82 2003/09/08 02:15:54 caleb Exp $ + + 07 Aug 2003; Caleb Tennis <caleb@gentoo.org> qt-3.1.2-r4.ebuid: + Add some complextext patches for cjk users (bug #27988) qt-3.2.1 (27 Aug 2003) diff --git a/x11-libs/qt/Manifest b/x11-libs/qt/Manifest index 33cc66aec0a7..a48872acfc92 100644 --- a/x11-libs/qt/Manifest +++ b/x11-libs/qt/Manifest @@ -1,32 +1,34 @@ -MD5 9552e0298183928a6eea527049af2abf ChangeLog 13756 +MD5 232c9a440f58d6f1a15c750ba4a25c48 qt-3.1.2-r3.ebuild 4979 MD5 3ea4b4de8bf408a89bad7560499c5517 qt-2.3.2-r1.ebuild 2274 -MD5 a3dd25c9f882f04df789dddc02ed3177 qt-3.0.5-r2.ebuild 3896 MD5 fff05a8ffe1dc01bffbae10c5f80132c qt-3.2.1.ebuild 4459 +MD5 a3dd25c9f882f04df789dddc02ed3177 qt-3.0.5-r2.ebuild 3896 MD5 00e9d63f2373eecbf8d070845e3ed794 qt-3.1.0-r3.ebuild 4698 -MD5 512150b47a904b0240101e319856aab1 metadata.xml 156 -MD5 4cafb9e92daa70ee87b1a740efabff17 qt-3.1.2-r4.ebuild 5193 +MD5 aff33d960efe2f7ef7782bd0a7cc9441 qt-3.1.2-r4.ebuild 5340 MD5 b1227e9708a51d583e96b533764e5f5c qt-3.1.1-r2.ebuild 4510 -MD5 232c9a440f58d6f1a15c750ba4a25c48 qt-3.1.2-r3.ebuild 4979 MD5 c2026904ef73059c2f6e8138d2d62caa qt-3.2.0.ebuild 4339 -MD5 08cdd879d3418837cf4bad594dc0f91f files/45qtdir2 16 +MD5 cd35bc093649b16c54e9e4384c443e1d ChangeLog 13881 +MD5 512150b47a904b0240101e319856aab1 metadata.xml 156 MD5 2d5b68b38185a30a28ffb2b652258cb8 files/45qt3 83 -MD5 7dc4f78d52452c28ba797ffc7db34f23 files/50qtdir3 16 MD5 7a287bc7609ad2420f70af6d4c58302f files/50qt2 63 -MD5 1da4214f7cf90d34592e0453f47b4758 files/designer.diff 380 -MD5 037b7ee164790946df6a2d6ea89f01fc files/digest-qt-2.3.2-r1 65 -MD5 c8a8d41028d22397dcc86041f1856a79 files/digest-qt-3.0.5-r2 71 +MD5 edd5c27031cc5f29070a9094425f09d9 files/digest-qt-3.2.0 72 MD5 b79277b535797e854be75d1c396de0f2 files/digest-qt-3.2.1 72 -MD5 f197d87f2b33685cadba08c9cf2d08ee files/digest-qt-3.1.2-r4 72 +MD5 c6dc1b6fadcb4897d4c7b0a768c2d196 files/qt-3.1.2-r3-qsocket.diff 447 +MD5 04fdd1779f4aca06b809528a2d0bad7a files/qt-3.1.2-coreutils-fixup.patch 4203 +MD5 b87df8ba9bf813ffe5e280fa2d79da25 files/qt-3.1.2-qpsprinter-ttc-otf-italic-20030429.patch 19286 +MD5 001400cb2710d783deb4380ca6056bc2 files/qsocket-3.1.2.diff 3136 +MD5 c8a8d41028d22397dcc86041f1856a79 files/digest-qt-3.0.5-r2 71 MD5 52e7df9b93f281c262716caac4cb7705 files/digest-qt-3.1.0-r3 72 -MD5 bf7aed227565288222ea889c81b1e363 files/qt-3.1.2-qlistview-dnd.diff 469 MD5 cfa73af7c2f2661be4ea9f3c9347db84 files/digest-qt-3.1.1-r2 72 -MD5 953be971128fb1a5ad7d9893f657e13c files/qt-3.1.2-korean-xim.patch 4285 MD5 f197d87f2b33685cadba08c9cf2d08ee files/digest-qt-3.1.2-r3 72 -MD5 001400cb2710d783deb4380ca6056bc2 files/qsocket-3.1.2.diff 3136 -MD5 39f840d6723a7e898394bc84efb224a2 files/qt-3.1.0-minimized.diff 272 +MD5 f197d87f2b33685cadba08c9cf2d08ee files/digest-qt-3.1.2-r4 72 +MD5 024632ca815ede1ccdd13cacea10e64a files/qt-3.1.2-thai-complextext.patch 528 +MD5 1da4214f7cf90d34592e0453f47b4758 files/designer.diff 380 +MD5 7dc4f78d52452c28ba797ffc7db34f23 files/50qtdir3 16 +MD5 08cdd879d3418837cf4bad594dc0f91f files/45qtdir2 16 MD5 e9b2e2fbde862abb62cdfa78e62a35b6 files/qt-3.1.2-qmlined.diff 320 -MD5 c6dc1b6fadcb4897d4c7b0a768c2d196 files/qt-3.1.2-r3-qsocket.diff 447 +MD5 953be971128fb1a5ad7d9893f657e13c files/qt-3.1.2-korean-xim.patch 4285 MD5 e4b92fbf81b7fc94c5d337e1675476d7 files/qt-x11-free-3.0.5-ko_input.patch 12682 -MD5 04fdd1779f4aca06b809528a2d0bad7a files/qt-3.1.2-coreutils-fixup.patch 4203 -MD5 edd5c27031cc5f29070a9094425f09d9 files/digest-qt-3.2.0 72 -MD5 024632ca815ede1ccdd13cacea10e64a files/qt-3.1.2-thai-complextext.patch 528 +MD5 037b7ee164790946df6a2d6ea89f01fc files/digest-qt-2.3.2-r1 65 +MD5 8c9b47edf5949643d8dbeb3fecc40e7c files/qt-3.1.2-qfont-jp-family-subst-20030421.patch 22730 +MD5 bf7aed227565288222ea889c81b1e363 files/qt-3.1.2-qlistview-dnd.diff 469 +MD5 39f840d6723a7e898394bc84efb224a2 files/qt-3.1.0-minimized.diff 272 diff --git a/x11-libs/qt/files/qt-3.1.2-qfont-jp-family-subst-20030421.patch b/x11-libs/qt/files/qt-3.1.2-qfont-jp-family-subst-20030421.patch new file mode 100644 index 000000000000..ddd1d1133b1e --- /dev/null +++ b/x11-libs/qt/files/qt-3.1.2-qfont-jp-family-subst-20030421.patch @@ -0,0 +1,692 @@ +diff -u qt-x11-free-3.1.2/src-orig/kernel/qapplication_x11.cpp qt-x11-free-3.1.2/src/kernel/qapplication_x11.cpp +--- qt-x11-free-3.1.2/src-orig/kernel/qapplication_x11.cpp Sat Mar 8 20:37:50 2003 ++++ qt-x11-free-3.1.2/src/kernel/qapplication_x11.cpp Mon Apr 21 21:28:22 2003 +@@ -979,7 +979,7 @@ + QString fam, skey; + QStringList::Iterator it = fontsubs.begin(); + while (it != fontsubs.end()) { +- fam = (*it++).latin1(); ++ fam = *it++; + skey = "/qt/Font Substitutions/" + fam; + subs = settings.readListEntry(skey); + QFont::insertSubstitutions(fam, subs); +@@ -1007,7 +1007,10 @@ + xftDone = TRUE; + qt_has_xft = FALSE; + qt_use_antialiasing = FALSE; +- if (qt_use_xrender && ++ if ( ++#ifndef QT_XFT2 ++ qt_use_xrender && ++#endif // QT_XFT2 + XftInit(0) && XftInitFtLibrary()) { + qt_has_xft = settings.readBoolEntry( "/qt/enableXft", TRUE ); + qt_use_antialiasing = settings.readBoolEntry( "/qt/useXft", TRUE ); +diff -u qt-x11-free-3.1.2/src-orig/kernel/qfont.cpp qt-x11-free-3.1.2/src/kernel/qfont.cpp +--- qt-x11-free-3.1.2/src-orig/kernel/qfont.cpp Mon Feb 24 17:30:09 2003 ++++ qt-x11-free-3.1.2/src/kernel/qfont.cpp Thu Apr 17 22:51:07 2003 +@@ -2951,8 +2951,13 @@ + #endif //Q_WS_QWS + + #ifdef Q_WS_X11 ++static QFont::Script x11ProperScript( QFontPrivate *priv, const QChar &c ); ++ + #define SCRIPT_FOR_CHAR( script, c, priv ) \ + do { \ ++ script = x11ProperScript( priv, c ); \ ++ if ( script != QFont::UnknownScript ) \ ++ break; \ + unsigned short _uc = (c).unicode(); \ + if ( _uc < 0x100 ) { \ + script = QFont::LatinBasic; \ +diff -u qt-x11-free-3.1.2/src-orig/kernel/qfont_x11.cpp qt-x11-free-3.1.2/src/kernel/qfont_x11.cpp +--- qt-x11-free-3.1.2/src-orig/kernel/qfont_x11.cpp Mon Feb 24 17:30:15 2003 ++++ qt-x11-free-3.1.2/src/kernel/qfont_x11.cpp Mon Apr 21 21:27:06 2003 +@@ -1199,7 +1199,7 @@ + } else { + overall->ascent = QMAX(overall->ascent, xgi->y*scale); + overall->descent = QMAX(overall->descent, (xgi->height - xgi->y)*scale); +- overall->lbearing = QMIN(overall->lbearing, -xgi->x*scale); ++ overall->lbearing = QMIN(overall->lbearing, overall->width - xgi->x*scale); + overall->rbearing = QMAX(overall->rbearing, overall->width + + (xgi->width - xgi->x)*scale); + overall->width += xgi->xOff; +@@ -1417,22 +1417,47 @@ + + #ifndef QT_NO_XFTFREETYPE + +-static XftPattern *checkXftFont( XftPattern *match, const QString &familyName, const QChar &sample ) ++static XftPattern *checkXftFont( XftPattern *match, ++ const QString &familyName, const QString &foundryName, ++ const QChar &sample, const QChar *sample2 = 0 ) + { +-#ifndef QT_XFT2 +- char * family_value; +- XftPatternGetString (match, XFT_FAMILY, 0, &family_value); +- QString fam = family_value; +- //qDebug("got family %s for request %s", fam.latin1(), familyName.latin1() ); ++ bool mismatch = TRUE; ++ if ( familyName.isEmpty() ) ++ mismatch = FALSE; ++ else ++ { ++ char * family_value; ++ XftPatternGetString (match, XFT_FAMILY, 0, &family_value); ++ QString fam = QString::fromUtf8( family_value ).lower(); ++ //qDebug("got family %s foundry %s for request %s / %s", ++ // fam.local8Bit().data(), fnd.latin1(), ++ // familyName.local8Bit().data(), foundryName.latin1() ); ++ ++ if ( !foundryName.isNull() ) { ++ char * foundry_value; ++ QString fnd = QString::null; ++ if ( XftPatternGetString( match, XFT_FOUNDRY, ++ 0, &foundry_value ) == XftResultMatch ) ++ fnd = QString( foundry_value ).lower(); ++ ++ if ( fnd == foundryName.lower() && fam == familyName.lower() ) { ++ mismatch = FALSE; ++ } else { ++ QString fullName = foundryName + "-" + familyName; ++ ++ if ( fam == fullName.lower() ) ++ mismatch = FALSE; ++ } ++ } ++ else if ( fam == familyName.lower() ) ++ mismatch = FALSE; ++ } + +- if ( fam.lower() != familyName.lower() ) { ++ if ( mismatch ) { + //qDebug("pattern don't match"); + XftPatternDestroy(match); + match = 0; + } +-#else +- Q_UNUSED( familyName ); +-#endif + + if (match && sample.unicode() != 0 ) { + // check if the character is actually in the font - this does result in +@@ -1441,7 +1466,8 @@ + #ifdef QT_XFT2 + FcCharSet *c; + if (FcPatternGetCharSet(match, FC_CHARSET, 0, &c) == FcResultMatch) { +- if (!FcCharSetHasChar(c, sample.unicode())) { ++ if (!FcCharSetHasChar(c, sample.unicode()) && ++ (!sample2 || !FcCharSetHasChar(c, sample2->unicode()))) { + XftPatternDestroy(match); + match = 0; + } +@@ -1452,8 +1478,11 @@ + if (xftfs) { + if ( ! XftFreeTypeGlyphExists(QPaintDevice::x11AppDisplay(), xftfs, + sample.unicode())) { +- XftPatternDestroy(match); +- match = 0; ++ if (!sample2 || !XftFreeTypeGlyphExists(QPaintDevice::x11AppDisplay(), ++ xftfs, sample2->unicode())) { ++ XftPatternDestroy(match); ++ match = 0; ++ } + } + + XftFreeTypeClose(QPaintDevice::x11AppDisplay(), xftfs); +@@ -1468,17 +1497,28 @@ + // be found + XftPattern *QFontPrivate::findXftFont(const QChar &sample, bool *exact, double *scale) const + { ++ return findXftFont(sample, exact, scale, 0, FALSE); ++} ++ ++XftPattern *QFontPrivate::findXftFont(const QChar &sample, bool *exact, double *scale, ++ const QChar *sample2, bool onlySubst) const ++{ + // look for foundry/family + QString familyName; + QString foundryName; + +- QFontDatabase::parseFontName(request.family, foundryName, familyName); +- XftPattern *match = bestXftPattern(familyName, foundryName, sample, scale); ++ QChar ch(0); + +- if ( match ) +- match = checkXftFont( match, familyName, sample ); ++ XftPattern *match = 0; ++ if (!onlySubst) { ++ QFontDatabase::parseFontName(request.family, foundryName, familyName); ++ match = bestXftPattern(familyName, foundryName, ch, scale); + +- *exact = TRUE; ++ if ( match ) ++ match = checkXftFont( match, familyName, foundryName, sample, sample2 ); ++ ++ *exact = TRUE; ++ } + + if (match) + return match; +@@ -1494,13 +1534,24 @@ + + if (request.family != familyName) { + QFontDatabase::parseFontName(familyName, foundryName, familyName); +- match = bestXftPattern(familyName, foundryName, sample, scale); ++ match = bestXftPattern(familyName, foundryName, ch, scale); + + if ( match ) +- match = checkXftFont( match, familyName, sample ); ++ match = checkXftFont( match, familyName, foundryName, sample, sample2 ); + } + } + ++ if (match) ++ return match; ++ ++ if (!onlySubst) { ++ QFontDatabase::parseFontName(request.family, foundryName, familyName); ++ match = bestXftPattern(familyName, foundryName, sample, scale); ++ ++ if ( match ) ++ match = checkXftFont( match, QString::null, QString::null, sample, sample2 ); ++ } ++ + return match; + } + +@@ -1575,6 +1626,8 @@ + + XftResult res; + XftPattern *pattern = 0, *result = 0; ++ bool hasFoundry = ( !foundryName.isNull() && foundryName.lower() != "xft" ); ++ QString fullName = foundryName + "-" + familyName; + + pattern = XftPatternCreate(); + if ( ! pattern ) return 0; +@@ -1582,10 +1635,12 @@ + #ifndef QT_XFT2 + XftPatternAddString (pattern, XFT_ENCODING, "iso10646-1"); + #endif +- if (! foundryName.isNull()) ++ if ( hasFoundry ) + XftPatternAddString (pattern, XFT_FOUNDRY, foundryName.latin1()); + if (! familyName.isNull()) +- XftPatternAddString (pattern, XFT_FAMILY, familyName.latin1()); ++ XftPatternAddString (pattern, XFT_FAMILY, familyName.utf8().data()); ++ if ( hasFoundry && !familyName.isNull() ) ++ XftPatternAddString( pattern, XFT_FAMILY, fullName.utf8().data() ); + XftPatternAddString (pattern, XFT_FAMILY, generic_value.data()); + + if (mono_value >= XFT_MONO) +@@ -1618,6 +1673,32 @@ + + result = XftFontMatch(QPaintDevice::x11AppDisplay(), + x11Screen, pattern, &res); ++ ++#ifdef QT_XFT2 ++ if ( result && hasFoundry ) { ++ char *family_value; ++ XftPatternGetString( result, XFT_FAMILY, 0, &family_value ); ++ QString fam = QString::fromUtf8( family_value ).lower(); ++ ++ if ( fam != familyName.lower() && fam != fullName.lower() ) { ++ XftPatternDel( pattern, XFT_FOUNDRY ); ++ XftPattern *result2 = XftFontMatch(QPaintDevice::x11AppDisplay(), ++ x11Screen, pattern, &res); ++ if ( result2 ) { ++ XftPatternGetString( result2, XFT_FAMILY, 0, &family_value ); ++ fam = QString::fromUtf8( family_value ).lower(); ++ ++ if ( fam == familyName.lower() || fam == fullName.lower() ) { ++ XftPatternDestroy( result ); ++ result = result2; ++ } else { ++ XftPatternDestroy( result2 ); ++ } ++ } ++ } ++ } ++#endif ++ + XftPatternDestroy(pattern); + + return result; +@@ -1646,6 +1727,7 @@ + { + *scale = 1.; + QString familyName = request.family; ++ bool need_exact = *exact; + + // assume exact match + *exact = TRUE; +@@ -1686,7 +1768,7 @@ + if ( score < exactScore ) + *exact = FALSE; + +- if (! bestName.isNull()) ++ if (! bestName.isNull() || need_exact) + return bestName; + + // try substitution +@@ -2221,7 +2303,7 @@ + else + weight_value = QFont::Normal; + +- actual.family = family_value; ++ actual.family = QString::fromUtf8(family_value); + actual.weight = weight_value; + actual.italic = (slant_value != XFT_SLANT_ROMAN); + actual.fixedPitch = (spacing_value >= XFT_MONO); +@@ -2339,6 +2421,39 @@ + return QFont::Han; + } + ++static QFont::Script x11ProperScript( QFontPrivate *priv, const QChar &c ) ++{ ++ if ( QFontPrivate::defaultScript == QFont::UnknownScript ) ++ return QFont::UnknownScript; ++ ++ priv->load( QFontPrivate::defaultScript ); ++ ++#ifndef QT_NO_XFTFREETYPE ++ QFontStruct *qfs = priv->x11data.fontstruct[QFont::Unicode]; ++ if ( qfs && qfs != (QFontStruct *) -1 ) { ++ if ( qfs->xfthandle ) { ++ if ( XftGlyphExists(QPaintDevice::x11AppDisplay(), ++ (XftFont *) qfs->xfthandle, c.unicode()) ) ++ return QFont::Unicode; ++ else ++ return QFont::UnknownScript; ++ } ++ } ++#endif // QT_NO_XFTFREETYPE ++ ++ qfs = priv->x11data.fontstruct[QFontPrivate::defaultScript]; ++ if ( qfs != (QFontStruct *) -1 ) { ++ Q_ASSERT( qfs != 0 ); ++ if ( !qfs->xfthandle && qfs->codec && qfs->codec->canEncode ( c ) ) { ++ XCharStruct *xcs = getCharStruct(qfs, QString(c), 0); ++ if ( ! charNonExistent(xcs) ) ++ return QFontPrivate::defaultScript; ++ } ++ } ++ ++ return QFont::UnknownScript; ++} ++ + + // Loads the font for the specified script + static inline int maxIndex(XFontStruct *f) { +@@ -2348,13 +2463,13 @@ + } + + // returns a sample unicode character for the specified script +-static QChar sampleCharacter(QFont::Script script) ++static QChar sampleCharacter(QFont::Script script, QChar& sample2) + { +- ushort ch; ++ ushort ch, ch2 = 0; + + switch (script) { + case QFont::Latin: ch = 0x0030; break; +- case QFont::Greek: ch = 0x0390; break; ++ case QFont::Greek: ch = 0x0390; ch2 = 0x0391; break; + case QFont::Cyrillic: ch = 0x0410; break; + case QFont::Armenian: ch = 0x0540; break; + case QFont::Georgian: ch = 0x10a0; break; +@@ -2396,12 +2511,12 @@ + case QFont::Mongolian: ch = 0x1800; break; + + case QFont::CurrencySymbols: ch = 0x20aa; break; +- case QFont::LetterlikeSymbols: ch = 0x2122; break; +- case QFont::NumberForms: ch = 0x215b; break; ++ case QFont::LetterlikeSymbols: ch = 0x2122; ch2 = 0x2116; break; ++ case QFont::NumberForms: ch = 0x215b; ch2 = 0x2160; break; + case QFont::MathematicalOperators: ch = 0x222b; break; +- case QFont::TechnicalSymbols: ch = 0x2440; break; ++ case QFont::TechnicalSymbols: ch = 0x2440; ch2 = 0x2312; break; + case QFont::GeometricSymbols: ch = 0x2500; break; +- case QFont::MiscellaneousSymbols: ch = 0x2600; break; ++ case QFont::MiscellaneousSymbols: ch = 0x2600; ch2 = 0x2640; break; + case QFont::EnclosedAndSquare: ch = 0x2460; break; + case QFont::Braille: ch = 0x2800; break; + +@@ -2411,16 +2526,26 @@ + case QFont::LatinExtendedA_14: ch = 0x0174; break; + case QFont::LatinExtendedA_15: ch = 0x0152; break; + ++ case QFont::KatakanaHalfWidth: ch = 0xff71; break; ++ ++ + default: + ch = 0; + } + ++ sample2.unicode() = ch2; ++ + return QChar(ch); + } + + + bool QFontPrivate::loadUnicode(QFont::Script script, const QChar &sample) + { ++ return loadUnicode(script, sample, 0); ++} ++ ++bool QFontPrivate::loadUnicode(QFont::Script script, const QChar &sample, const QChar* sample2) ++{ + bool hasChar = FALSE; + QFontStruct *qfs = x11data.fontstruct[QFont::Unicode]; + +@@ -2471,6 +2596,10 @@ + hasChar = XftGlyphExists(QPaintDevice::x11AppDisplay(), + (XftFont *) qfs->xfthandle, + sample.unicode()); ++ if (!hasChar && sample2) ++ hasChar = XftGlyphExists(QPaintDevice::x11AppDisplay(), ++ (XftFont *) qfs->xfthandle, ++ sample2->unicode()); + } + #endif // QT_NO_XFTFREETYPE + +@@ -2494,6 +2623,11 @@ + + void QFontPrivate::load(QFont::Script script, bool tryUnicode) + { ++ load(script, tryUnicode, FALSE); ++} ++ ++void QFontPrivate::load(QFont::Script script, bool tryUnicode, bool onlySubstXft) ++{ + // Make sure fontCache is initialized + if (! fontCache) { + #ifdef QT_CHECK_STATE +@@ -2537,12 +2671,31 @@ + actual.dirty = TRUE; + } + +- QChar sample = sampleCharacter(script); ++ QChar sample2; ++ QChar sample = sampleCharacter(script, sample2); + // look for a unicode font first, and see if it has the script that we want... +- if (tryUnicode && loadUnicode(script, sample)) { ++ if (tryUnicode && !onlySubstXft && ++ loadUnicode(script, sample, (sample2.unicode() != 0)? &sample2 : 0)) { + request.dirty = FALSE; ++ if (script != QFont::Unicode && script != defaultScript) { ++ QFontStruct *qfs_uni = x11data.fontstruct[script]; ++ x11data.fontstruct[script] = 0; ++ load(script, FALSE, TRUE); ++ QFontStruct *qfs = x11data.fontstruct[script]; ++ if (qfs && qfs != (QFontStruct *) -1) ++ qfs_uni->deref(); ++ else ++ x11data.fontstruct[script] = qfs_uni; ++ } + return; + } ++ else if (tryUnicode && !onlySubstXft && script != QFont::Unicode && script != defaultScript) { ++ QFontStruct *qfs = x11data.fontstruct[QFont::Unicode]; ++ if (qfs && qfs != (QFontStruct *) -1) { ++ load(script, FALSE, TRUE); ++ return; ++ } ++ } + + QFontStruct *qfs = 0; + QCString fontname; +@@ -2568,7 +2721,7 @@ + // if we don't find the name in the dict, we need to find a font name + + #ifdef QFONTLOADER_DEBUG_VERBOSE +- qDebug("QFontLoader: getting font name for family %s", request.family.latin1()); ++ qDebug("QFontLoader: getting font name for family %s", request.family.local8Bit().data()); + #endif + + QString name; +@@ -2578,16 +2731,26 @@ + #ifndef QT_NO_XFTFREETYPE + if (qt_has_xft && ! (request.styleStrategy & QFont::PreferBitmap) && + ! request.rawMode ) { +- xftmatch = findXftFont(sample, &match, &scale); ++ xftmatch = findXftFont(sample, &match, &scale, ++ (sample2.unicode() != 0)? &sample2 : 0, onlySubstXft); + + if (xftmatch) { +- use_core = FALSE; ++ if (match) ++ use_core = FALSE; ++ ++ XftPattern *pat = XftPatternDuplicate(xftmatch); ++#ifdef QT_XFT2 ++ XftPatternDel(pat, FC_CHARSET); ++ XftPatternDel(pat, FC_LANG); ++ XftPatternDel(pat, FC_MATRIX); ++#endif + + char fn[1024]; +- XftNameUnparse(xftmatch, fn, sizeof(fn)); ++ XftNameUnparse(pat, fn, sizeof(fn)); ++ XftPatternDestroy(pat); + fn[1023] = '\0'; // just in case + +- name = fn; ++ name = QString::fromUtf8(fn); + } + } + #endif // QT_NO_XFTFREETYPE +@@ -2602,7 +2765,18 @@ + else if ( script != QFontPrivate::defaultScript ) + name = QString::null; + } else { +- name = findFont(script, &match, &scale); ++ match = (xftmatch && script != QFont::Unicode); ++ QString xlfdname = findFont(script, &match, &scale); ++ // Select xft font if not exact match ++ if (!match && xftmatch && script != QFont::Unicode) { ++ match = TRUE; ++ use_core = FALSE; ++ } else { ++ if (xftmatch) ++ XftPatternDestroy(xftmatch); ++ xftmatch = 0; ++ name = xlfdname; ++ } + } + } + +@@ -2617,12 +2791,12 @@ + } + + #ifdef QFONTLOADER_DEBUG_VERBOSE +- qDebug("QFontLoader: putting '%s' (%d) into name dict", name.latin1(), ++ qDebug("QFontLoader: putting '%s' (%d) into name dict", name.data(), + name.length()); + #endif + + // Put font name into fontNameDict +- qxfn = new QXFontName(name.latin1(), match, use_core); ++ qxfn = new QXFontName(name.utf8(), match, use_core); + Q_CHECK_PTR(qxfn); + fontNameDict->insert(k, qxfn); + +@@ -2667,9 +2841,10 @@ + if (! qxfn->useCore) { + if (! xftmatch) { + XftResult res; +- xftmatch = XftNameParse(qxfn->name.data()); ++ XftPattern *pat = XftNameParse(qxfn->name.data()); + xftmatch = XftFontMatch(QPaintDevice::x11AppDisplay(), +- x11Screen, xftmatch, &res); ++ x11Screen, pat, &res); ++ XftPatternDestroy(pat); + } + + #ifdef QFONTLOADER_DEBUG +diff -u qt-x11-free-3.1.2/src-orig/kernel/qfontdata_p.h qt-x11-free-3.1.2/src/kernel/qfontdata_p.h +--- qt-x11-free-3.1.2/src-orig/kernel/qfontdata_p.h Mon Feb 24 17:30:10 2003 ++++ qt-x11-free-3.1.2/src/kernel/qfontdata_p.h Thu Apr 17 22:51:07 2003 +@@ -387,7 +387,13 @@ + GC gc, const QColor &pen, Qt::BGMode, const QColor &bgcolor, + int x, int y, const TextRun *cache, int pdWidth ); + bool inFont( const QChar &ch ); ++private: ++ XftPattern *findXftFont(const QChar &, bool *, double *scale, ++ const QChar *sample2, bool onlySubst) const; ++ void load(QFont::Script, bool, bool onlySubstXft); ++ bool loadUnicode(QFont::Script, const QChar &, const QChar *sample2); + ++public: + QFontX11Data x11data; + static QFont::Script defaultScript; + int x11Screen; +diff -u qt-x11-free-3.1.2/src-orig/kernel/qfontdatabase.cpp qt-x11-free-3.1.2/src/kernel/qfontdatabase.cpp +--- qt-x11-free-3.1.2/src-orig/kernel/qfontdatabase.cpp Mon Feb 24 17:30:13 2003 ++++ qt-x11-free-3.1.2/src/kernel/qfontdatabase.cpp Thu Apr 17 22:51:07 2003 +@@ -57,6 +57,15 @@ + bool italic, bool lesserItalic, int weight ); + #endif + ++static QString qt_fontname_toLower( const QString &fontName ) ++{ ++#if defined( Q_WS_X11 ) ++ return QString::fromUtf8( fontName.utf8().lower() ); ++#else ++ return fontName.lower(); ++#endif ++} ++ + class QtFontStyle + { + public: +@@ -259,7 +268,7 @@ + + bool namesDirty; + +- void addFamily( QtFontFamily *f ) { familyDict.insert( f->name().lower(), f ); } ++ void addFamily( QtFontFamily *f ) { familyDict.insert( qt_fontname_toLower(f->name()), f ); } + + friend void QFontDatabase::createDatabase(); + +@@ -659,7 +668,7 @@ + const QtFontFamily *bitmapScalable = 0; + + for( ; (fndry = iter.current()) ; ++iter ) { +- fam = fndry->family( name.lower() ); ++ fam = fndry->family( qt_fontname_toLower( name ) ); + + if ( fam ) { + if ( fam->isSmoothlyScalable() ) { +@@ -1605,7 +1614,7 @@ + if ( name.contains('-') ) { + int i = name.find('-'); + foundry = name.left( i ).lower(); +- family = name.right( name.length() - i - 1 ).lower(); ++ family = qt_fontname_toLower( name.right( name.length() - i - 1 ) ); + } else if ( name.contains('[') && name.contains(']')) { + int i = name.find('['); + int li = name.findRev(']'); +@@ -1614,13 +1623,11 @@ + foundry = name.mid(i + 1, li - i - 1).lower(); + if (name[i - 1] == ' ') + i--; +- family = name.left(i).lower(); ++ family = qt_fontname_toLower( name.left(i) ); + } + } else { + foundry = QString::null; +- family = name.lower(); ++ family = qt_fontname_toLower( name ); + } + } +- +- + #endif // QT_NO_FONTDATABASE +diff -u qt-x11-free-3.1.2/src-orig/kernel/qfontdatabase_x11.cpp qt-x11-free-3.1.2/src/kernel/qfontdatabase_x11.cpp +--- qt-x11-free-3.1.2/src-orig/kernel/qfontdatabase_x11.cpp Mon Feb 24 17:30:10 2003 ++++ qt-x11-free-3.1.2/src/kernel/qfontdatabase_x11.cpp Thu Apr 17 22:51:07 2003 +@@ -247,6 +247,9 @@ + int spacing_value; + bool created_foundry = FALSE; + bool created_family = FALSE; ++#ifdef QT_XFT2 ++ const QString style_string[3] = { "Bold", "Oblique", "Bold Oblique" }; ++#endif + + foundries = XftListFonts (QPaintDevice::x11AppDisplay(), + QPaintDevice::x11AppScreen(), +@@ -284,19 +287,25 @@ + XftListFonts(QPaintDevice::x11AppDisplay(), + QPaintDevice::x11AppScreen(), + (const char *)0, +- XFT_FAMILY, (const char *)0); ++ XFT_FOUNDRY, XFT_FAMILY, (const char *)0); + + for (int f = 0; f < families->nfont; f++) { + created_family = FALSE; + ++ if (!hasFoundries) ++ if (XftPatternGetString(families->fonts[f], ++ XFT_FOUNDRY, 0, &value) == XftResultMatch) ++ continue; ++ + if (XftPatternGetString(families->fonts[f], + XFT_FAMILY, 0, &value) == XftResultMatch) { + familyName = value; ++ QString fam = QString::fromUtf8(value); + + QtFontFamily *family = +- foundry->familyDict.find( familyName.lower() ); ++ foundry->familyDict.find( qt_fontname_toLower( fam ) ); + if ( ! family ) { +- family = new QtFontFamily ( foundry, familyName.lower() ); ++ family = new QtFontFamily ( foundry, fam ); + Q_CHECK_PTR (family); + created_family = TRUE; + } +@@ -319,6 +328,10 @@ + XFT_STYLE, XFT_WEIGHT, XFT_SLANT, XFT_SPACING, + (const char *)0); + ++#ifdef QT_XFT2 ++ bool styles_check[8] = { FALSE, FALSE, FALSE, FALSE, ++ FALSE, FALSE, FALSE, FALSE }; ++#endif + for (int s = 0; s < styles->nfont; s++) { + if (XftPatternGetString (styles->fonts[s], + XFT_STYLE, 0, &value) == +@@ -345,8 +358,34 @@ + style->setFixedPitch(); + style->setSmoothlyScalable(); + family->addStyle (style); ++#ifdef QT_XFT2 ++ int sty_id = ((weight_value > XFT_WEIGHT_MEDIUM)? 1 : 0) + ++ ((slant_value > XFT_SLANT_ROMAN)? 2 : 0) + ++ ((spacing_value >= XFT_MONO)? 4 : 0); ++ styles_check[sty_id] = TRUE; ++#endif ++ } ++ } ++ ++#ifdef QT_XFT2 ++ for (int i = 0; i <= 4; i += 4) { ++ if (!styles_check[i] && !styles_check[i + 1] && !styles_check[i + 2]) ++ continue; ++ for (int j = 1; j < 4; j++) { ++ if (styles_check[i + j]) ++ continue; ++ QtFontStyle *style = new QtFontStyle (family, style_string[j - 1]); ++ style->ital = (j >= 2); ++ style->lesserItal = FALSE; ++ weight_value = (j % 2)? XFT_WEIGHT_BOLD : XFT_WEIGHT_MEDIUM; ++ style->weightString = getXftWeightString(weight_value); ++ if (i > 0) ++ style->setFixedPitch(); ++ style->setSmoothlyScalable(); ++ family->addStyle (style); + } + } ++#endif + + if ( created_family ) { + if ( created_foundry ) { diff --git a/x11-libs/qt/files/qt-3.1.2-qpsprinter-ttc-otf-italic-20030429.patch b/x11-libs/qt/files/qt-3.1.2-qpsprinter-ttc-otf-italic-20030429.patch new file mode 100644 index 000000000000..56ca050ef6a4 --- /dev/null +++ b/x11-libs/qt/files/qt-3.1.2-qpsprinter-ttc-otf-italic-20030429.patch @@ -0,0 +1,701 @@ +--- qt-x11-free-3.1.2/src-orig/kernel/qpsprinter.cpp Mon Feb 24 17:30:09 2003 ++++ qt-x11-free-3.1.2/src/kernel/qpsprinter.cpp Tue Apr 29 04:25:46 2003 +@@ -90,9 +90,18 @@ + #endif + #endif + ++#undef Q_PRINTER_USE_FREETYPE2 + #ifdef Q_WS_X11 + #include "qfontdata_p.h" + extern bool qt_has_xft; ++#ifndef QT_NO_XFTFREETYPE ++#define Q_PRINTER_USE_FREETYPE2 ++#endif ++#endif ++ ++#ifdef Q_PRINTER_USE_FREETYPE2 ++#include <ft2build.h> ++#include FT_OUTLINE_H + #endif + + static bool qt_gen_epsf = FALSE; +@@ -2016,7 +2025,8 @@ + class QPSPrinterFontTTF + : public QPSPrinterFontPrivate { + public: +- QPSPrinterFontTTF(const QFont &f, QByteArray& data); ++ QPSPrinterFontTTF(const QFont &f, QByteArray& data, ++ const QString &extra_key = QString::null); + virtual void download(QTextStream& s, bool global); + // virtual ~QPSPrinterFontTTF(); + +@@ -2088,6 +2098,21 @@ + + int indexToLocFormat; /* short or long offsets */ + ++ int ttc_index; ++ int ttc_offset; ++ double mxx, mxy, myx, myy; ++ bool transform; ++ ++#ifdef Q_PRINTER_USE_FREETYPE2 ++ FT_Library ftLibrary; ++ FT_Face ftFace; ++ bool isCFF; ++ ++private: ++ bool open_freetype(); ++ void close_freetype(); ++ bool charprocLoad_ft(int charindex, charproc_data &cd, int metrics[5]); ++#endif // Q_PRINTER_USE_FREETYPE2 + }; + + +@@ -2173,7 +2198,8 @@ + #endif + + +-QPSPrinterFontTTF::QPSPrinterFontTTF(const QFont &f, QByteArray& d) ++QPSPrinterFontTTF::QPSPrinterFontTTF(const QFont &f, QByteArray& d, ++ const QString &extra_key) + { + data = d; + defective = FALSE; +@@ -2196,11 +2222,42 @@ + #endif + offset_table = (unsigned char*) data.data(); /* first 12 bytes */ + ++ ttc_index = 0; ++ ttc_offset = 0; ++ ++ ++ if ( d[0]=='t' && d[1]=='t' && d[2]=='c' && d[3]=='f' ) { ++ if ( !extra_key.isEmpty() ) { ++ int a = extra_key.find( "-I" ) + 2; ++ if ( a >= 2 ) { ++ int b = extra_key.find( "-", a ); ++ if ( b > a ) ++ ttc_index = extra_key.mid( a, b - a ).toInt(); ++ else ++ ttc_index = extra_key.mid( a ).toInt(); ++ } ++ } ++ ++ if ( ttc_index >= (int)getULONG( offset_table + 8 ) ) { ++ defective = TRUE; ++ return; ++ } ++ ++ ttc_offset = getULONG( offset_table + 12 + ttc_index * 4 ); ++ } ++ + /* Determine how many directory entries there are. */ +- numTables = getUSHORT( offset_table + 4 ); ++ numTables = getUSHORT( offset_table + ttc_offset + 4 ); + + /* Extract information from the "Offset" table. */ +- TTVersion = getFixed( offset_table ); ++ TTVersion = getFixed( offset_table + ttc_offset ); ++ ++#ifdef Q_PRINTER_USE_FREETYPE2 ++ Fixed flag_OTTO = getFixed( (BYTE *)"OTTO" ); ++ ++ isCFF = ( TTVersion.whole == flag_OTTO.whole && ++ TTVersion.fraction == flag_OTTO.fraction ); ++#endif // Q_PRINTER_USE_FREETYPE2 + + /* Load the "head" table and extract information from it. */ + ptr = getTable("head"); +@@ -2303,6 +2360,42 @@ + } + numGlyphs = getUSHORT( maxp + 4 ); + // qDebug("number of glyphs is %d", numGlyphs); ++ ++ double matrix[4] = { 1.0, 0.0, 0.0, 1.0 }; ++ ++ if ( !extra_key.isEmpty() ) { ++ int a, b; ++ a = extra_key.find( "-M[" ) + 3; ++ if ( a >= 3 ) { ++ for ( int i = 0; i < 4; i++, a = b + 1 ) { ++ if ( i < 3 ) ++ b = extra_key.find( ",", a ); ++ else ++ b = extra_key.find( "]", a ); ++ if ( b > a ) ++ matrix[i] = extra_key.mid( a, b - a ).toDouble(); ++ else ++ break; ++ } ++ } ++ } ++ ++ mxx = matrix[0]; ++ mxy = matrix[1]; ++ myx = matrix[2]; ++ myy = matrix[3]; ++ transform = ( mxx != 1.0 || mxy != 0.0 || myx != 0.0 || myy != 1.0 ); ++ ++#ifdef Q_PRINTER_USE_FREETYPE2 ++ ftLibrary = 0; ++ ftFace = 0; ++#endif // Q_PRINTER_USE_FREETYPE2 ++ ++ if ( transform ) { ++ addPsFontNameExtension( f, psname ); ++ addPsFontNameExtension( f, FullName ); ++ } ++ + replacementList = makePSFontNameList( f, psname ); + uni2glyphSetup(); + } +@@ -2352,6 +2445,10 @@ + + if( target_type == 42 ) + s << "%%Creator: Converted from TrueType to type 42 by Qt\n"; ++#ifdef Q_PRINTER_USE_FREETYPE2 ++ else if ( isCFF ) ++ s << "%%Creator: Converted from OpenType/CFF by Qt\n"; ++#endif // Q_PRINTER_USE_FREETYPE2 + else + s << "%%Creator: Converted from TrueType by Qt\n"; + +@@ -2375,7 +2472,7 @@ + s << "/_d{bind def}bind def\n"; + s << "/_m{moveto}_d\n"; + s << "/_l{lineto}_d\n"; +- s << "/_cl{closepath eofill}_d\n"; ++ s << "/_cl{closepath fill}_d\n"; + s << "/_c{curveto}_d\n"; + s << "/_sc{7 -1 roll{setcachedevice}{pop pop pop pop pop pop}ifelse}_d\n"; + s << "/_e{exec}_d\n"; +@@ -2388,6 +2485,10 @@ + + if(target_type == 42) + s << "/FontMatrix[1 0 0 1 0 0]def\n"; ++ else if ( transform ) ++ s << QString( "/FontMatrix[%1 %2 %3 %4 0 0]def\n" ) ++ .arg( 0.001 * mxx, 0, 'f', 6 ).arg( 0.001 * myx, 0, 'f', 6 ) ++ .arg( 0.001 * mxy, 0, 'f', 6 ).arg( 0.001 * myy, 0, 'f', 6 ); + else + s << "/FontMatrix[.001 0 0 .001 0 0]def\n"; + +@@ -2489,7 +2590,6 @@ + + // subsetting. We turn a char subset into a glyph subset + // and we mark as used the base glyphs of used composite glyphs. +- + bool glyphset[65536]; + for(int c=0; c < 65536; c++) + glyphset[c] = FALSE; +@@ -2535,6 +2635,10 @@ + + s << "end readonly def\n"; + ++#ifdef Q_PRINTER_USE_FREETYPE2 ++ close_freetype(); ++#endif // Q_PRINTER_USE_FREETYPE2 ++ + // === trailer === + + /* If we are generating a type 3 font, we need to provide */ +@@ -2666,7 +2770,7 @@ + int x; + + /* We must search the table directory. */ +- ptr = offset_table + 12; ++ ptr = offset_table + ttc_offset + 12; + x=0; + while (x != numTables) { + if( strncmp((const char *)ptr,name,4) == 0 ) { +@@ -2775,6 +2879,9 @@ + } + } + } ++ ++ if (!glyph2uni[0xa0] && glyph2uni[0x20]) ++ glyph2uni[0xa0] = glyph2uni[0x20]; + } + + USHORT QPSPrinterFontTTF::unicode_for_glyph(int glyphindex) +@@ -2996,7 +3103,7 @@ + int diff; + int count; /* How many `important' tables did we find? */ + +- BYTE* ptr = offset_table + 12; // original table directory ++ BYTE* ptr = offset_table + ttc_offset + 12; // original table directory + ULONG nextoffset=0; + count=0; + +@@ -3037,7 +3144,7 @@ + + /* Generate the offset table header */ + /* Start by copying the TrueType version number. */ +- ptr = offset_table; ++ ptr = offset_table + ttc_offset; + for(int x=0; x < 4; x++) + sfnts_pputBYTE( *(ptr++) , s, string_len, line_len, in_string ); + +@@ -3180,7 +3287,7 @@ + } + + /* Emmit a PostScript "curveto" command. */ +-static void PSCurveto(FWord* xcoor, FWord* ycoor, ++static void PSConicto(FWord* xcoor, FWord* ycoor, FWord x0, FWord y0, + FWord x, FWord y, int s, int t, QTextStream& ts) + { + int N, i; +@@ -3188,8 +3295,8 @@ + + N = t-s+2; + for(i=0; i<N-1; i++) { +- sx[0] = i==0?xcoor[s-1]:(xcoor[i+s]+xcoor[i+s-1])/2; +- sy[0] = i==0?ycoor[s-1]:(ycoor[i+s]+ycoor[i+s-1])/2; ++ sx[0] = i==0?x0:(xcoor[i+s]+xcoor[i+s-1])/2; ++ sy[0] = i==0?y0:(ycoor[i+s]+ycoor[i+s-1])/2; + sx[1] = xcoor[s+i]; + sy[1] = ycoor[s+i]; + sx[2] = i==N-2?x:(xcoor[s+i]+xcoor[s+i+1])/2; +@@ -3216,6 +3323,26 @@ + } + } + ++static void PSCubicto(FWord* xcoor, FWord* ycoor, FWord x, FWord y, ++ int s, QTextStream& ts) ++{ ++ xcoor += s; ++ ycoor += s; ++ ++ ts << (int)xcoor[0]; ++ ts << " "; ++ ts << (int)ycoor[0]; ++ ts << " "; ++ ts << (int)xcoor[1]; ++ ts << " "; ++ ts << (int)ycoor[1]; ++ ts << " "; ++ ts << (int)x; ++ ts << " "; ++ ts << (int)y; ++ ts << " _c\n"; ++} ++ + /* The PostScript bounding box. */ + /* Variables to hold the character data. */ + +@@ -3226,6 +3353,7 @@ + //void PSLineto(FWord x, FWord y, QTextStream& ts); + //void PSCurveto(FWord x, FWord y, int s, int t, QTextStream& ts); + ++#if 0 + //double area(FWord *x, FWord *y, int n); + //int nextinctr(int co, int ci); + //int nextoutctr(int co); +@@ -3338,17 +3466,20 @@ + + return k; + } /* end of nearout() */ ++#endif + + + /* + ** We call this routine to emmit the PostScript code + ** for the character we have loaded with load_char(). + */ +-static void PSConvert(QTextStream& s, charproc_data* cd) ++static void PSConvert(QTextStream& s, charproc_data* cd, bool cubic) + { +- int i,j,k,fst,start_offpt; ++ int i,j,k,fst,end,start_offpt; + int end_offpt=0; ++ FWord x0, y0, x1, y1; + ++#if 0 + cd->area_ctr = new double[cd->num_ctr]; + memset(cd->area_ctr, 0, (cd->num_ctr*sizeof(double))); + +@@ -3375,6 +3506,7 @@ + cd->ctrset[2*i+1]=-1; + } + } ++#endif + + /* Step thru the coutours. */ + /* I believe that a contour is a detatched */ +@@ -3382,45 +3514,76 @@ + i=j=k=0; + while (i < cd->num_ctr ) { + fst = j = (k==0) ? 0 : (cd->epts_ctr[k-1]+1); ++ end = cd->epts_ctr[k]; ++ ++ if (end - fst < 2) { ++ k++; i++; ++ continue; ++ } + + /* Move to the first point on the contour. */ ++ if (cd->tt_flags[fst]&1) { ++ x0 = cd->xcoor[fst]; ++ y0 = cd->ycoor[fst]; ++ } else if (cd->tt_flags[end]&1) { ++ x0 = cd->xcoor[end]; ++ y0 = cd->ycoor[end]; ++ end--; j--; ++ } else { ++ x0 = (cd->xcoor[fst]+cd->xcoor[end])/2; ++ y0 = (cd->ycoor[fst]+cd->ycoor[end])/2; ++ j--; ++ } ++ + stack(cd->num_pts,3,s); +- PSMoveto(cd->xcoor[j],cd->ycoor[j],s); +- start_offpt = 0; /* No off curve points yet. */ ++ PSMoveto(x0,y0,s); ++ start_offpt = -1; /* No off curve points yet. */ + ++ x1 = x0; y1 = y0; + /* Step thru the remaining points of this contour. */ +- for(j++; j <= cd->epts_ctr[k]; j++) { ++ for(j++; j <= end; j++) { + if (!(cd->tt_flags[j]&1)) { /* Off curve */ +- if (!start_offpt) ++ if (start_offpt < 0) + { start_offpt = end_offpt = j; } + else + end_offpt++; + } else { /* On Curve */ +- if (start_offpt) { ++ if (start_offpt >= 0) { + stack(cd->num_pts,7,s); +- PSCurveto(cd->xcoor,cd->ycoor, +- cd->xcoor[j],cd->ycoor[j], +- start_offpt,end_offpt,s); +- start_offpt = 0; ++ if ( cubic ) ++ PSCubicto(cd->xcoor,cd->ycoor, ++ cd->xcoor[j],cd->ycoor[j],start_offpt,s); ++ else ++ PSConicto(cd->xcoor,cd->ycoor, ++ x1, y1, ++ cd->xcoor[j],cd->ycoor[j], ++ start_offpt,end_offpt,s); ++ start_offpt = -1; + } else { + stack(cd->num_pts,3,s); + PSLineto(cd->xcoor[j], cd->ycoor[j],s); + } ++ x1 = cd->xcoor[j]; ++ y1 = cd->ycoor[j]; + } + } + + /* Do the final curve or line */ + /* of this coutour. */ +- if (start_offpt) { ++ if (start_offpt >= 0) { + stack(cd->num_pts,7,s); +- PSCurveto(cd->xcoor,cd->ycoor, +- cd->xcoor[fst],cd->ycoor[fst], +- start_offpt,end_offpt,s); ++ if ( cubic ) ++ PSCubicto(cd->xcoor,cd->ycoor,x0,y0,start_offpt,s); ++ else ++ PSConicto(cd->xcoor,cd->ycoor, ++ x1,y1,x0,y0, ++ start_offpt,end_offpt,s); + } else { + stack(cd->num_pts,3,s); +- PSLineto(cd->xcoor[fst],cd->ycoor[fst],s); ++ PSLineto(x0,y0,s); + } + ++#if 0 + k=nextinctr(i,k,cd); + + if (k==NOMOREINCTR) +@@ -3428,16 +3591,21 @@ + + if (i==NOMOREOUTCTR) + break; ++#else ++ k++; i++; ++#endif + } + + /* Now, we can fill the whole thing. */ + stack(cd->num_pts,1,s); +- s << "_cl"; /* "closepath eofill" */ ++ s << "_cl"; /* "closepath fill" */ + ++#if 0 + /* Free our work arrays. */ + delete [] cd->area_ctr; + delete [] cd->check_ctr; + delete [] cd->ctrset; ++#endif // Q_TTF_CONTOURS_INOUT + } + + +@@ -3722,6 +3890,11 @@ + */ + BYTE* QPSPrinterFontTTF::charprocFindGlyphData(int charindex) + { ++#ifdef Q_PRINTER_USE_FREETYPE2 ++ if ( isCFF ) ++ return (BYTE*)NULL; ++#endif // Q_PRINTER_USE_FREETYPE2 ++ + ULONG off; + ULONG length; + +@@ -3744,6 +3917,122 @@ + return (BYTE*)NULL; + } + ++#ifdef Q_PRINTER_USE_FREETYPE2 ++bool QPSPrinterFontTTF::open_freetype() ++{ ++ if ( !ftLibrary ) ++ { ++ ftFace = 0; ++ if ( FT_Init_FreeType( &ftLibrary ) ) ++ return FALSE; ++ } ++ ++ if ( !ftFace ) ++ { ++ if ( FT_New_Memory_Face( ftLibrary, (FT_Byte *)data.data(), ++ data.size(), ttc_index, &ftFace ) ) ++ goto Fail; ++ if ( FT_Select_Charmap( ftFace, ft_encoding_unicode ) ) ++ goto Fail; ++ if ( FT_Set_Pixel_Sizes ( ftFace, 1000, 1000 ) ) ++ goto Fail; ++ } ++ ++ return TRUE; ++ ++ Fail: ++ close_freetype(); ++ return FALSE; ++} ++ ++void QPSPrinterFontTTF::close_freetype() ++{ ++ if ( ftLibrary ) ++ FT_Done_FreeType( ftLibrary ); ++ ftLibrary = 0; ++ ftFace = 0; ++} ++ ++bool QPSPrinterFontTTF::charprocLoad_ft( int charindex, ++ charproc_data &cd, int metrics[5] ) ++{ ++ if ( !open_freetype() ) ++ return FALSE; ++ ++ if ( FT_Load_Glyph( ftFace, charindex, ++ FT_LOAD_NO_BITMAP | FT_LOAD_IGNORE_TRANSFORM | ++ FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH ) ) ++ return FALSE; ++ ++ FT_GlyphSlot slot = ftFace->glyph; ++ FT_Outline *outline = &slot->outline; ++ ++ int nctrs = outline->n_contours; ++ int npts = outline->n_points; ++ float scale = (float)unitsPerEm/1000; ++ ++ cd.num_ctr = nctrs; ++ cd.num_pts = npts; ++ metrics[0] = (int)(slot->advance.x * scale / 64); ++ ++ if ( nctrs == 0 ) ++ return TRUE; ++ ++ FT_Vector *pts = outline->points; ++ char *tags = outline->tags; ++ short *ctrs = outline->contours; ++ ++ cd.xcoor = new FWord[npts]; ++ cd.ycoor = new FWord[npts]; ++ cd.tt_flags = new BYTE[npts]; ++ cd.epts_ctr = new int[nctrs]; ++ ++ FWord *xcoor = cd.xcoor; ++ FWord *ycoor = cd.ycoor; ++ BYTE *flags = cd.tt_flags; ++ ++ int x, y, xmin, ymin, xmax, ymax; ++ int n = 0, m; ++ bool bbox_valid = FALSE; ++ bool contour_valid; ++ ++ xmin = ymin = xmax = ymax = 0; ++ ++ for ( int i = 0 ; i < nctrs; i++ ) { ++ m = cd.epts_ctr[i] = ctrs[i]; ++ ++ contour_valid = (m >= n + 2); ++ ++ if ( !bbox_valid && contour_valid ) { ++ xmin = xmax = pts->x >> 6; ++ ymin = ymax = pts->y >> 6; ++ bbox_valid = TRUE; ++ } ++ ++ for ( ; n <= m; n++, pts++ ) { ++ *xcoor++ = x = pts->x >> 6; ++ *ycoor++ = y = pts->y >> 6; ++ *flags++ = (*tags++) & 3; ++ if ( contour_valid ) { ++ xmin = QMIN( xmin, x ); ++ xmax = QMAX( xmax, x ); ++ ymin = QMIN( ymin, y ); ++ ymax = QMAX( ymax, y ); ++ } ++ } ++ } ++ ++ if ( bbox_valid ) { ++ metrics[1] = (int)(xmin * scale); ++ metrics[2] = (int)(ymin * scale); ++ metrics[3] = (int)(xmax * scale); ++ metrics[4] = (int)(ymax * scale); ++ } ++ ++ return TRUE; ++} ++#endif // Q_PRINTER_USE_FREETYPE2 ++ + void QPSPrinterFontTTF::charproc(int charindex, QTextStream& s, bool *glyphSet ) + { + int llx,lly,urx,ury; +@@ -3759,6 +4048,18 @@ + /* Get a pointer to the data. */ + BYTE* glyph = charprocFindGlyphData( charindex ); + ++#ifdef Q_PRINTER_USE_FREETYPE2 ++ int metrics[5] = { 0 }; ++ if (charprocLoad_ft(charindex, cd, metrics)) { ++ advance_width = metrics[0]; ++ llx = metrics[1]; ++ lly = metrics[2]; ++ urx = metrics[3]; ++ ury = metrics[4]; ++ goto Output; ++ } ++#endif // Q_PRINTER_USE_FREETYPE2 ++ + /* If the character is blank, it has no bounding box, */ + /* otherwise read the bounding box. */ + if( glyph == (BYTE*)NULL ) { +@@ -3791,6 +4092,9 @@ + else + advance_width = getuFWord( hmtx_table + ((numberOfHMetrics-1) * 4) ); + ++#ifdef Q_PRINTER_USE_FREETYPE2 ++ Output: ++#endif // Q_PRINTER_USE_FREETYPE2 + /* Execute setcachedevice in order to inform the font machinery */ + /* of the character bounding box and advance width. */ + stack(cd.num_pts,7,s); +@@ -3808,7 +4112,7 @@ + /* If it is a simple glyph, convert it, */ + /* otherwise, close the stack business. */ + if( cd.num_ctr > 0 ) { // simple +- PSConvert(s,&cd); ++ PSConvert(s,&cd,isCFF); + delete [] cd.tt_flags; + delete [] cd.xcoor; + delete [] cd.ycoor; +@@ -4664,6 +4968,7 @@ + { + QString fontfilename; + QString fontname; ++ QString extra_key = QString::null; + + enum { NONE, PFB, PFA, TTF } type = NONE; + +@@ -4687,10 +4992,19 @@ + XftResult res; + XftPattern *f = XftFontMatch(qt_xdisplay(), 0, pattern, &res); + XftPatternGetString (f, XFT_FILE, 0, &filename); ++ ++ int font_index; ++ if ( XftPatternGetInteger (f, XFT_INDEX, 0, &font_index) == XftResultMatch ) ++ extra_key += QString("-I%1").arg(font_index); ++ XftMatrix *mat; ++ if (XftPatternGetMatrix (f, XFT_MATRIX, 0, &mat) == XftResultMatch) ++ extra_key += QString("-M[%1,%2,%3,%4]") ++ .arg(mat->xx).arg(mat->xy).arg(mat->yx).arg(mat->yy); ++ + //qDebug("filename for font is '%s'", filename); + if ( filename ) { + fontfilename = QString::fromLatin1( filename ); +- xfontname = fontfilename; ++ xfontname = fontfilename + extra_key; + } + XftPatternDestroy( f ); + XftPatternDestroy( pattern ); +@@ -4786,12 +5100,38 @@ + if (mapping.lower().contains(searchname.lower())) { + int index = mapping.find(' ',0); + QString ffn = mapping.mid(0,index); ++ // skip ttcap ++ int length = ffn.find(':',0) + 1; ++ while (length > 0) { ++ ffn = ffn.mid(length); ++ length = ffn.find(':',0) + 1; ++ } + // remove the most common bitmap formats + if( !ffn.contains( ".pcf" ) && !ffn.contains( " .bdf" ) && + !ffn.contains( ".spd" ) && !ffn.contains( ".phont" ) ) { + fontfilename = (*it) + QString("/") + ffn; + if ( QFile::exists(fontfilename) ) { + //qDebug("found font file %s", fontfilename.latin1()); ++ // check font index ++ index = mapping.find("fn=",0,FALSE) + 3; ++ if (index >= 3) { ++ length = mapping.find(':', index) - index; ++ if (length > 0) { ++ QString ttcap_fn = mapping.mid(index, length); ++ int font_index = ttcap_fn.toInt(); ++ extra_key += QString("-I%1").arg(font_index); ++ } ++ } ++ // check slant ++ index = mapping.find("ai=",0,FALSE) + 3; ++ if (index >= 3) { ++ length = mapping.find(':', index) - index; ++ if (length > 0) { ++ QString ttcap_ai = mapping.mid(index, length); ++ double xy = ttcap_ai.toDouble(); ++ extra_key += QString("-M[1.0,%1,0.0,1.0]").arg(xy); ++ } ++ } + break; + } else // unset fontfilename + fontfilename = QString(); +@@ -4829,6 +5169,12 @@ + type = PFA; + else if (d[0]==0x00 && d[1]==0x01 && d[2]==0x00 && d[3]==0x00) + type = TTF; ++ else if (d[0]=='t' && d[1]=='t' && d[2]=='c' && d[3]=='f') ++ type = TTF; ++#ifdef Q_PRINTER_USE_FREETYPE2 ++ else if (d[0]=='O' && d[1]=='T' && d[2]=='T' && d[3]=='O') ++ type = TTF; ++#endif // Q_PRINTER_USE_FREETYPE2 + else + type = NONE; + } else +@@ -4837,7 +5183,7 @@ + //qWarning(xfontname); + switch (type) { + case TTF : +- p = new QPSPrinterFontTTF(f, data); ++ p = new QPSPrinterFontTTF(f, data, extra_key); + break; + case PFB: + p = new QPSPrinterFontPFB(f, data); diff --git a/x11-libs/qt/qt-3.1.2-r4.ebuild b/x11-libs/qt/qt-3.1.2-r4.ebuild index ced9c370895e..2b40ba6a2ebc 100644 --- a/x11-libs/qt/qt-3.1.2-r4.ebuild +++ b/x11-libs/qt/qt-3.1.2-r4.ebuild @@ -1,6 +1,6 @@ # Copyright 1999-2003 Gentoo Technologies, Inc. # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/x11-libs/qt/qt-3.1.2-r4.ebuild,v 1.7 2003/09/07 00:23:28 msterret Exp $ +# $Header: /var/cvsroot/gentoo-x86/x11-libs/qt/qt-3.1.2-r4.ebuild,v 1.8 2003/09/08 02:15:54 caleb Exp $ DESCRIPTION="QT version ${PV}" HOMEPAGE="http://www.trolltech.com/" @@ -53,6 +53,8 @@ src_unpack() { epatch ${FILESDIR}/${P}-coreutils-fixup.patch use cjk && epatch ${FILESDIR}/${P}-korean-xim.patch + use cjk && epatch ${FILESDIR}/${P}-qfont-jp-family-subst-20030421.patch + use cjk && epatch ${FILESDIR}/${P}-qpsprinter-ttc-otf-italic-20030429.patch epatch ${FILESDIR}/${P}-thai-complextext.patch cp configure configure.orig |