summaryrefslogtreecommitdiffstats
path: root/kdvi/TeXFont_PFB.cpp
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-06-19 19:03:33 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-06-19 19:03:33 +0000
commite69e8b1d09fb579316595b4e6a850e717358a8b1 (patch)
treea24fc20865f65772f530d16177520190594ffdd2 /kdvi/TeXFont_PFB.cpp
parenteecec9afb81fdebb0f22e9da22635874c403f854 (diff)
downloadtdegraphics-e69e8b1d09fb579316595b4e6a850e717358a8b1.tar.gz
tdegraphics-e69e8b1d09fb579316595b4e6a850e717358a8b1.zip
TQt4 port kdegraphics
This enables compilation under both Qt3 and Qt4 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdegraphics@1237557 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kdvi/TeXFont_PFB.cpp')
-rw-r--r--kdvi/TeXFont_PFB.cpp64
1 files changed, 32 insertions, 32 deletions
diff --git a/kdvi/TeXFont_PFB.cpp b/kdvi/TeXFont_PFB.cpp
index 2b3883fe..a017259d 100644
--- a/kdvi/TeXFont_PFB.cpp
+++ b/kdvi/TeXFont_PFB.cpp
@@ -26,28 +26,28 @@
//#define DEBUG_PFB 1
-TeXFont_PFB::TeXFont_PFB(TeXFontDefinition *parent, fontEncoding *enc, double slant)
- : TeXFont(parent)
+TeXFont_PFB::TeXFont_PFB(TeXFontDefinition *tqparent, fontEncoding *enc, double slant)
+ : TeXFont(tqparent)
{
#ifdef DEBUG_PFB
if (enc != 0)
- kdDebug(4300) << "TeXFont_PFB::TeXFont_PFB( parent=" << parent << ", encoding=" << enc->encodingFullName << " )" << endl;
+ kdDebug(4300) << "TeXFont_PFB::TeXFont_PFB( tqparent=" << tqparent << ", encoding=" << enc->encodingFullName << " )" << endl;
else
- kdDebug(4300) << "TeXFont_PFB::TeXFont_PFB( parent=" << parent << ", encoding=0 )" << endl;
+ kdDebug(4300) << "TeXFont_PFB::TeXFont_PFB( tqparent=" << tqparent << ", encoding=0 )" << endl;
#endif
fatalErrorInFontLoading = false;
- int error = FT_New_Face( parent->font_pool->FreeType_library, parent->filename.local8Bit(), 0, &face );
+ int error = FT_New_Face( tqparent->font_pool->FreeType_library, tqparent->filename.local8Bit(), 0, &face );
if ( error == FT_Err_Unknown_File_Format ) {
- errorMessage = i18n("The font file %1 could be opened and read, but its font format is unsupported.").arg(parent->filename);
+ errorMessage = i18n("The font file %1 could be opened and read, but its font format is unsupported.").tqarg(tqparent->filename);
kdError(4300) << errorMessage << endl;
fatalErrorInFontLoading = true;
return;
} else
if ( error ) {
- errorMessage = i18n("The font file %1 is broken, or it could not be opened or read.").arg(parent->filename);
+ errorMessage = i18n("The font file %1 is broken, or it could not be opened or read.").tqarg(tqparent->filename);
kdError(4300) << errorMessage << endl;
fatalErrorInFontLoading = true;
return;
@@ -66,7 +66,7 @@ TeXFont_PFB::TeXFont_PFB(TeXFontDefinition *parent, fontEncoding *enc, double sl
}
if (face->family_name != 0)
- parent->fullFontName = face->family_name;
+ tqparent->fullFontName = face->family_name;
// Finally, we need to set up the charMap array, which maps TeX
// character codes to glyph indices in the font. (Remark: the
@@ -74,8 +74,8 @@ TeXFont_PFB::TeXFont_PFB(TeXFontDefinition *parent, fontEncoding *enc, double sl
// TeX is only able to address character codes 0-255 while
// e.g. Type1 fonts may contain several thousands of characters)
if (enc != 0) {
- parent->fullEncodingName = enc->encodingFullName.remove(TQString::fromLatin1( "Encoding" ));
- parent->fullEncodingName = enc->encodingFullName.remove(TQString::fromLatin1( "encoding" ));
+ tqparent->fullEncodingName = enc->encodingFullName.remove(TQString::tqfromLatin1( "Encoding" ));
+ tqparent->fullEncodingName = enc->encodingFullName.remove(TQString::tqfromLatin1( "encoding" ));
// An encoding vector is given for this font, i.e. an array of
// character names (such as: 'parenleft' or 'dotlessj'). We use
@@ -138,7 +138,7 @@ TeXFont_PFB::~TeXFont_PFB()
}
-glyph *TeXFont_PFB::getGlyph(Q_UINT16 ch, bool generateCharacterPixmap, const TQColor& color)
+glyph *TeXFont_PFB::getGlyph(TQ_UINT16 ch, bool generateCharacterPixmap, const TQColor& color)
{
#ifdef DEBUG_PFB
kdDebug(4300) << "TeXFont_PFB::getGlyph( ch=" << ch << ", '" << (char)(ch) << "', generateCharacterPixmap=" << generateCharacterPixmap << " )" << endl;
@@ -159,16 +159,16 @@ glyph *TeXFont_PFB::getGlyph(Q_UINT16 ch, bool generateCharacterPixmap, const TQ
if ((generateCharacterPixmap == true) && ((g->shrunkenCharacter.isNull()) || (color != g->color)) ) {
int error;
- unsigned int res = (unsigned int)(parent->displayResolution_in_dpi/parent->enlargement +0.5);
+ unsigned int res = (unsigned int)(tqparent->displayResolution_in_dpi/tqparent->enlargement +0.5);
g->color = color;
// Character height in 1/64th of points (reminder: 1 pt = 1/72 inch)
// Only approximate, may vary from file to file!!!! @@@@@
- long int characterSize_in_printers_points_by_64 = (long int)((64.0*72.0*parent->scaled_size_in_DVI_units*parent->font_pool->getCMperDVIunit())/2.54 + 0.5 );
+ long int characterSize_in_printers_points_by_64 = (long int)((64.0*72.0*tqparent->scaled_size_in_DVI_units*tqparent->font_pool->getCMperDVIunit())/2.54 + 0.5 );
error = FT_Set_Char_Size(face, 0, characterSize_in_printers_points_by_64, res, res );
if (error) {
- TQString msg = i18n("FreeType reported an error when setting the character size for font file %1.").arg(parent->filename);
+ TQString msg = i18n("FreeType reported an error when setting the character size for font file %1.").tqarg(tqparent->filename);
if (errorMessage.isEmpty())
errorMessage = msg;
kdError(4300) << msg << endl;
@@ -178,13 +178,13 @@ glyph *TeXFont_PFB::getGlyph(Q_UINT16 ch, bool generateCharacterPixmap, const TQ
}
// load glyph image into the slot and erase the previous one
- if (parent->font_pool->getUseFontHints() == true)
+ if (tqparent->font_pool->getUseFontHints() == true)
error = FT_Load_Glyph(face, charMap[ch], FT_LOAD_DEFAULT );
else
error = FT_Load_Glyph(face, charMap[ch], FT_LOAD_NO_HINTING );
if (error) {
- TQString msg = i18n("FreeType is unable to load glyph #%1 from font file %2.").arg(ch).arg(parent->filename);
+ TQString msg = i18n("FreeType is unable to load glyph #%1 from font file %2.").tqarg(ch).tqarg(tqparent->filename);
if (errorMessage.isEmpty())
errorMessage = msg;
kdError(4300) << msg << endl;
@@ -196,7 +196,7 @@ glyph *TeXFont_PFB::getGlyph(Q_UINT16 ch, bool generateCharacterPixmap, const TQ
// convert to an anti-aliased bitmap
error = FT_Render_Glyph( face->glyph, ft_render_mode_normal );
if (error) {
- TQString msg = i18n("FreeType is unable to render glyph #%1 from font file %2.").arg(ch).arg(parent->filename);
+ TQString msg = i18n("FreeType is unable to render glyph #%1 from font file %2.").tqarg(ch).tqarg(tqparent->filename);
if (errorMessage.isEmpty())
errorMessage = msg;
kdError(4300) << msg << endl;
@@ -209,8 +209,8 @@ glyph *TeXFont_PFB::getGlyph(Q_UINT16 ch, bool generateCharacterPixmap, const TQ
if ((slot->bitmap.width == 0) || (slot->bitmap.rows == 0)) {
if (errorMessage.isEmpty())
- errorMessage = i18n("Glyph #%1 is empty.").arg(ch);
- kdError(4300) << i18n("Glyph #%1 from font file %2 is empty.").arg(ch).arg(parent->filename) << endl;
+ errorMessage = i18n("Glyph #%1 is empty.").tqarg(ch);
+ kdError(4300) << i18n("Glyph #%1 from font file %2 is empty.").tqarg(ch).tqarg(tqparent->filename) << endl;
g->shrunkenCharacter.resize( 15, 15 );
g->shrunkenCharacter.fill(TQColor(255, 0, 0));
g->x2 = 0;
@@ -219,9 +219,9 @@ glyph *TeXFont_PFB::getGlyph(Q_UINT16 ch, bool generateCharacterPixmap, const TQ
TQImage imgi(slot->bitmap.width, slot->bitmap.rows, 32);
imgi.setAlphaBuffer(true);
- // Do QPixmaps fully support the alpha channel? If yes, we use
+ // Do TQPixmaps fully support the alpha channel? If yes, we use
// that. Otherwise, use other routines as a fallback
- if (parent->font_pool->QPixmapSupportsAlpha) {
+ if (tqparent->font_pool->TQPixmapSupportsAlpha) {
// If the alpha channel is properly supported, we set the
// character glyph to a colored rectangle, and define the
// character outline only using the alpha channel. That
@@ -239,7 +239,7 @@ glyph *TeXFont_PFB::getGlyph(Q_UINT16 ch, bool generateCharacterPixmap, const TQ
}
} else {
// If the alpha channel is not supported... QT seems to turn
- // the alpha channel into a crude bitmap which is used to mask
+ // the alpha channel into a crude bitmap which is used to tqmask
// the resulting TQPixmap. In this case, we define the
// character outline using the image data, and use the alpha
// channel only to store "maximally opaque" or "completely
@@ -248,18 +248,18 @@ glyph *TeXFont_PFB::getGlyph(Q_UINT16 ch, bool generateCharacterPixmap, const TQ
// quality is still sufficient for most purposes. One notable
// exception is output from the gftodvi program, which will be
// partially unreadable.
- Q_UINT16 rInv = 0xFF - color.red();
- Q_UINT16 gInv = 0xFF - color.green();
- Q_UINT16 bInv = 0xFF - color.blue();
+ TQ_UINT16 rInv = 0xFF - color.red();
+ TQ_UINT16 gInv = 0xFF - color.green();
+ TQ_UINT16 bInv = 0xFF - color.blue();
- for(Q_UINT16 y=0; y<slot->bitmap.rows; y++) {
- Q_UINT8 *srcScanLine = slot->bitmap.buffer + y*slot->bitmap.pitch;
+ for(TQ_UINT16 y=0; y<slot->bitmap.rows; y++) {
+ TQ_UINT8 *srcScanLine = slot->bitmap.buffer + y*slot->bitmap.pitch;
unsigned int *destScanLine = (unsigned int *)imgi.scanLine(y);
- for(Q_UINT16 col=0; col<slot->bitmap.width; col++) {
- Q_UINT16 data = *srcScanLine;
+ for(TQ_UINT16 col=0; col<slot->bitmap.width; col++) {
+ TQ_UINT16 data = *srcScanLine;
// The value stored in "data" now has the following meaning:
// data = 0 -> white; data = 0xff -> use "color"
- *destScanLine = qRgba(0xFF - (rInv*data + 0x7F) / 0xFF,
+ *destScanLine = tqRgba(0xFF - (rInv*data + 0x7F) / 0xFF,
0xFF - (gInv*data + 0x7F) / 0xFF,
0xFF - (bInv*data + 0x7F) / 0xFF,
(data > 0x03) ? 0xff : 0x00);
@@ -279,13 +279,13 @@ glyph *TeXFont_PFB::getGlyph(Q_UINT16 ch, bool generateCharacterPixmap, const TQ
if (g->dvi_advance_in_units_of_design_size_by_2e20 == 0) {
int error = FT_Load_Glyph(face, charMap[ch], FT_LOAD_NO_SCALE);
if (error) {
- TQString msg = i18n("FreeType is unable to load metric for glyph #%1 from font file %2.").arg(ch).arg(parent->filename);
+ TQString msg = i18n("FreeType is unable to load metric for glyph #%1 from font file %2.").tqarg(ch).tqarg(tqparent->filename);
if (errorMessage.isEmpty())
errorMessage = msg;
kdError(4300) << msg << endl;
g->dvi_advance_in_units_of_design_size_by_2e20 = 1;
}
- g->dvi_advance_in_units_of_design_size_by_2e20 = (Q_INT32)(((Q_INT64)(1<<20) * (Q_INT64)face->glyph->metrics.horiAdvance) / (Q_INT64)face->units_per_EM);
+ g->dvi_advance_in_units_of_design_size_by_2e20 = (TQ_INT32)(((TQ_INT64)(1<<20) * (TQ_INT64)face->glyph->metrics.horiAdvance) / (TQ_INT64)face->units_per_EM);
}
return g;