rpms/abiword/devel abiword-2.4.6-fontmanager.patch, NONE, 1.1 abiword.spec, 1.43, 1.44

Marc Maurer (uwog) fedora-extras-commits at redhat.com
Fri Apr 6 16:10:37 UTC 2007


Author: uwog

Update of /cvs/extras/rpms/abiword/devel
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv9099

Modified Files:
	abiword.spec 
Added Files:
	abiword-2.4.6-fontmanager.patch 
Log Message:
Forgot to cvs add this file



abiword-2.4.6-fontmanager.patch:

--- NEW FILE abiword-2.4.6-fontmanager.patch ---
diff -r -u abiword-2.4.6.orig/abi/src/af/xap/unix/xap_UnixFontManager.cpp abiword-2.4.6/abi/src/af/xap/unix/xap_UnixFontManager.cpp
--- abiword-2.4.6.orig/abi/src/af/xap/unix/xap_UnixFontManager.cpp	2006-05-12 15:08:58.000000000 +0200
+++ abiword-2.4.6/abi/src/af/xap/unix/xap_UnixFontManager.cpp	2007-04-06 17:36:20.000000000 +0200
@@ -87,7 +87,7 @@
 	return pVec;
 }
 
-static XAP_UnixFont* buildFont(XAP_UnixFontManager* pFM, FcPattern* fp)
+static void buildFonts(XAP_UnixFontManager* pFM, FcPattern* fp, UT_GenericVector<XAP_UnixFont*>& vFonts)
 {
 	unsigned char* fontFile = NULL;
 	bool bold = false;
@@ -102,7 +102,7 @@
 	{
 		// ok, and now what?  If we can not get the font file of the font, we can not print it!
 		UT_DEBUGMSG(("Unknown font file!!\n"));
-		return false;
+		return;
 	}
 	
 	if (FcPatternGetInteger(fp, FC_WEIGHT, 0, &weight) != FcResultMatch)
@@ -117,7 +117,7 @@
 	size_t ffs = metricFile.size();
 	if ( !((ffs >= 4 && fontFile[ffs - 4] == '.') ||
 		   (ffs >= 5 && fontFile[ffs - 5] == '.') ))	// Separate check to avoid [-1]
-		return NULL;
+		return;
 
 	// handle '.font'
 	if (fontFile[ffs - 5] == '.')
@@ -137,9 +137,6 @@
 	char* xlfd = reinterpret_cast<char*>(FcNameUnparse(fp));
 //	UT_String sXLFD = xlfd;
 //	UT_ASSERT(sXLFD.size() < 100);
-	// get the family of the font
-	unsigned char *family;
-	FcPatternGetString(fp, FC_FAMILY, 0, &family);
 
 	XAP_UnixFont::style s = XAP_UnixFont::STYLE_NORMAL;
 
@@ -158,19 +155,31 @@
 		break;
 	}
 			
-	XAP_UnixFont* font = new XAP_UnixFont(pFM);
-	/* we try to open the font.  If we fail, we try to open it removing the bold/italic info, if we fail again, we don't try again */
-	if (!font->openFileAs(reinterpret_cast<char*>(fontFile), metricFile.utf8_str(), reinterpret_cast<char*>(family), xlfd, s) &&
-		!font->openFileAs(reinterpret_cast<char*>(fontFile), metricFile.utf8_str(), reinterpret_cast<char*>(family), xlfd, XAP_UnixFont::STYLE_NORMAL))
-	{
-		UT_DEBUGMSG(("Impossible to open font file [%s] [%d]\n.", reinterpret_cast<char*>(fontFile), s));
-		font->setFontManager(NULL); // This font isn't in the FontManager cache (yet), so it doesn't need to unregister itself
-		delete font;
-		font = NULL;
-	}
+	unsigned char *family;
+	int id;
+
+        id = 0;
+	// get the families of the font
+        while (FcPatternGetString(fp, FC_FAMILY, id, &family) == FcResultMatch)
+        {
+	    
+		XAP_UnixFont* font = new XAP_UnixFont(pFM);
+		/* we try to open the font.  If we fail, we try to open it removing the bold/italic info, if we fail again, we don't try again */
+		if (!font->openFileAs(reinterpret_cast<char*>(fontFile), metricFile.utf8_str(), reinterpret_cast<char*>(family), xlfd, s) &&
+			!font->openFileAs(reinterpret_cast<char*>(fontFile), metricFile.utf8_str(), reinterpret_cast<char*>(family), xlfd, XAP_UnixFont::STYLE_NORMAL))
+		{
+			UT_DEBUGMSG(("Impossible to open font file [%s] [%d]\n.", reinterpret_cast<char*>(fontFile), s));
+			font->setFontManager(NULL); // This font isn't in the FontManager cache (yet), so it doesn't need to unregister itself
+			DELETEP(font);
+		}
+                else
+		{
+			vFonts.addItem(font);
+		}
+        	id++;
+        }
 		
 	free(xlfd);
-	return font;
 }
 
 /* add to the cache all the scalable fonts that we find */
@@ -180,29 +189,24 @@
 		return true;
 	
 	FcFontSet* fs;
-	XAP_UnixFont* pFont;
-	
 	fs = FcConfigGetFonts(FcConfigGetCurrent(), FcSetSystem);
-
-    if (fs)
-    {
+	if (fs)
+	{
 		m_pFontSet = FcFontSetCreate();
-		
 		for (UT_sint32 j = 0; j < fs->nfont; j++)
 		{
-			// we want to create two fonts: one layout, and one device.
-
 			/* if the font file ends on .ttf, .pfa or .pfb we add it */
-			pFont = buildFont(this, fs->fonts[j]);
-
-			if (pFont)
-			{
+			UT_GenericVector<XAP_UnixFont*> vFonts;
+			buildFonts(this, fs->fonts[j], vFonts);
+			if (vFonts.size() > 0)
 				FcFontSetAdd(m_pFontSet, fs->fonts[j]);
-				_addFont(pFont,NULL);
-			}
+		        for (UT_uint32 i = 0; i < vFonts.size(); i++)
+        		{
+				XAP_UnixFont *pFont = vFonts.getNthItem(i);
+				_addFont(pFont, NULL);
+        		}
 		}
-
-    }
+	}
 
 	return true;
 }


Index: abiword.spec
===================================================================
RCS file: /cvs/extras/rpms/abiword/devel/abiword.spec,v
retrieving revision 1.43
retrieving revision 1.44
diff -u -r1.43 -r1.44
--- abiword.spec	6 Apr 2007 16:06:12 -0000	1.43
+++ abiword.spec	6 Apr 2007 16:10:03 -0000	1.44
@@ -3,7 +3,7 @@
 Summary: The AbiWord word processor
 Name: abiword
 Version: 2.4.6
-Release: 4%{?dist}
+Release: 5%{?dist}
 Epoch: 1
 Group: Applications/Editors
 License: GPL
@@ -132,6 +132,9 @@
 %{_datadir}/icons/*png
 
 %changelog
+* Fri Apr 06 2007 Marc Maurer <uwog at abisource.com> - 1:2.4.6-5.fc7
+- Rebuild
+
 * Fri Apr 06 2007 Marc Maurer <uwog at abisource.com> - 1:2.4.6-4.fc7
 - Fix 234765
 




More information about the scm-commits mailing list