summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorxtraeme <xtraeme>2004-04-30 01:42:11 +0000
committerxtraeme <xtraeme>2004-04-30 01:42:11 +0000
commita7bbeee1a7a388a1aba3fc54b6070b31a9888e3c (patch)
tree8597da2d0d72fe0e8b410472b4f05b0007815bac
parenta3ed1c7ebc70a4982849d8092a8a68696f381119 (diff)
downloadpkgsrc-a7bbeee1a7a388a1aba3fc54b6070b31a9888e3c.tar.gz
Apply patches from KDE CVS to fix building with freetype2 2.1.8.
-rw-r--r--x11/kdebase3/distinfo4
-rw-r--r--x11/kdebase3/patches/patch-ah355
-rw-r--r--x11/kdebase3/patches/patch-ai89
3 files changed, 447 insertions, 1 deletions
diff --git a/x11/kdebase3/distinfo b/x11/kdebase3/distinfo
index ecdeb0d59e1..fe2caec2650 100644
--- a/x11/kdebase3/distinfo
+++ b/x11/kdebase3/distinfo
@@ -1,4 +1,4 @@
-$NetBSD: distinfo,v 1.47 2004/04/26 11:54:15 markd Exp $
+$NetBSD: distinfo,v 1.48 2004/04/30 01:42:11 xtraeme Exp $
SHA1 (kdebase-3.2.2.tar.bz2) = bc941b3faa4440ca2048d9332371c974d0e17f5b
Size (kdebase-3.2.2.tar.bz2) = 17216476 bytes
@@ -13,6 +13,8 @@ SHA1 (patch-ad) = 031e5622acb376ce1867d08b35c55bce101e8855
SHA1 (patch-ae) = 5d9902de9990efc1883f11563f49ac8639fe743d
SHA1 (patch-af) = ad9b3a97151c964d4adea2d8fecd780c6198b205
SHA1 (patch-ag) = 89f50ee8b328cd654aebf1da5424e87eb6b42628
+SHA1 (patch-ah) = c273786bd5f9c2287c81d2eecb12f92f90cb783c
+SHA1 (patch-ai) = 5f72c65f879798be1bb7c6e9340854d57e31aed0
SHA1 (patch-bb) = 1b6c717a1bedafbeae0037ee382795d8aa59f081
SHA1 (patch-bc) = 2d54d0700b30f5471eb60d104148ecf5ac835f58
SHA1 (patch-bx) = d58d16fd484fc0a46c1ae93267af19e73af6f990
diff --git a/x11/kdebase3/patches/patch-ah b/x11/kdebase3/patches/patch-ah
new file mode 100644
index 00000000000..584fdbbc683
--- /dev/null
+++ b/x11/kdebase3/patches/patch-ah
@@ -0,0 +1,355 @@
+$NetBSD: patch-ah,v 1.4 2004/04/30 01:42:11 xtraeme Exp $
+
+Fixes build with Freetype-2.1.8, see:
+http://webcvs.kde.org/cgi-bin/cvsweb.cgi/kdebase/kcontrol/kfontinst/lib/FontEngine.cpp
+
+--- kcontrol/kfontinst/lib/FontEngine.cpp 2004/03/30 21:17:35 1.12.2.2
++++ kcontrol/kfontinst/lib/FontEngine.cpp 2004/04/27 20:30:25 1.12.2.3
+@@ -4,7 +4,7 @@
+ // Author : Craig Drummond
+ // Project : K Font Installer
+ // Creation Date : 29/04/2001
+-// Version : $Revision: 1.4 $ $Date: 2004/04/30 01:42:11 $
++// Version : $Revision: 1.4 $ $Date: 2004/04/30 01:42:11 $
+ //
+ ////////////////////////////////////////////////////////////////////////////////
+ //
+@@ -522,14 +522,33 @@ void CFontEngine::createPreview(int widt
+
+ FT_Face face;
+ FT_Size size;
+- FTC_Image_Desc font;
+
++#if KFI_FT_IS_GE(2, 1, 8)
++ FTC_ScalerRec scaler;
++ FTC_ImageTypeRec font;
++#else
++ FTC_Image_Desc font;
++#endif
++
++#if KFI_FT_IS_GE(2, 1, 8)
++ font.face_id=getId(itsPath, faceNo);
++ font.width=font.height=point2Pixel(sizes[s].font);
++ font.flags=FT_LOAD_DEFAULT;
++ scaler.face_id=font.face_id;
++ scaler.width=scaler.height=font.width;
++ scaler.pixel=1;
++#else
+ font.font.face_id=getId(itsPath, faceNo);
+ font.font.pix_width=font.font.pix_height=point2Pixel(sizes[s].font);
+ font.image_type=ftc_image_grays;
++#endif
+
+ FT_F26Dot6 startX=sizes[s].offset,
++#if KFI_FT_IS_GE(2, 1, 8)
++ startY=sizes[s].offset+font.height,
++#else
+ startY=sizes[s].offset+font.font.pix_height,
++#endif
+ x=startX,
+ y=startY;
+
+@@ -570,7 +589,12 @@ void CFontEngine::createPreview(int widt
+ y+=startY;
+ }
+
++#if KFI_FT_IS_GE(2, 1, 8)
++ if(!FTC_Manager_LookupFace(itsFt.cacheManager, scaler.face_id, &face) &&
++ !FTC_Manager_LookupSize(itsFt.cacheManager, &scaler, &size))
++#else
+ if(!FTC_Manager_Lookup_Size(itsFt.cacheManager, &(font.font), &face, &size))
++#endif
+ {
+ int i;
+ FT_F26Dot6 stepY=size->metrics.y_ppem /*(size->metrics.height>>6)*/ + sizes[s].offset;
+@@ -585,14 +609,24 @@ void CFontEngine::createPreview(int widt
+ unsigned int ch;
+
+ for(ch=0; ch<quote.length(); ++ch)
+- if(drawGlyph(pix, font, size, FT_Get_Char_Index(face, quote[ch].unicode()),
++ if(drawGlyph(pix, font, FT_Get_Char_Index(face, quote[ch].unicode()),
+ x, y, width, height, startX, stepY, sizes[s].space))
+ break;
+ }
+
++#if KFI_FT_IS_GE(2, 1, 8)
++ font.width=font.height=point2Pixel((int)(sizes[s].font*0.75));
++ scaler.width=scaler.height=font.width;
++#else
+ font.font.pix_width=font.font.pix_height=point2Pixel((int)(sizes[s].font*0.75));
++#endif
+
+- if(y<height && !FTC_Manager_Lookup_Size(itsFt.cacheManager, &(font.font), &face, &size))
++ if(y<height &&
++#if KFI_FT_IS_GE(2, 1, 8)
++ !FTC_Manager_LookupSize(itsFt.cacheManager, &scaler, &size))
++#else
++ !FTC_Manager_Lookup_Size(itsFt.cacheManager, &(font.font), &face, &size))
++#endif
+ {
+ FT_F26Dot6 stepY=size->metrics.y_ppem /*(size->metrics.height>>6)*/ + sizes[s].offset;
+
+@@ -603,12 +637,15 @@ void CFontEngine::createPreview(int widt
+ y+=stepY;
+ x=startX;
+ }
+-
++#if KFI_FT_IS_GE(2, 1, 8)
++ y+=font.height;
++#else
+ y+=font.font.pix_height;
++#endif
+ }
+
+ for(i=1; i<face->num_glyphs; ++i) // Glyph 0 is the NULL glyph
+- if(drawGlyph(pix, font, size, i, x, y, width, height, startX, stepY))
++ if(drawGlyph(pix, font, i, x, y, width, height, startX, stepY))
+ break;
+ }
+ }
+@@ -621,14 +658,14 @@ void CFontEngine::createPreview(int widt
+ unsigned int ch;
+
+ for(ch=0; ch<str.length(); ++ch)
+- if(drawGlyph(pix, font, size, FT_Get_Char_Index(face, str[ch].unicode()),
++ if(drawGlyph(pix, font, FT_Get_Char_Index(face, str[ch].unicode()),
+ x, y, width, height, startX, stepY))
+ break;
+
+ }
+ else
+ for(i=1; i<face->num_glyphs; ++i) // Glyph 0 is the NULL glyph
+- if(drawGlyph(pix, font, size, i, x, y, width, height, startX, stepY))
++ if(drawGlyph(pix, font, i, x, y, width, height, startX, stepY))
+ break;
+ }
+
+@@ -2858,8 +2895,13 @@ FTC_FaceID CFontEngine::getId(const QStr
+ return (FTC_FaceID)p;
+ }
+
++#if KFI_FT_IS_GE(2, 1, 8)
++bool CFontEngine::getGlyphBitmap(FTC_ImageTypeRec &font, FT_ULong index, Bitmap &target, int &left, int &top,
++ int &xAdvance, FT_Pointer *ptr)
++#else
+ bool CFontEngine::getGlyphBitmap(FTC_Image_Desc &font, FT_ULong index, Bitmap &target, int &left, int &top,
+ int &xAdvance, FT_Pointer *ptr)
++#endif
+ {
+ bool ok=false;
+
+@@ -2867,13 +2909,23 @@ bool CFontEngine::getGlyphBitmap(FTC_Ima
+
+ //
+ // Cache small glyphs, else render on demand...
++#if KFI_FT_IS_GE(2, 1, 8)
++ if(font.width<48 && font.height<48)
++#else
+ if(font.font.pix_width<48 && font.font.pix_height<48)
++#endif
+ {
+ FTC_SBit sbit;
+
+- if(!FTC_SBit_Cache_Lookup(itsFt.sBitCache, &font, index, &sbit))
++#if KFI_FT_IS_GE(2, 1, 8)
++ if(!FTC_SBitCache_Lookup(itsFt.sBitCache, &font, index, &sbit, NULL) && sbit->buffer)
++#else
++ if(!FTC_SBit_Cache_Lookup(itsFt.sBitCache, &font, index, &sbit) && sbit->buffer)
++#endif
+ {
+- target.greys=ft_pixel_mode_mono==sbit->format ? 2 : 256;
++ target.greys=sbit->max_grays+1; // ft_pixel_mode_mono==sbit->format ? 2 : 256;
++ target.mono=ft_pixel_mode_mono==sbit->format ? true : false;
++ target.pitch=sbit->pitch;
+ target.height=sbit->height;
+ target.width=sbit->width;
+ target.buffer=sbit->buffer;
+@@ -2883,11 +2935,15 @@ bool CFontEngine::getGlyphBitmap(FTC_Ima
+ ok=true;
+ }
+ }
+- else
++ if(!ok)
+ {
+ FT_Glyph glyph;
+
++#if KFI_FT_IS_GE(2, 1, 8)
++ if(!FTC_ImageCache_Lookup(itsFt.imageCache, &font, index, &glyph, NULL))
++#else
+ if(!FTC_Image_Cache_Lookup(itsFt.imageCache, &font, index, &glyph))
++#endif
+ {
+ ok=true;
+
+@@ -2896,12 +2952,14 @@ bool CFontEngine::getGlyphBitmap(FTC_Ima
+ *ptr=glyph;
+
+ if(ok)
+- if(ft_glyph_format_bitmap==glyph->format)
++ if(ft_glyph_format_bitmap==glyph->format && ((FT_BitmapGlyph)glyph)->bitmap.buffer)
+ {
+ FT_BitmapGlyph bitmap=(FT_BitmapGlyph)glyph;
+ FT_Bitmap *source=&(bitmap->bitmap);
+
+- target.greys= (ft_pixel_mode_mono==(FT_Pixel_Mode_) source->pixel_mode) ? 1 : source->num_grays;
++ target.greys=ft_pixel_mode_mono==(FT_Pixel_Mode_) source->pixel_mode ? 2 : source->num_grays;
++ target.mono=ft_pixel_mode_mono==(FT_Pixel_Mode_) source->pixel_mode ? true : false;
++ target.pitch=source->pitch;
+ target.height=source->rows;
+ target.width=source->width;
+ target.buffer=source->buffer;
+@@ -2919,14 +2977,12 @@ bool CFontEngine::getGlyphBitmap(FTC_Ima
+
+ void CFontEngine::align32(Bitmap &bmp)
+ {
+- int mod=bmp.width%4;
++ // Pitch = number of bytes per row of the bitmap. This needs to fall on a 32bit (4byte) boundary.
++ int padBytes=4-(bmp.pitch%4);
+
+- if(mod)
++ if(padBytes<4)
+ {
+- bmp.mod=4-mod;
+-
+- int width=bmp.width+bmp.mod,
+- size=(bmp.width+bmp.mod)*bmp.height,
++ int size=(bmp.pitch+padBytes)*bmp.height,
+ row;
+
+ if(size>itsFt.bufferSize)
+@@ -2939,20 +2995,23 @@ void CFontEngine::align32(Bitmap &bmp)
+ itsFt.buffer=new unsigned char [itsFt.bufferSize];
+ }
+
+- memset(itsFt.buffer, 0, itsFt.bufferSize);
++ //memset(itsFt.buffer, 0, itsFt.bufferSize);
+ for(row=0; row<bmp.height; ++row)
+- memcpy(&(itsFt.buffer[row*width]), &bmp.buffer[row*bmp.width], bmp.width);
++ memcpy(&(itsFt.buffer[row*(bmp.pitch+padBytes)]), &bmp.buffer[row*bmp.pitch], bmp.pitch);
+
+ bmp.buffer=itsFt.buffer;
+- bmp.width+=bmp.mod;
+ }
+- else
+- bmp.mod=0;
+ }
+
+-bool CFontEngine::drawGlyph(QPixmap &pix, FTC_Image_Desc &font, FT_Size &size, int glyphNum,
++#if KFI_FT_IS_GE(2, 1, 8)
++bool CFontEngine::drawGlyph(QPixmap &pix, FTC_ImageTypeRec &font, int glyphNum,
++ FT_F26Dot6 &x, FT_F26Dot6 &y, FT_F26Dot6 width, FT_F26Dot6 height,
++ FT_F26Dot6 startX, FT_F26Dot6 stepY, int space)
++#else
++bool CFontEngine::drawGlyph(QPixmap &pix, FTC_Image_Desc &font, int glyphNum,
+ FT_F26Dot6 &x, FT_F26Dot6 &y, FT_F26Dot6 width, FT_F26Dot6 height,
+ FT_F26Dot6 startX, FT_F26Dot6 stepY, int space)
++#endif
+ {
+ int left,
+ top,
+@@ -2962,45 +3021,38 @@ bool CFontEngine::drawGlyph(QPixmap &pix
+
+ if(getGlyphBitmap(font, glyphNum, bmp, left, top, xAdvance, &glyph) && bmp.width>0 && bmp.height>0)
+ {
+- if(2==bmp.greys)
++ if(x+xAdvance+1>width)
+ {
+- QPixmap glyphPix(QBitmap(bmp.width, bmp.height, bmp.buffer));
++ x=startX;
++ y+=stepY;
+
+- bitBlt(&pix, x+left, y-top, &glyphPix, 0, 0, bmp.width, bmp.height, Qt::AndROP);
++ if(y>height)
++ return true;
+ }
+- else
+- {
+- static QRgb clut[256];
+- static bool clutSetup=false;
+
+- if(!clutSetup)
+- {
+- int j;
+- for(j=0; j<256; j++)
+- clut[j]=qRgb(255-j, 255-j, 255-j);
+- clutSetup=true;
+- }
++ static QRgb clut8[256];
++ static QRgb clut1[2]={ qRgb(255, 255, 255), qRgb(0, 0, 0) };
++ static bool clut8Setup=false;
+
+- align32(bmp);
++ if(!bmp.mono && !clut8Setup)
++ {
++ int j;
++ for(j=0; j<256; j++)
++ clut8[j]=qRgb(255-j, 255-j, 255-j);
++ clut8Setup=true;
++ }
+
+- QPixmap glyphPix(QImage(bmp.buffer, bmp.width, bmp.height, 8, clut , bmp.greys, QImage::IgnoreEndian));
++ align32(bmp);
+
+- bitBlt(&pix, x+left, y-top, &glyphPix, 0, 0, bmp.width, bmp.height, Qt::AndROP);
+- }
++ QPixmap glyphPix(QImage(bmp.buffer, bmp.width, bmp.height, bmp.mono ? 1 : 8, bmp.mono ? clut1 : clut8, bmp.mono ? 2 : bmp.greys,
++ QImage::BigEndian));
++
++ bitBlt(&pix, x+left, y-top, &glyphPix, 0, 0, glyphPix.width(), glyphPix.height(), Qt::AndROP);
+
+ if(glyph)
+ FT_Done_Glyph((FT_Glyph)glyph);
+
+ x+=xAdvance+1;
+-
+- if(x+size->metrics.x_ppem>width)
+- {
+- x=startX;
+- y+=stepY;
+-
+- if(y>height)
+- return true;
+- }
+ }
+ else if(x!=startX)
+ x+=space;
+@@ -3015,7 +3067,6 @@ CFontEngine::TFtData::TFtData()
+ , buffer(NULL),
+ bufferSize(0)
+ #endif
+-
+ {
+ if(FT_Init_FreeType(&library))
+ {
+@@ -3024,9 +3075,29 @@ CFontEngine::TFtData::TFtData()
+ }
+ #ifdef HAVE_FT_CACHE
+ ids.setAutoDelete(true);
+- FTC_Manager_New(library, 0, 0, 0, face_requester, 0, &cacheManager);
+- FTC_SBit_Cache_New(cacheManager, &sBitCache);
+- FTC_Image_Cache_New(cacheManager, &imageCache);
++ if(FTC_Manager_New(library, 0, 0, 0, face_requester, 0, &cacheManager))
++ {
++ std::cerr << "ERROR: Could not initliaze FreeType2 cache manager\n";
++ exit(0);
++ }
++#if KFI_FT_IS_GE(2, 1, 8)
++ if(FTC_SBitCache_New(cacheManager, &sBitCache))
++#else
++ if(FTC_SBit_Cache_New(cacheManager, &sBitCache))
++#endif
++ {
++ std::cerr << "ERROR: Could not initliaze FreeType2 small bitmaps cache\n";
++ exit(0);
++ }
++#if KFI_FT_IS_GE(2, 1, 8)
++ if(FTC_ImageCache_New(cacheManager, &imageCache))
++#else
++ if(FTC_Image_Cache_New(cacheManager, &imageCache))
++#endif
++ {
++ std::cerr << "ERROR: Could not initliaze FreeType2 glyph image cache\n";
++ exit(0);
++ }
+ #endif
+ }
diff --git a/x11/kdebase3/patches/patch-ai b/x11/kdebase3/patches/patch-ai
new file mode 100644
index 00000000000..1ec57a29b03
--- /dev/null
+++ b/x11/kdebase3/patches/patch-ai
@@ -0,0 +1,89 @@
+$NetBSD: patch-ai,v 1.10 2004/04/30 01:42:11 xtraeme Exp $
+
+Fixes build with Freetype-2.1.8, see:
+http://webcvs.kde.org/cgi-bin/cvsweb.cgi/kdebase/kcontrol/kfontinst/lib/FontEngine.h
+
+--- kcontrol/kfontinst/lib/FontEngine.h 2003/11/29 01:41:14 1.5
++++ kcontrol/kfontinst/lib/FontEngine.h 2004/04/27 20:30:25 1.5.2.1
+@@ -7,7 +7,7 @@
+ // Author : Craig Drummond
+ // Project : K Font Installer
+ // Creation Date : 29/04/2001
+-// Version : $Revision: 1.10 $ $Date: 2004/04/30 01:42:11 $
++// Version : $Revision: 1.10 $ $Date: 2004/04/30 01:42:11 $
+ //
+ ////////////////////////////////////////////////////////////////////////////////
+ //
+@@ -34,6 +34,7 @@
+ #endif
+
+ #include "Encodings.h"
++#include <kdeversion.h>
+ #include <ft2build.h>
+ #include FT_FREETYPE_H
+ #include <qstring.h>
+@@ -50,6 +51,10 @@
+ #include <qpaintdevice.h>
+ #endif
+
++// OK - some macros to make determining the FreeType version easier...
++#define KFI_FREETYPE_VERSION KDE_MAKE_VERSION(FREETYPE_MAJOR, FREETYPE_MINOR, FREETYPE_PATCH)
++#define KFI_FT_IS_GE(a,b,c) (KFI_FREETYPE_VERSION >= KDE_MAKE_VERSION(a,b,c))
++
+ class CFontEngine
+ {
+ public:
+@@ -178,8 +183,15 @@ class CFontEngine
+ bool open;
+ #ifdef HAVE_FT_CACHE
+ FTC_Manager cacheManager;
++
++#if KFI_FT_IS_GE(2, 1, 8)
++ FTC_ImageCache imageCache;
++ FTC_SBitCache sBitCache;
++#else
+ FTC_Image_Cache imageCache;
+ FTC_SBit_Cache sBitCache;
++#endif
++
+ QPtrList<TId> ids;
+ unsigned char *buffer;
+ int bufferSize;
+@@ -191,7 +203,8 @@ class CFontEngine
+ int width,
+ height,
+ greys,
+- mod;
++ pitch;
++ bool mono;
+ unsigned char *buffer;
+ };
+
+@@ -348,11 +361,25 @@ class CFontEngine
+ private:
+
+ FTC_FaceID getId(const QString &f, int faceNo);
++
++#if KFI_FT_IS_GE(2, 1, 8)
++ bool getGlyphBitmap(FTC_ImageTypeRec &font, FT_ULong index, Bitmap &target, int &left, int &top,
++ int &xAdvance, FT_Pointer *ptr);
++#else
+ bool getGlyphBitmap(FTC_Image_Desc &font, FT_ULong index, Bitmap &target, int &left, int &top,
+ int &xAdvance, FT_Pointer *ptr);
++#endif
++
+ void align32(Bitmap &bmp);
+- bool drawGlyph(QPixmap &pix, FTC_Image_Desc &font, FT_Size &size, int glyphNum, FT_F26Dot6 &x, FT_F26Dot6 &y,
++
++#if KFI_FT_IS_GE(2, 1, 8)
++ bool drawGlyph(QPixmap &pix, FTC_ImageTypeRec &font, int glyphNum, FT_F26Dot6 &x, FT_F26Dot6 &y,
+ FT_F26Dot6 width, FT_F26Dot6 height, FT_F26Dot6 startX, FT_F26Dot6 stepY, int space=0);
++#else
++ bool drawGlyph(QPixmap &pix, FTC_Image_Desc &font, int glyphNum, FT_F26Dot6 &x, FT_F26Dot6 &y,
++ FT_F26Dot6 width, FT_F26Dot6 height, FT_F26Dot6 startX, FT_F26Dot6 stepY, int space=0);
++#endif
++
+ #endif
+
+ private:
+