Go to:
Gentoo Home
Documentation
Forums
Lists
Bugs
Planet
Store
Wiki
Get Gentoo!
Gentoo's Bugzilla – Attachment 20466 Details for
Bug 33069
cjk patches + new ebuild for qt-3.2.3
Home
|
New
–
[Ex]
|
Browse
|
Search
|
Privacy Policy
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
psprinter patch
qt-x11-free-3.2.1-qpsprinter-useFreeType2-20030922.patch (text/plain), 10.03 KB, created by
Ken Deeter
on 2003-11-09 02:53:43 UTC
(
hide
)
Description:
psprinter patch
Filename:
MIME Type:
Creator:
Ken Deeter
Created:
2003-11-09 02:53:43 UTC
Size:
10.03 KB
patch
obsolete
>--- qt-x11-free-3.2.1/src/kernel/qpsprinter-orig.cpp Wed Aug 20 22:07:33 2003 >+++ qt-x11-free-3.2.1/src/kernel/qpsprinter.cpp Mon Sep 22 17:04:29 2003 >@@ -98,6 +98,12 @@ > #include "qtextlayout_p.h" > #include "qtextengine_p.h" > extern bool qt_has_xft; >+ >+#ifndef QT_NO_XFTFREETYPE >+#include <ft2build.h> >+#include FT_OUTLINE_H >+#endif >+ > #endif > > static bool qt_gen_epsf = FALSE; >@@ -2076,6 +2082,32 @@ > > // ================== TTF ==================== > >+#ifndef QT_NO_XFTFREETYPE >+ >+static void >+getXftData( const QFontEngine *engine, >+ int &index, int &weight, int &slant, XftMatrix &matrix ) >+{ >+ XftPattern* font = static_cast<const QFontEngineXft *>( engine )->pattern(); >+ XftMatrix unit = { 1.0, 0, 0, 1.0 }; >+ XftMatrix* mat; >+ >+ index = 0; >+ weight = XFT_WEIGHT_MEDIUM; >+ slant = XFT_SLANT_ROMAN; >+ matrix = unit; >+ >+ XftPatternGetInteger( font, XFT_INDEX, 0, &index ); >+ XftPatternGetInteger( font, XFT_WEIGHT, 0, &weight ); >+ XftPatternGetInteger( font, XFT_SLANT, 0, &slant ); >+ >+ if ( XftPatternGetMatrix( font, XFT_MATRIX, 0, &mat ) == XftResultMatch ) >+ matrix = *mat; >+} >+ >+#endif // QT_NO_XFTFREETYPE >+ >+ > typedef Q_UINT8 BYTE; > typedef Q_UINT16 USHORT; > typedef Q_UINT16 uFWord; >@@ -2184,6 +2216,16 @@ > > int indexToLocFormat; /* short or long offsets */ > >+#ifndef QT_NO_XFTFREETYPE >+ FT_Face face; >+ int index; >+ int weight; >+ int slant; >+ XftMatrix matrix; >+ >+ QString StyleName_Extension; >+#endif // QT_NO_XFTFREETYPE >+ > }; > > >@@ -2293,6 +2335,58 @@ > #endif > offset_table = (unsigned char*) data.data(); /* first 12 bytes */ > >+#ifndef QT_NO_XFTFREETYPE >+ if ( target_type == 42 ) { >+ if ( !( d[0] == '0' && d[1] == '1' && d[2] == '0' && d[3] == '0' ) ) { >+ defective = TRUE; >+ return; >+ } >+ } >+ >+ face = 0; >+ StyleName_Extension = ""; >+ getXftData( f, index, weight, slant, matrix ); >+ >+ if ( qt_has_xft && f->type() == QFontEngine::Xft ) { >+ extern FT_Library _XftFTlibrary; >+ >+ if ( FT_New_Memory_Face( _XftFTlibrary, >+ (const FT_Byte*)data.data(), >+ data.size(), index, &face ) || >+ ( face->face_flags & FT_FACE_FLAG_SCALABLE ) == 0 ) { >+ defective = TRUE; >+ return; >+ } >+ >+ FT_Set_Pixel_Sizes( face, 1000, 1000 ); >+ >+ bool bold = ( face->style_flags & FT_STYLE_FLAG_BOLD ) != 0; >+ bool italic = ( face->style_flags & FT_STYLE_FLAG_ITALIC ) != 0; >+ >+ if ( weight > XFT_WEIGHT_MEDIUM && !bold ) >+ StyleName_Extension += "Bold"; >+ if ( slant > XFT_SLANT_ROMAN && !italic ) >+ StyleName_Extension += "Oblique"; >+ >+ if ( !StyleName_Extension.isEmpty() ) >+ StyleName_Extension = "-" + StyleName_Extension; >+ >+ if ( matrix.xx != 1.0 || matrix.xy != 0.0 || >+ matrix.yx != 0.0 || matrix.yy != 1.0 ) >+ StyleName_Extension += QString( "-%1-%2-%3-%4" ) >+ .arg( matrix.xx, 0, 'f' ) >+ .arg( matrix.yx, 0, 'f' ) >+ .arg( matrix.xy, 0, 'f' ) >+ .arg( matrix.yy, 0, 'f' ); >+ >+ StyleName_Extension.replace( '.', '_' ); >+ } >+ >+ if ( d[0] == 't' && d[1] == 't' && d[2] == 'c' && d[3] == 'f' ) >+ offset_table += getULONG( offset_table + 12 + 4 * index ); >+#endif >+ >+ > /* Determine how many directory entries there are. */ > numTables = getUSHORT( offset_table + 4 ); > >@@ -2404,6 +2498,11 @@ > // qDebug("number of glyphs is %d", numGlyphs); > replacementList = makePSFontNameList( f, psname ); > uni2glyphSetup(); >+ >+#ifndef QT_NO_XFTFREETYPE >+ psname += StyleName_Extension; >+ FullName += StyleName_Extension; >+#endif > } > > >@@ -2520,7 +2619,7 @@ > if( target_type == 42 ) > s << "%%Creator: Converted from TrueType to type 42 by Qt\n"; > else >- s << "%%Creator: Converted from TrueType by Qt\n"; >+ s << "%%Creator: Converted from TrueType/OpenType by Qt\n"; > > /* If VM usage information is available, print it. */ > if( target_type == 42 && post_table) >@@ -2542,7 +2641,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"; >@@ -2556,7 +2655,15 @@ > if(target_type == 42) > s << "/FontMatrix[1 0 0 1 0 0]def\n"; > else >+#ifndef QT_NO_XFTFREETYPE >+ s << QString( "/FontMatrix[%1 %2 %3 %4 0 0]def\n" ) >+ .arg( 0.001 * matrix.xx, 0, 'f', 6 ) >+ .arg( 0.001 * matrix.yx, 0, 'f', 6 ) >+ .arg( 0.001 * matrix.xy, 0, 'f', 6 ) >+ .arg( 0.001 * matrix.yy, 0, 'f', 6 ); >+#else > s << "/FontMatrix[.001 0 0 .001 0 0]def\n"; >+#endif > > s << "/FontBBox["; > s<< llx; >@@ -2699,6 +2806,11 @@ > > s << "end readonly def\n"; > >+ if ( face ) { >+ FT_Done_Face( face ); >+ face = 0; >+ } >+ > // === trailer === > > /* If we are generating a type 3 font, we need to provide */ >@@ -2841,7 +2953,7 @@ > offset = getULONG( ptr + 8 ); > //length = getULONG( ptr + 12 ); > >- table = offset_table + offset; >+ table = (BYTE*)data.data() + offset; > return table; > } > >@@ -3344,6 +3456,123 @@ > } > } > >+ >+#ifndef QT_NO_XFTFREETYPE >+ >+#undef DOWNSCALE >+#define DOWNSCALE( x ) ( ( (x) + 32 ) >> 6 ) >+ >+extern "C" { >+ >+static FT_Vector from; >+ >+ static FT_Error >+ PSMovetoFT( FT_Vector* to, QTextStream *s ) >+ { >+ if ( !to ) { >+ stack( 100, 1, *s ); >+ (*s) << " _cl"; >+ } else { >+ stack( 100, 3, *s ); >+ (*s) << DOWNSCALE( to->x ) << " " >+ << DOWNSCALE( to->y ) << " _m\n"; >+ from = *to; >+ } >+ >+ return FT_Err_Ok; >+ } >+ >+ static FT_Error >+ PSLinetoFT( FT_Vector* to, >+ QTextStream *s ) >+ { >+ stack( 100, 3, *s ); >+ (*s) << DOWNSCALE( to->x ) << " " >+ << DOWNSCALE( to->y ) << " _l\n"; >+ from = *to; >+ return FT_Err_Ok; >+ } >+ >+ static FT_Error >+ PSCubictoFT( FT_Vector* ctrl1, FT_Vector* ctrl2, FT_Vector* to, >+ QTextStream *s ) >+ { >+ stack( 100, 7, *s ); >+ (*s) << DOWNSCALE( ctrl1->x ) << " " >+ << DOWNSCALE( ctrl1->y ) << " " >+ << DOWNSCALE( ctrl2->x ) << " " >+ << DOWNSCALE( ctrl2->y ) << " " >+ << DOWNSCALE( to->x ) << " " >+ << DOWNSCALE( to->y ) << " _c\n"; >+ from = *to; >+ return FT_Err_Ok; >+ } >+ >+ static FT_Error >+ PSConictoFT( FT_Vector* ctrl, FT_Vector* to, >+ QTextStream *s ) >+ { >+ FT_Vector ctrl1, ctrl2; >+ >+ >+ ctrl1.x = ( from.x + 2*ctrl->x ) / 3; >+ ctrl1.y = ( from.y + 2*ctrl->y ) / 3; >+ ctrl2.x = ( to->x + 2*ctrl->x ) / 3; >+ ctrl2.y = ( to->y + 2*ctrl->y ) / 3; >+ >+ return PSCubictoFT( &ctrl1, &ctrl2, to, s ); >+ } >+ >+} // extern "C" >+ >+static void >+charprocFT( FT_Face face, FT_UInt glyph_index, >+ int weight, int slant, QTextStream &s ) >+{ >+ static const FT_Outline_Funcs funcs = >+ { >+ (FT_Outline_MoveToFunc) PSMovetoFT, >+ (FT_Outline_LineToFunc) PSLinetoFT, >+ (FT_Outline_ConicToFunc) PSConictoFT, >+ (FT_Outline_CubicToFunc) PSCubictoFT, >+ 0, 0 >+ }; >+ >+ FT_Int32 load_flags = FT_LOAD_NO_BITMAP | >+ FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH; >+ >+ Q_UNUSED( weight ); >+ Q_UNUSED( slant ); >+ >+ if ( !FT_Load_Glyph( face, glyph_index, load_flags ) ) { >+ FT_Glyph_Metrics* metrics = &face->glyph->metrics; >+ >+ stack( 100, 7, s ); >+ s << ( ( face->glyph->linearHoriAdvance + 0x8000L ) >> 16 ); >+ s << " 0 "; >+ s << DOWNSCALE( metrics->horiBearingX ); >+ s << " "; >+ s << DOWNSCALE( metrics->horiBearingY - metrics->height ); >+ s << " "; >+ s << DOWNSCALE( metrics->horiBearingX + metrics->width ); >+ s << " "; >+ s << DOWNSCALE( metrics->horiBearingY ); >+ s << " _sc\n"; >+ >+ FT_Outline_Decompose( &face->glyph->outline, &funcs, &s ); >+ PSMovetoFT( 0, &s ); >+ >+ } else { >+ stack( 7, 7, s ); >+ s << "0 0 0 0 0 0 0 _sc\n"; >+ } >+ >+ stack_end( s ); >+ return; >+} >+ >+#endif // QT_NO_XFTFREETYPE >+ > // postscript drawing commands > > static void PSMoveto(FWord x, FWord y, QTextStream& ts) >@@ -3738,6 +3967,12 @@ > charproc_data cd; > > glyphset[charindex] = TRUE; >+ >+#ifndef QT_NO_XFTFREETYPE >+ if ( face ) >+ return; >+#endif // QT_NO_XFTFREETYPE >+ > //printf("subsetting %s ==> ",glyphName(charindex).latin1()); > > /* Get a pointer to the data. */ >@@ -3939,6 +4174,11 @@ > s << "\n"; > #endif > >+ if ( face ) { >+ charprocFT( face, charindex, weight, slant, s ); >+ return; >+ } >+ > /* Get a pointer to the data. */ > BYTE* glyph = charprocFindGlyphData( charindex ); > >@@ -4885,15 +5125,22 @@ > XftPattern *pattern = static_cast<QFontEngineXft *>( engine )->pattern(); > //qDebug("xfthandle=%p", font); > char *filename = 0; >- XftResult res; >- XftPattern *f = XftFontMatch(qt_xdisplay(), 0, pattern, &res); >- XftPatternGetString (f, XFT_FILE, 0, &filename); >+ XftPatternGetString (pattern, XFT_FILE, 0, &filename); > //qDebug("filename for font is '%s'", filename); >+ >+ int index, weight, slant; >+ XftMatrix matrix; >+ getXftData (engine, index, weight, slant, matrix); >+ >+ QString style = QString("-I%1-W%2-S%3-M[%4,%5,%6,%7]") >+ .arg(index).arg(weight).arg(slant) >+ .arg(matrix.xx).arg(matrix.xy) >+ .arg(matrix.yx).arg(matrix.yy); >+ > if ( filename ) { > fontfilename = QString::fromLatin1( filename ); >- xfontname = fontfilename; >+ xfontname = fontfilename + style; > } >- XftPatternDestroy( f ); > } else > #endif > { >@@ -5031,6 +5278,12 @@ > type = PFA; > else if (d[0]==0x00 && d[1]==0x01 && d[2]==0x00 && d[3]==0x00) > type = TTF; >+#ifndef QT_NO_XFTFREETYPE >+ else if (d[0]=='t' && d[1]=='t' && d[2]=='c' && d[3]=='f') >+ type = TTF; >+ else if (d[0]=='O' && d[1]=='T' && d[2]=='T' && d[3]=='O') >+ type = TTF; >+#endif // QT_NO_XFTFREETYPE > else > type = NONE; > } else
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 33069
:
20465
|
20466
|
20467
|
21721
|
21722
|
21723