diff options
Diffstat (limited to 'karbon/core/vtext.cc')
-rw-r--r-- | karbon/core/vtext.cc | 98 |
1 files changed, 49 insertions, 49 deletions
diff --git a/karbon/core/vtext.cc b/karbon/core/vtext.cc index 53c6af51..9f215b59 100644 --- a/karbon/core/vtext.cc +++ b/karbon/core/vtext.cc @@ -17,8 +17,8 @@ * Boston, MA 02110-1301, USA. */ -#include <qdom.h> -#include <qfile.h> +#include <tqdom.h> +#include <tqfile.h> #include <kdebug.h> #include <KoPoint.h> @@ -56,7 +56,7 @@ int traceMoveto( FT_Vector *to, VPath *composite ) double tox = ( to->x / 64.0 ); double toy = ( -to->y / 64.0 ); - //QString add = "M" + QString::number(tox) + "," + QString::number(toy) + " "; + //TQString add = "M" + TQString::number(tox) + "," + TQString::number(toy) + " "; //kdDebug(38000) << add.latin1() << endl; composite->moveTo( KoPoint( tox, toy ) ); @@ -68,7 +68,7 @@ int traceLineto( FT_Vector *to, VPath *composite ) double tox = ( to->x / 64.0 ); double toy = ( -to->y / 64.0 ); - //QString add = "L" + QString::number(tox) + "," + QString::number(toy) + " "; + //TQString add = "L" + TQString::number(tox) + "," + TQString::number(toy) + " "; //kdDebug(38000) << add.latin1() << endl; composite->lineTo( KoPoint( tox, toy ) ); @@ -83,7 +83,7 @@ int traceQuadraticBezier( FT_Vector *control, FT_Vector *to, VPath *composite ) double x2 = ( to->x / 64.0 ); double y2 = ( -to->y / 64.0 ); - //QString add = "Q" + QString::number(x1) + "," + QString::number(y1) + "," + QString::number(x2) + "," + QString::number(y2) + " "; + //TQString add = "Q" + TQString::number(x1) + "," + TQString::number(y1) + "," + TQString::number(x2) + "," + TQString::number(y2) + " "; //kdDebug(38000) << add.latin1() << endl; composite->curveTo( KoPoint( x1, y1 ), KoPoint( x2, y2 ), KoPoint( x2, y2 ) ); //composite->curve2To( KoPoint( x1, y1 ), KoPoint( x2, y2 ) ); @@ -100,7 +100,7 @@ int traceCubicBezier( FT_Vector *p, FT_Vector *q, FT_Vector *to, VPath *composit double x3 = ( to->x / 64.0 ); double y3 = ( -to->y / 64.0 ); - //QString add = "C" + QString::number(x1) + "," + QString::number(y1) + "," + QString::number(x2) + "," + QString::number(y2) + "," + QString::number(x3) + "," + QString::number(y3); + //TQString add = "C" + TQString::number(x1) + "," + TQString::number(y1) + "," + TQString::number(x2) + "," + TQString::number(y2) + "," + TQString::number(x3) + "," + TQString::number(y3); //kdDebug(38000) << add.latin1() << endl; composite->curveTo( KoPoint( x1, y1 ), KoPoint( x2, y2 ), KoPoint( x3, y3 ) ); @@ -120,15 +120,15 @@ FT_Outline_Funcs OutlineMethods = #endif // HAVE_KARBONTEXT -VText::VText( VObject* parent, VState state ) - : VObject( parent, state ), m_basePath( 0L ) +VText::VText( VObject* tqparent, VState state ) + : VObject( tqparent, state ), m_basePath( 0L ) { m_glyphs.setAutoDelete( true ); m_boundingBoxIsInvalid = true; m_stroke = new VStroke( this ); m_fill = new VFill(); m_position = (VText::Position)0; - m_alignment = (VText::Alignment)0; + m_tqalignment = (VText::Alignment)0; m_shadow = false; m_translucentShadow = false; m_shadowAngle = 0; @@ -137,8 +137,8 @@ VText::VText( VObject* parent, VState state ) } -VText::VText( const QFont &font, const VSubpath& basePath, Position position, Alignment alignment, const QString& text ) - : VObject( 0L ), m_font( font ), m_basePath( basePath ), m_position( position ), m_alignment( alignment ), m_text( text ) +VText::VText( const TQFont &font, const VSubpath& basePath, Position position, Alignment tqalignment, const TQString& text ) + : VObject( 0L ), m_font( font ), m_basePath( basePath ), m_position( position ), m_tqalignment( tqalignment ), m_text( text ) { m_glyphs.setAutoDelete( true ); m_boundingBoxIsInvalid = true; @@ -148,7 +148,7 @@ VText::VText( const QFont &font, const VSubpath& basePath, Position position, Al } VText::VText( const VText& text ) - : VObject( text ), m_font( text.m_font ), m_basePath( text.m_basePath ), m_position( text.m_position ), m_alignment( text.m_alignment ), m_text( text.m_text ), m_shadow( text.m_shadow ), m_translucentShadow( text.m_translucentShadow ), m_shadowDistance( text.m_shadowDistance ), m_shadowAngle( text.m_shadowAngle ), m_offset( text.m_offset ) + : VObject( text ), m_font( text.m_font ), m_basePath( text.m_basePath ), m_position( text.m_position ), m_tqalignment( text.m_tqalignment ), m_text( text.m_text ), m_shadow( text.m_shadow ), m_translucentShadow( text.m_translucentShadow ), m_shadowDistance( text.m_shadowDistance ), m_shadowAngle( text.m_shadowAngle ), m_offset( text.m_offset ) { m_stroke = new VStroke( *text.m_stroke ); m_stroke->setParent( this ); @@ -215,15 +215,15 @@ VText::draw( VPainter* painter, const KoRect* /*rect*/ ) const int shadowDx = int( m_shadowDistance * cos( m_shadowAngle / 360. * 6.2832 ) ); int shadowDy = int( m_shadowDistance * sin( m_shadowAngle / 360. * 6.2832 ) ); - VTransformCmd trafo( 0L, QWMatrix() ); + VTransformCmd trafo( 0L, TQWMatrix() ); for( itr.toFirst(); itr.current(); ++itr ) { - trafo.setMatrix( QWMatrix( 1, 0, 0, 1, shadowDx, shadowDy ) ); + trafo.setMatrix( TQWMatrix( 1, 0, 0, 1, shadowDx, shadowDy ) ); trafo.visit( *( itr.current() ) ); itr.current()->setFill( VFill( color ) ); itr.current()->setStroke( VStroke( color ) ); itr.current()->draw( painter ); - trafo.setMatrix( QWMatrix( 1, 0, 0, 1, -shadowDx, -shadowDy ) ); + trafo.setMatrix( TQWMatrix( 1, 0, 0, 1, -shadowDx, -shadowDy ) ); trafo.visit( *( itr.current() ) ); } } @@ -240,9 +240,9 @@ VText::draw( VPainter* painter, const KoRect* /*rect*/ ) const if( state() == edit )//|| state() == selected ) { painter->newPath(); - painter->setRasterOp( Qt::XorROP ); - painter->setPen( Qt::yellow ); - painter->setBrush( Qt::NoBrush ); + painter->setRasterOp( TQt::XorROP ); + painter->setPen( TQt::yellow ); + painter->setBrush( TQt::NoBrush ); for( itr.toFirst(); itr.current(); ++itr ) itr.current()->draw( painter ); @@ -287,7 +287,7 @@ VText::clone() const VGroup* VText::toVGroup() const { - VGroup* group = new VGroup( parent() ); + VGroup* group = new VGroup( tqparent() ); VPathListIterator itr( m_glyphs ); for( itr.toFirst(); itr.current(); ++itr ) @@ -304,11 +304,11 @@ VGroup* VText::toVGroup() const } // VText::toVGroup void -VText::save( QDomElement& element ) const +VText::save( TQDomElement& element ) const { if( state() != deleted ) { - QDomElement me = element.ownerDocument().createElement( "TEXT" ); + TQDomElement me = element.ownerDocument().createElement( "TEXT" ); VPath path( 0L ); path.combinePath( m_basePath ); @@ -323,7 +323,7 @@ VText::save( QDomElement& element ) const me.setAttribute( "italic", m_font.italic() ); me.setAttribute( "bold", m_font.bold() ); me.setAttribute( "position", m_position ); - me.setAttribute( "alignment", m_alignment ); + me.setAttribute( "tqalignment", m_tqalignment ); me.setAttribute( "shadow", m_shadow ); me.setAttribute( "translucentshadow", m_translucentShadow ); me.setAttribute( "shadowangle", m_shadowAngle ); @@ -339,17 +339,17 @@ VText::save( QDomElement& element ) const } void -VText::load( const QDomElement& element ) +VText::load( const TQDomElement& element ) { m_glyphs.clear(); m_font.setFamily( element.attribute( "family", "Times" ) ); m_font.setPointSize( element.attribute( "size", "12" ).toInt() ); m_font.setItalic( element.attribute( "italic" ).toInt() == 1 ); - m_font.setWeight( QFont::Normal ); + m_font.setWeight( TQFont::Normal ); m_font.setBold( element.attribute( "bold" ).toInt() == 1 ); m_position = (Position)element.attribute( "position", "0" ).toInt(); - m_alignment = (Alignment)element.attribute( "alignment", "0" ).toInt(); + m_tqalignment = (Alignment)element.attribute( "tqalignment", "0" ).toInt(); m_shadow = ( element.attribute( "shadow" ).toInt() == 1 ); m_translucentShadow = ( element.attribute( "translucentshadow" ).toInt() == 1 ); m_shadowAngle = element.attribute( "shadowangle" ).toInt(); @@ -359,8 +359,8 @@ VText::load( const QDomElement& element ) VObject::load( element ); - QDomNodeList list = element.childNodes(); - QDomElement e = list.item( 0 ).toElement(); + TQDomNodeList list = element.childNodes(); + TQDomElement e = list.item( 0 ).toElement(); // element to start with reading glyph paths and stroke, fill, etc. uint startElement = 0; @@ -401,7 +401,7 @@ VText::load( const QDomElement& element ) } void -VText::setText( const QString& text ) +VText::setText( const TQString& text ) { if( m_text != text ) { @@ -453,17 +453,17 @@ VText::traceText() // Build FontConfig request pattern int id = -1; - QString filename = buildRequest( m_font.family(), weight, slant, m_font.pointSize(), id ); + TQString filename = buildRequest( m_font.family(), weight, slant, m_font.pointSize(), id ); m_glyphs.clear(); - kdDebug(38000) << "Loading " << filename.latin1() << " for requested font \"" << m_font.family().latin1() << "\", " << m_font.pointSize() << " pt." << endl; + kdDebug(38000) << "Loading " << filename.latin1() << " for requested font \"" << TQString(m_font.family()).latin1() << "\", " << m_font.pointSize() << " pt." << endl; FT_UInt glyphIndex; FT_Face fontFace; // TODO : this lib should probably be a singleton (Rob) FT_Library library; FT_Init_FreeType( &library ); - FT_Error error = FT_New_Face( library, QFile::encodeName(filename), id, &fontFace ); + FT_Error error = FT_New_Face( library, TQFile::encodeName(filename), id, &fontFace ); if( error ) { @@ -473,7 +473,7 @@ VText::traceText() bool foundCharmap = false; - // Try to choose unicode charmap + // Try to choose tqunicode charmap for( int charmap = 0; charmap < fontFace->num_charmaps; charmap++ ) { if( fontFace->charmaps[charmap]->encoding == ft_encoding_unicode ) @@ -481,14 +481,14 @@ VText::traceText() FT_Error error = FT_Set_Charmap( fontFace, fontFace->charmaps[charmap] ); if( error ) { - kdDebug(38000) << "traceText(), unable to select unicode charmap." << endl; + kdDebug(38000) << "traceText(), unable to select tqunicode charmap." << endl; continue; } foundCharmap = true; } } - // Choose first charmap if no unicode charmap was found + // Choose first charmap if no tqunicode charmap was found if( ! foundCharmap ) { error = FT_Set_Charmap( fontFace, fontFace->charmaps[0] ); @@ -512,13 +512,13 @@ VText::traceText() // storing glyphs. float l = 0; - QValueList<float> glyphXAdvance; - QValueList<float> glyphYAdvance; + TQValueList<float> glyphXAdvance; + TQValueList<float> glyphYAdvance; for( unsigned int i = 0; i < m_text.length(); i++ ) { // get the glyph index for the current character - QChar character = m_text.at( i ); - glyphIndex = FT_Get_Char_Index( fontFace, character.unicode() ); + TQChar character = m_text.at( i ); + glyphIndex = FT_Get_Char_Index( fontFace, character.tqunicode() ); if( ! glyphIndex ) { kdDebug(38000) << "traceText(), unable get index of char : " << character << endl; @@ -575,7 +575,7 @@ VText::traceText() kdDebug(38000) << "traceText(), using offset : " << m_offset << endl; float x = m_offset * pathLength; - switch( m_alignment ) + switch( m_tqalignment ) { case Left: x += 0; break; case Center: x -= 0.5 * l; break; @@ -603,7 +603,7 @@ VText::traceText() // Step 1: place (0, 0) to the rotation center of the glyph. dx = *glyphXAdvance.at( i ) / 2; x += dx; - VTransformCmd trafo( 0L, QWMatrix( 1, 0, 0, 1, -dx, y + yoffset ) ); + VTransformCmd trafo( 0L, TQWMatrix( 1, 0, 0, 1, -dx, y + yoffset ) ); trafo.visit( *composite ); // Step 2: find the position where to draw. @@ -640,11 +640,11 @@ VText::traceText() // Step 3: transform glyph and append it. That's it, we've got // text following a path. Really easy, isn't it ;) ? - trafo.setMatrix( QWMatrix( tangent.x(), tangent.y(), tangent.y(), -tangent.x(), point.x(), point.y() ) ); + trafo.setMatrix( TQWMatrix( tangent.x(), tangent.y(), tangent.y(), -tangent.x(), point.x(), point.y() ) ); trafo.visit( *composite ); composite->setState( state() ); - //kdDebug(38000) << "Glyph: " << (QString)character << " [String pos: " << x << ", " << y << " / Canvas pos: " << point.x() << ", " << point.y() << "]" << endl; + //kdDebug(38000) << "Glyph: " << (TQString)character << " [String pos: " << x << ", " << y << " / Canvas pos: " << point.x() << ", " << point.y() << "]" << endl; x += dx; y += *glyphYAdvance.at( i ); @@ -655,17 +655,17 @@ VText::traceText() } // This routine is copied from KSVGFont (Rob) -QString -VText::buildRequest( QString family, int weight, int slant, double size, int &id ) +TQString +VText::buildRequest( TQString family, int weight, int slant, double size, int &id ) { // Strip those stupid [Xft or whatever]... int pos; - if( ( pos = family.find( '[' ) ) ) + if( ( pos = family.tqfind( '[' ) ) ) family = family.left( pos ); // Use FontConfig to locate & select fonts and use FreeType2 to open them FcPattern *pattern; - QString fileName; + TQString fileName; pattern = FcPatternBuild( 0, FC_WEIGHT, FcTypeInteger, weight, FC_SLANT, FcTypeInteger, slant, @@ -710,13 +710,13 @@ VText::buildRequest( QString family, int weight, int slant, double size, int &id FcPatternGetInteger(pattern, FC_INDEX, 0, &id) != FcResultMatch ) { kdDebug(38000) << "VText::buildRequest(), could not load font file for requested font \"" << family.latin1() << "\"" << endl; - return QString::null; + return TQString(); } - fileName = QFile::decodeName(reinterpret_cast<const char *>( temp )); + fileName = TQFile::decodeName(reinterpret_cast<const char *>( temp )); // get family name of matched font - QString newFamily; + TQString newFamily; if( FcResultMatch == FcPatternGetString( pattern, FC_FAMILY, 0, &temp ) ) m_font.setFamily( reinterpret_cast<const char *>( temp ) ); |