diff options
Diffstat (limited to 'tqtinterface/qt4/src/kernel/tqpsprinter.cpp')
-rw-r--r-- | tqtinterface/qt4/src/kernel/tqpsprinter.cpp | 154 |
1 files changed, 77 insertions, 77 deletions
diff --git a/tqtinterface/qt4/src/kernel/tqpsprinter.cpp b/tqtinterface/qt4/src/kernel/tqpsprinter.cpp index 18227cf..f881bf8 100644 --- a/tqtinterface/qt4/src/kernel/tqpsprinter.cpp +++ b/tqtinterface/qt4/src/kernel/tqpsprinter.cpp @@ -187,13 +187,13 @@ static const char *const ps_header = "div 3 1 roll}D/BC{CRGB BkCol sp}D/BR{CRGB BCol sp/BSt ED}D/WB{1 W BR}D/NB{0\n" "B BR}D/PE{setlinejoin setlinecap CRGB PCol sp/LWi ED/PSt ED LWi 0 eq{0.25\n" "/LWi ED}if PCol SC}D/P1{1 0 5 2 roll 0 0 PE}D/ST{defM SM concat}D/MF{true\n" -"exch true exch{exch pop exch pop dup 0 get dup tqfindfont dup/FontName get 3\n" +"exch true exch{exch pop exch pop dup 0 get dup findfont dup/FontName get 3\n" "-1 roll eq{exit}if}forall exch dup 1 get/fxscale ED 2 get/fslant ED exch\n" "/fencoding ED[fxscale 0 fslant 1 0 0]makefont fencoding false eq{}{dup\n" "maxlength dict begin{1 i/FID ne{def}{pop pop}ifelse}forall/Encoding\n" -"fencoding d currentdict end}ie definefont pop}D/MFEmb{tqfindfont dup length\n" +"fencoding d currentdict end}ie definefont pop}D/MFEmb{findfont dup length\n" "dict begin{1 i/FID ne{d}{pop pop}ifelse}forall/Encoding ED currentdict end\n" -"definefont pop}D/DF{tqfindfont/fs 3 -1 roll d[fs 0 0 fs -1 mul 0 0]makefont d}\n" +"definefont pop}D/DF{findfont/fs 3 -1 roll d[fs 0 0 fs -1 mul 0 0]makefont d}\n" "D/ty 0 d/Y{/ty ED}D/Tl{gsave SW NP 1 i exch MT 1 i 0 RL S grestore}D/XYT{ty\n" "MT/xyshow where{pop pop xyshow}{exch pop 1 i dup length 2 div exch\n" "stringwidth pop 3 -1 roll exch sub exch div exch 0 exch ashow}ie}D/AT{ty MT\n" @@ -222,7 +222,7 @@ static const char *const ps_header = // http://partners.adobe.com:80/asn/developer/type/tqunicodegn.html // // IMPORTANT NOTE: -// the list tqcontains glyphs in the private use area of tqunicode. These should get removed when regenerating the glyphlist. +// the list contains glyphs in the private use area of tqunicode. These should get removed when regenerating the glyphlist. // also 0 shout be mapped to .notdef static const struct { TQ_UINT16 u; @@ -1300,7 +1300,7 @@ static const psfont * const VerdanaReplacements[] = { static const struct { const char * input; // spaces are stripped in here, and everything lowercase const psfont * ps; - const psfont *const * tqreplacements; + const psfont *const * replacements; } postscriptFonts [] = { { "arial", Arial, SansSerifReplacements }, { "arialmt", Arial, SansSerifReplacements }, @@ -1469,7 +1469,7 @@ public: protected: TQString psname; - TQStringList tqreplacementList; + TQStringList replacementList; TQMap<unsigned short, unsigned short> subset; // tqunicode subset in the global font TQMap<unsigned short, unsigned short> page_subset; // subset added in this page @@ -1577,16 +1577,16 @@ static TQString makePSFontName( const TQFontEngine *fe, int *listpos = 0, int *f return ps; } -static void appendReplacements( TQStringList &list, const psfont * const * tqreplacements, int type, float xscale = 100. ) +static void appendReplacements( TQStringList &list, const psfont * const * replacements, int type, float xscale = 100. ) { - // iterate through the tqreplacement fonts - while ( *tqreplacements ) { - const psfont *psf = *tqreplacements; + // iterate through the replacement fonts + while ( *replacements ) { + const psfont *psf = *replacements; TQString ps = "[ /" + TQString::tqfromLatin1( psf[type].psname ) + " " + toString( xscale / psf[type].xscale ) + " " + toString( psf[type].slant ) + " ]"; list.append( ps ); - ++tqreplacements; + ++replacements; } } @@ -1605,20 +1605,20 @@ static TQStringList makePSFontNameList( const TQFontEngine *fe, const TQString & ps = makePSFontName( fe, &i, &type ); const psfont *psf = postscriptFonts[i].ps; - const psfont * const * tqreplacements = postscriptFonts[i].tqreplacements; + const psfont * const * replacements = postscriptFonts[i].replacements; float xscale = 100; if ( psf ) { - // xscale for the "right" font is always 1. We scale the tqreplacements... + // xscale for the "right" font is always 1. We scale the replacements... xscale = psf->xscale; ps = "[ /" + TQString::tqfromLatin1( psf[type].psname ) + " 1.0 " + toString( psf[type].slant ) + " ]"; } else { ps = "[ /" + ps + " 1.0 0.0 ]"; - // only add default tqreplacement fonts in case this font was unknown. + // only add default replacement fonts in case this font was unknown. if ( fe->fontDef.fixedPitch ) { - tqreplacements = FixedReplacements; + replacements = FixedReplacements; } else { - tqreplacements = SansSerifReplacements; + replacements = SansSerifReplacements; // 100 is courier, but most fonts are not as wide as courier. Using 100 // here would make letters overlap for some fonts. This value is empirical. xscale = 83; @@ -1626,8 +1626,8 @@ static TQStringList makePSFontNameList( const TQFontEngine *fe, const TQString & } list.append( ps ); - if ( tqreplacements ) - appendReplacements( list, tqreplacements, type, xscale); + if ( replacements ) + appendReplacements( list, replacements, type, xscale); return list; } @@ -1666,13 +1666,13 @@ TQPSPrinterFontPrivate::TQPSPrinterFontPrivate() unsigned short TQPSPrinterFontPrivate::insertIntoSubset( unsigned short u ) { unsigned short retval = 0; - if ( subset.tqfind(u) == subset.end() ) { + if ( subset.find(u) == subset.end() ) { if ( !downloaded ) { // we need to add to the page subset subset.insert( u, subsetCount ); // mark it as used //printf("GLOBAL SUBSET ADDED %04x = %04x\n",u, subsetCount); retval = subsetCount; subsetCount++; - } else if ( page_subset.tqfind(u) == page_subset.end() ) { + } else if ( page_subset.find(u) == page_subset.end() ) { page_subset.insert( u, pageSubsetCount ); // mark it as used //printf("PAGE SUBSET ADDED %04x = %04x\n",u, pageSubsetCount); retval = pageSubsetCount + (subsetCount/256 + 1) * 256; @@ -1809,14 +1809,14 @@ TQString TQPSPrinterFontPrivate::defineFont( TQTextStream &stream, const TQStrin unsigned short TQPSPrinterFontPrivate::mapUnicode( unsigned short tqunicode ) { TQMap<unsigned short, unsigned short>::iterator res; - res = subset.tqfind( tqunicode ); + res = subset.find( tqunicode ); unsigned short offset = 0; bool found = FALSE; if ( res != subset.end() ) { found = TRUE; } else { if ( downloaded ) { - res = page_subset.tqfind( tqunicode ); + res = page_subset.find( tqunicode ); offset = (subsetCount/256 + 1) * 256; if ( res != page_subset.end() ) found = TRUE; @@ -2075,7 +2075,7 @@ void TQPSPrinterFontPrivate::downloadMapping( TQTextStream &s, bool global ) s << psname; s << "-Uni-"; s << toHex( range ); - s << " tqfindfont\n"; + s << " findfont\n"; } s << "]def\n"; @@ -2351,7 +2351,7 @@ TQPSPrinterFontTTF::TQPSPrinterFontTTF(const TQFontEngine *f, TQByteArray& d) BYTE* table_ptr = getTable("name"); /* pointer to table */ if ( !table_ptr ) { defective = TRUE; - qDebug("couldn't tqfind name table" ); + qDebug("couldn't find name table" ); return; } int numrecords = getUSHORT( table_ptr + 2 ); /* number of names */ @@ -2388,8 +2388,8 @@ TQPSPrinterFontTTF::TQPSPrinterFontTTF(const TQFontEngine *f, TQByteArray& d) Trademark.setLatin1(strings+offset,length); } - psname.tqreplace(' ', '-'); - psname.tqreplace("/", ""); + psname.replace(' ', '-'); + psname.replace("/", ""); if (psname.isEmpty()) psname = makePSFontName(f); @@ -2418,7 +2418,7 @@ TQPSPrinterFontTTF::TQPSPrinterFontTTF(const TQFontEngine *f, TQByteArray& d) } numGlyphs = getUSHORT( maxp + 4 ); // qDebug("number of glyphs is %d", numGlyphs); - tqreplacementList = makePSFontNameList( f, psname ); + replacementList = makePSFontNameList( f, psname ); uni2glyphSetup(); } @@ -2448,7 +2448,7 @@ void TQPSPrinterFontTTF::drawText( TQTextStream &stream, const TQPoint &p, TQTex int type = si.fontEngine->type(); bool glyphIndices = (type == TQFontEngine::Xft); // This helps us get arabic for XLFD fonts working. In that case we have a Unicode - // cmap (== 0), and the glyphs array tqcontains the tqshaped string. + // cmap (== 0), and the glyphs array contains the tqshaped string. bool useGlyphAsUnicode = (type == TQFontEngine::XLFD && si.fontEngine->cmap() == 0); #else // TQ_WS_TQWS const bool glyphIndices = FALSE; @@ -2510,7 +2510,7 @@ void TQPSPrinterFontTTF::drawText( TQTextStream &stream, const TQPoint &p, TQTex void TQPSPrinterFontTTF::download(TQTextStream& s,bool global) { - emitPSFontNameList( s, psname, tqreplacementList); + emitPSFontNameList( s, psname, replacementList); if ( !embedFonts ) { downloadMapping(s, global); return; @@ -2783,7 +2783,7 @@ void TQPSPrinterFontTTF::download(TQTextStream& s,bool global) s << " {true}ifelse\n"; /* If true, execute code to produce an error message if */ - /* we can't tqfind Apple's TrueDict in VM. */ + /* we can't find Apple's TrueDict in VM. */ s << "{/TrueDict where{pop}{(%%[ Error: no TrueType rasterizer ]%%)= flush}ifelse\n"; /* Since we are expected to use Apple's TrueDict TrueType */ @@ -2808,7 +2808,7 @@ void TQPSPrinterFontTTF::download(TQTextStream& s,bool global) /* is a procedure. If it is, it executes it, otherwise, it */ /* lets the TrueType rasterizer loose on it. */ - /* When this proceedure is executed the stack tqcontains */ + /* When this proceedure is executed the stack contains */ /* the font dictionary and the character name. We */ /* exchange arguments and move the dictionary to the */ /* dictionary stack. */ @@ -2822,7 +2822,7 @@ void TQPSPrinterFontTTF::download(TQTextStream& s,bool global) /* stack: charname CharStrings bool */ /* Exchange the CharStrings dictionary and the charname, */ - /* but if the answer was false, tqreplace the character name */ + /* but if the answer was false, replace the character name */ /* with ".notdef". */ s << " {exch}{exch pop /.notdef}ifelse\n"; /* stack: CharStrings charname */ @@ -3015,7 +3015,7 @@ USHORT TQPSPrinterFontTTF::glyph_for_tqunicode(unsigned short tqunicode) /*------------------------------------------------------------------- ** sfnts routines ** These routines generate the PostScript "sfnts" array which -** tqcontains one or more strings which contain a reduced version +** contains one or more strings which contain a reduced version ** of the TrueType font. ** ** A number of functions are required to accomplish this rather @@ -3156,7 +3156,7 @@ void TQPSPrinterFontTTF::sfnts_glyf_table(ULONG oldoffset, ** two byte boundary. */ if( length % 2 ) { - qWarning("TrueType font tqcontains a 'glyf' table without 2 byte padding"); + qWarning("TrueType font contains a 'glyf' table without 2 byte padding"); defective = TRUE; return; } @@ -3216,7 +3216,7 @@ void TQPSPrinterFontTTF::download_sfnts(TQTextStream& s) int c; /* Input character. */ int diff; - int count; /* How many `important' tables did we tqfind? */ + int count; /* How many `important' tables did we find? */ BYTE* ptr = offset_table + 12; // original table directory ULONG nextoffset=0; @@ -3536,7 +3536,7 @@ static double intest( int co, int ci, charproc_data *cd ) } /* -** tqfind the nearest out contour to a specified in contour. +** find the nearest out contour to a specified in contour. */ static int nearout(int ci, charproc_data* cd) { @@ -3802,7 +3802,7 @@ void TQPSPrinterFontTTF::subsetGlyph(int charindex,bool* glyphset) glyphset[ glyphIndex ] = TRUE; subsetGlyph( glyphIndex, glyphset ); - //printf("subset tqcontains: %d %s ",glyphIndex, glyphName(glyphIndex).latin1()); + //printf("subset contains: %d %s ",glyphIndex, glyphName(glyphIndex).latin1()); if(flags & ARG_1_AND_2_ARE_WORDS) { glyph += 2; @@ -4078,12 +4078,12 @@ TQPSPrinterFontPFA::TQPSPrinterFontPFA(const TQFontEngine *f, TQByteArray& d) while (fontnameptr[l] != ' ') l++; psname = TQString::tqfromLatin1(fontnameptr,l); - tqreplacementList = makePSFontNameList( f, psname ); + replacementList = makePSFontNameList( f, psname ); } void TQPSPrinterFontPFA::download(TQTextStream& s, bool global) { - emitPSFontNameList( s, psname, tqreplacementList); + emitPSFontNameList( s, psname, replacementList); if ( !embedFonts ) { downloadMapping(s, global); @@ -4145,12 +4145,12 @@ TQPSPrinterFontPFB::TQPSPrinterFontPFB(const TQFontEngine *f, TQByteArray& d) while (fontnameptr[l] != ' ') l++; psname = TQString::tqfromLatin1(fontnameptr,l); - tqreplacementList = makePSFontNameList( f, psname ); + replacementList = makePSFontNameList( f, psname ); } void TQPSPrinterFontPFB::download(TQTextStream& s, bool global) { - emitPSFontNameList( s, psname, tqreplacementList); + emitPSFontNameList( s, psname, replacementList); if ( !embedFonts ) { downloadMapping(s, global); @@ -4239,13 +4239,13 @@ private: TQPSPrinterFontNotFound::TQPSPrinterFontNotFound(const TQFontEngine* f) { psname = makePSFontName( f ); - tqreplacementList = makePSFontNameList( f ); + replacementList = makePSFontNameList( f ); } void TQPSPrinterFontNotFound::download(TQTextStream& s, bool) { //qDebug("downloading not found font %s", psname.latin1() ); - emitPSFontNameList( s, psname, tqreplacementList ); + emitPSFontNameList( s, psname, replacementList ); s << "% No embeddable font for "; s << psname; s << " found\n"; @@ -4328,7 +4328,7 @@ TQString TQPSPrinterFontAsian::defineFont( TQTextStream &stream, const TQString TQString fontName; TQString fontName2; - TQString *tmp = d->headerFontNames.tqfind( ps ); + TQString *tmp = d->headerFontNames.find( ps ); if ( d->buffer ) { if ( tmp ) { @@ -4364,7 +4364,7 @@ void TQPSPrinterFontAsian::download(TQTextStream& s, bool) //qDebug("downloading asian font %s", psname.latin1() ); s << "% Asian postscript font requested. Using " << psname << endl; - emitPSFontNameList( s, psname, tqreplacementList ); + emitPSFontNameList( s, psname, replacementList ); } void TQPSPrinterFontAsian::drawText( TQTextStream &stream, const TQPoint &p, TQTextEngine *engine, int item, @@ -4516,10 +4516,10 @@ TQPSPrinterFontJapanese::TQPSPrinterFontJapanese(const TQFontEngine* f) int type = getPsFontType( f ); psname = makePSFontName( f, type ); TQString best = "[ /" + psname + " 1.0 0.0 ]"; - tqreplacementList.append( best ); + replacementList.append( best ); - const psfont *const *tqreplacements = ( psname.tqcontains( "Helvetica" ) ? Japanese2Replacements : Japanese1Replacements ); - appendReplacements( tqreplacementList, tqreplacements, type ); + const psfont *const *replacements = ( psname.contains( "Helvetica" ) ? Japanese2Replacements : Japanese1Replacements ); + appendReplacements( replacementList, replacements, type ); } TQString TQPSPrinterFontJapanese::extension() const @@ -4615,8 +4615,8 @@ TQPSPrinterFontKorean::TQPSPrinterFontKorean(const TQFontEngine* f) int type = getPsFontType( f ); psname = makePSFontName( f, type ); TQString best = "[ /" + psname + " 1.0 0.0 ]"; - tqreplacementList.append( best ); - appendReplacements( tqreplacementList, KoreanReplacements, type ); + replacementList.append( best ); + appendReplacements( replacementList, KoreanReplacements, type ); } TQString TQPSPrinterFontKorean::extension() const @@ -4756,8 +4756,8 @@ TQPSPrinterFontTraditionalChinese::TQPSPrinterFontTraditionalChinese(const TQFon int type = getPsFontType( f ); psname = makePSFontName( f, type ); TQString best = "[ /" + psname + " 1.0 0.0 ]"; - tqreplacementList.append( best ); - appendReplacements( tqreplacementList, TraditionalReplacements, type ); + replacementList.append( best ); + appendReplacements( replacementList, TraditionalReplacements, type ); } TQString TQPSPrinterFontTraditionalChinese::extension() const @@ -4869,18 +4869,18 @@ TQPSPrinterFontSimplifiedChinese::TQPSPrinterFontSimplifiedChinese(const TQFontE codec = TQTextCodec::codecForMib( 114 ); // GB18030 int type = getPsFontType( f ); TQString family = f->fontDef.family.lower(); - if( family.tqcontains("kai",FALSE) ) { + if( family.contains("kai",FALSE) ) { psname = KaiGBK2K[type].psname; - appendReplacements( tqreplacementList, KaiGBK2KReplacements, type ); - } else if( family.tqcontains("fangsong",FALSE) ) { + appendReplacements( replacementList, KaiGBK2KReplacements, type ); + } else if( family.contains("fangsong",FALSE) ) { psname = FangSongGBK2K[type].psname; - appendReplacements( tqreplacementList, FangSongGBK2KReplacements, type ); - } else if( family.tqcontains("hei",FALSE) ) { + appendReplacements( replacementList, FangSongGBK2KReplacements, type ); + } else if( family.contains("hei",FALSE) ) { psname = HeiGBK2K[type].psname; - appendReplacements( tqreplacementList, HeiGBK2KReplacements, type ); + appendReplacements( replacementList, HeiGBK2KReplacements, type ); } else { psname = SongGBK2K[type].psname; - appendReplacements( tqreplacementList, SimplifiedReplacements, type ); + appendReplacements( replacementList, SimplifiedReplacements, type ); } //qDebug("simplified chinese: fontname is %s, psname=%s", f.family().latin1(), psname.latin1() ); } @@ -4950,11 +4950,11 @@ TQPSPrinterFont::TQPSPrinterFont(const TQFont &f, int script, TQPSPrinterPrivate TQString rawName; if ( engine && engine != (TQFontEngine *)-1 ) rawName = engine->name(); - int index = rawName.tqfind('-'); + int index = rawName.find('-'); if (index == 0) { // this is an XLFD font name for (int i=0; i < 6; i++) { - index = rawName.tqfind('-',index+1); + index = rawName.find('-',index+1); } xfontname = rawName.mid(0,index); if ( xfontname.endsWith( "*" ) ) @@ -5008,7 +5008,7 @@ TQPSPrinterFont::TQPSPrinterFont(const TQFont &f, int script, TQPSPrinterPrivate #endif //qDebug("looking for font %s in dict", xfontname.latin1() ); - p = priv->fonts.tqfind(xfontname); + p = priv->fonts.find(xfontname); if ( p ) return; @@ -5034,12 +5034,12 @@ TQPSPrinterFont::TQPSPrinterFont(const TQFont &f, int script, TQPSPrinterPrivate // fold to lower (since X folds to lowercase) //qWarning(xfontname); //qWarning(mapping); - if (mapping.lower().tqcontains(searchname.lower())) { - int index = mapping.tqfind(' ',0); + if (mapping.lower().contains(searchname.lower())) { + int index = mapping.find(' ',0); TQString ffn = mapping.mid(0,index); // remove the most common bitmap formats - if( !ffn.tqcontains( ".pcf" ) && !ffn.tqcontains( ".bdf" ) && - !ffn.tqcontains( ".spd" ) && !ffn.tqcontains( ".phont" ) ) { + if( !ffn.contains( ".pcf" ) && !ffn.contains( ".bdf" ) && + !ffn.contains( ".spd" ) && !ffn.contains( ".phont" ) ) { fontfilename = (*it) + TQString("/") + ffn; if ( TQFile::exists(fontfilename) ) { //qDebug("found font file %s", fontfilename.latin1()); @@ -5127,7 +5127,7 @@ TQPSPrinterFont::TQPSPrinterFont(const TQFont &f, int script, TQPSPrinterPrivate } } else #endif - //qDebug("didnt tqfind font for %s", xfontname.latin1()); + //qDebug("didnt find font for %s", xfontname.latin1()); p = new TQPSPrinterFontNotFound( engine ); break; } @@ -5195,15 +5195,15 @@ TQPSPrinterPrivate::TQPSPrinterPrivate( TQPrinter *prt, int filedes ) TQString fs; f.readLine(fs, 1024); fs=fs.stripWhiteSpace(); - if (fs.left(9)=="catalogue" && fs.tqcontains('=')) { - fs=fs.mid(fs.tqfind('=')+1).stripWhiteSpace(); + if (fs.left(9)=="catalogue" && fs.contains('=')) { + fs=fs.mid(fs.find('=')+1).stripWhiteSpace(); bool end = FALSE; while( f.status()==IO_Ok && !end ) { if ( fs[int(fs.length())-1] == ',' ) fs = fs.left(fs.length()-1); else end = TRUE; - if (fs[0] != '#' && !fs.tqcontains(":unscaled")) + if (fs[0] != '#' && !fs.contains(":unscaled")) fontpath += fs; f.readLine(fs, 1024); fs=fs.stripWhiteSpace(); @@ -5268,9 +5268,9 @@ void TQPSPrinterPrivate::setFont( const TQFont & fnt, int script ) key += " px" + toString( f.pixelSize() ); TQString * tmp; if ( !buffer ) - tmp = pageFontNames.tqfind( key ); + tmp = pageFontNames.find( key ); else - tmp = headerFontNames.tqfind( key ); + tmp = headerFontNames.find( key ); TQString fontName; if ( tmp ) @@ -5283,7 +5283,7 @@ void TQPSPrinterPrivate::setFont( const TQFont & fnt, int script ) ps.append( ' ' ); ps.prepend( ' ' ); - if ( !fontsUsed.tqcontains( ps ) ) + if ( !fontsUsed.contains( ps ) ) fontsUsed += ps; #ifndef TQT_NO_TEXTCODEC @@ -5465,7 +5465,7 @@ static TQByteArray compress( const TQImage & image, bool gray ) { looking for some spot where those pixels of those two colours occur at the right distance from each other. - when we tqfind a spot, we'll try a string-compare of all the + when we find a spot, we'll try a string-compare of all the intervening pixels. we only do a maximum of 128 both-ends compares or 64 full-string compares. it's more important to be fast than get the ultimate in compression. @@ -5991,9 +5991,9 @@ void TQPSPrinterPrivate::emitHeader( bool finished ) " [ m s s s ] [ s m s s ]" // dash dot line " [ m s s s s ] [ s m s s s s ]" // dash dot dot line " ] d\n"; - lineStyles.tqreplace( TQRegExp( "w" ), toString( 10./scale ) ); - lineStyles.tqreplace( TQRegExp( "m" ), toString( 5./scale ) ); - lineStyles.tqreplace( TQRegExp( "s" ), toString( 3./scale ) ); + lineStyles.replace( TQRegExp( "w" ), toString( 10./scale ) ); + lineStyles.replace( TQRegExp( "m" ), toString( 5./scale ) ); + lineStyles.replace( TQRegExp( "s" ), toString( 3./scale ) ); outStream << lineStyles; |