summaryrefslogtreecommitdiffstats
path: root/lib/kotext/KoComplexText.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/kotext/KoComplexText.cpp')
-rw-r--r--lib/kotext/KoComplexText.cpp66
1 files changed, 33 insertions, 33 deletions
diff --git a/lib/kotext/KoComplexText.cpp b/lib/kotext/KoComplexText.cpp
index 981ec506..96ff88e1 100644
--- a/lib/kotext/KoComplexText.cpp
+++ b/lib/kotext/KoComplexText.cpp
@@ -65,8 +65,8 @@ KoBidiContext::~KoBidiContext()
delete parent;
}
-static TQChar *tqshapeBuffer = 0;
-static int tqshapeBufSize = 0;
+static TQChar *shapeBuffer = 0;
+static int shapeBufSize = 0;
/*
Arabic shaping obeys a number of rules according to the joining classes (see Unicode book, section on
@@ -103,7 +103,7 @@ static int tqshapeBufSize = 0;
*/
/*
- Two small helper functions for arabic shaping. They get the next tqshape causing character on either
+ Two small helper functions for arabic shaping. They get the next shape causing character on either
side of the char in question. Implements rule R1.
leftChar() returns true if the char to the left is a left join-causing char
@@ -159,7 +159,7 @@ KoComplexText::Shape KoComplexText::glyphVariant( const TQString &str, int pos)
switch ( joining ) {
case TQChar::OtherJoining:
case TQChar::Center:
- // these don't change tqshape
+ // these don't change shape
return XIsolated;
case TQChar::Right:
// only rule R2 applies
@@ -204,7 +204,7 @@ KoComplexText::Shape KoComplexText::glyphVariantLogical( const TQString &str, in
switch ( joining ) {
case TQChar::OtherJoining:
case TQChar::Center:
- // these don't change tqshape
+ // these don't change shape
return XIsolated;
case TQChar::Right:
// only rule R2 applies
@@ -233,7 +233,7 @@ KoComplexText::Shape KoComplexText::glyphVariantLogical( const TQString &str, in
// does only presentation forms B at the moment, but that should be enough for
// simple display
static const ushort arabicUnicodeMapping[256][2] = {
- // base of tqshaped forms, and number-1 of them ( 0 for non shaping,
+ // base of shaped forms, and number-1 of them ( 0 for non shaping,
// 1 for right binding and 3 for dual binding
{ 0x0600, 0 }, // 0x600
{ 0x0601, 0 }, // 0x601
@@ -355,7 +355,7 @@ static const ushort arabicUnicodeMapping[256][2] = {
{ 0x066e, 0 }, // 0x66e
{ 0x066f, 0 }, // 0x66f
- // ### some glyphs do not have tqshaped mappings in the presentation forms A.
+ // ### some glyphs do not have shaped mappings in the presentation forms A.
// these have the shaping set to 0 for the moment. Will have to find out better mappings for them.
{ 0x0670, 0 }, // 0x670
{ 0xfb50, 1 }, // 0x671 R Alef Wasla
@@ -512,7 +512,7 @@ static const ushort arabicUnicodeMapping[256][2] = {
};
-// this is a bit tricky. Alef always binds to the right, so the second parameter descibing the tqshape
+// this is a bit tricky. Alef always binds to the right, so the second parameter descibing the shape
// of the lam can be either initial of medial. So initial maps to the isolated form of the ligature,
// medial to the final form
static const ushort arabicUnicodeLamAlefMapping[6][4] = {
@@ -524,14 +524,14 @@ static const ushort arabicUnicodeLamAlefMapping[6][4] = {
{ 0xfffd, 0xfffd, 0xfefb, 0xfefc } // 0x627 R Alef
};
-static inline int getShape( const TQChar * /* base */, uchar cell, int tqshape,
+static inline int getShape( const TQChar * /* base */, uchar cell, int shape,
const TQFontMetrics * /* fm */ )
{
- uint ch = arabicUnicodeMapping[cell][0] + tqshape;
+ uint ch = arabicUnicodeMapping[cell][0] + shape;
/*
- // we revert to the untqshaped glyph in case the tqshaped version doesn't exist
+ // we revert to the unshaped glyph in case the shaped version doesn't exist
if ( fm && !fm->inFont( ch ) ) {
- switch( tqshape ) {
+ switch( shape ) {
case KoComplexText::XIsolated:
break; // try base form
case KoComplexText::XFinal:
@@ -551,7 +551,7 @@ static inline int getShape( const TQChar * /* base */, uchar cell, int tqshape,
return ch;
}
-TQString KoComplexText::tqshapedString(const TQString& uc, int from, int len, TQPainter::TextDirection dir, const TQFontMetrics *fm )
+TQString KoComplexText::shapedString(const TQString& uc, int from, int len, TQPainter::TextDirection dir, const TQFontMetrics *fm )
{
if( len < 0 )
len = uc.length() - from;
@@ -575,16 +575,16 @@ TQString KoComplexText::tqshapedString(const TQString& uc, int from, int len, TQ
}
if ( len == 0 ) return TQString();
- if( !tqshapeBuffer || len > tqshapeBufSize ) {
- if( tqshapeBuffer ) free( (void *) tqshapeBuffer );
- tqshapeBuffer = (TQChar *) malloc( len*sizeof( TQChar ) );
-// delete [] tqshapeBuffer;
-// tqshapeBuffer = new TQChar[ len + 1];
- tqshapeBufSize = len;
+ if( !shapeBuffer || len > shapeBufSize ) {
+ if( shapeBuffer ) free( (void *) shapeBuffer );
+ shapeBuffer = (TQChar *) malloc( len*sizeof( TQChar ) );
+// delete [] shapeBuffer;
+// shapeBuffer = new TQChar[ len + 1];
+ shapeBufSize = len;
}
int lenOut = 0;
- TQChar *data = tqshapeBuffer;
+ TQChar *data = shapeBuffer;
if ( dir == TQPainter::RTL )
ch += len - 1;
for ( int i = 0; i < len; i++ ) {
@@ -601,8 +601,8 @@ TQString KoComplexText::tqshapedString(const TQString& uc, int from, int len, TQ
int pos = i + from;
if ( dir == TQPainter::RTL )
pos = from + len - 1 - i;
- int tqshape = glyphVariantLogical( uc, pos );
- //kdDebug() << "mapping U+" << ch->tqunicode() << " to tqshape " << tqshape << " glyph=0x" << arabicUnicodeMapping[ch->cell()][tqshape] << endl;
+ int shape = glyphVariantLogical( uc, pos );
+ //kdDebug() << "mapping U+" << ch->tqunicode() << " to shape " << shape << " glyph=0x" << arabicUnicodeMapping[ch->cell()][shape] << endl;
// take care of lam-alef ligatures (lam right of alef)
ushort map;
switch ( c ) {
@@ -615,7 +615,7 @@ TQString KoComplexText::tqshapedString(const TQString& uc, int from, int len, TQ
case 0x25:
case 0x27:
//kdDebug() << " lam of lam-alef ligature" << endl;
- map = arabicUnicodeLamAlefMapping[pch->cell() - 0x22][tqshape];
+ map = arabicUnicodeLamAlefMapping[pch->cell() - 0x22][shape];
goto next;
default:
break;
@@ -635,7 +635,7 @@ TQString KoComplexText::tqshapedString(const TQString& uc, int from, int len, TQ
default:
break;
}
- map = getShape( ch, c, tqshape, fm );
+ map = getShape( ch, c, shape, fm );
next:
*data = map;
data++;
@@ -649,11 +649,11 @@ TQString KoComplexText::tqshapedString(const TQString& uc, int from, int len, TQ
}
if ( dir == TQPainter::Auto && !uc.simpleText() ) {
- return bidiReorderString( TQConstString( tqshapeBuffer, lenOut ).string() );
+ return bidiReorderString( TQConstString( shapeBuffer, lenOut ).string() );
}
if ( dir == TQPainter::RTL ) {
// reverses the non spacing marks to be again after the base char
- TQChar *s = tqshapeBuffer;
+ TQChar *s = shapeBuffer;
int i = 0;
while ( i < lenOut ) {
if ( s->combiningClass() != 0 ) {
@@ -684,17 +684,17 @@ TQString KoComplexText::tqshapedString(const TQString& uc, int from, int len, TQ
}
}
- return TQConstString( tqshapeBuffer, lenOut ).string();
+ return TQConstString( shapeBuffer, lenOut ).string();
}
-TQChar KoComplexText::tqshapedCharacter( const TQString &str, int pos, const TQFontMetrics *fm )
+TQChar KoComplexText::shapedCharacter( const TQString &str, int pos, const TQFontMetrics *fm )
{
const TQChar *ch = str.tqunicode() + pos;
if ( ch->row() != 0x06 )
return *ch;
else {
- int tqshape = glyphVariantLogical( str, pos );
- //kdDebug() << "mapping U+" << ch->tqunicode() << " to tqshape " << tqshape << " glyph=0x" << arabicUnicodeMapping[ch->cell()][tqshape] << endl;
+ int shape = glyphVariantLogical( str, pos );
+ //kdDebug() << "mapping U+" << ch->tqunicode() << " to shape " << shape << " glyph=0x" << arabicUnicodeMapping[ch->cell()][shape] << endl;
// lam aleph ligatures
switch ( ch->cell() ) {
case 0x44: { // lam
@@ -705,7 +705,7 @@ TQChar KoComplexText::tqshapedCharacter( const TQString &str, int pos, const TQF
case 0x23:
case 0x25:
case 0x27:
- return TQChar(arabicUnicodeLamAlefMapping[nch->cell() - 0x22][tqshape]);
+ return TQChar(arabicUnicodeLamAlefMapping[nch->cell() - 0x22][shape]);
default:
break;
}
@@ -722,7 +722,7 @@ TQChar KoComplexText::tqshapedCharacter( const TQString &str, int pos, const TQF
default:
break;
}
- return TQChar( getShape( ch, ch->cell(), tqshape, fm ) );
+ return TQChar( getShape( ch, ch->cell(), shape, fm ) );
}
}
@@ -739,7 +739,7 @@ TQPointArray KoComplexText::positionMarks( TQFontPrivate *f, const TQString &str
if ( !nmarks )
return TQPointArray();
- TQChar baseChar = KoComplexText::tqshapedCharacter( str, pos );
+ TQChar baseChar = KoComplexText::shapedCharacter( str, pos );
TQRect baseRect = f->boundingRect( baseChar );
int baseOffset = f->textWidth( str, pos, 1 );