Login
[x]
Log in using an account from:
Fedora Account System
Red Hat Associate
Red Hat Customer
Or login using a Red Hat Bugzilla account
Forgot Password
Login:
Hide Forgot
Create an Account
Red Hat Bugzilla – Attachment 151808 Details for
Bug 234765
Abiword fails on the Live CD
[?]
New
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
|
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh83 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
This site requires JavaScript to be enabled to function correctly, please enable it.
[patch]
handle one font having multiple families
abiword-2.4.6-fix-font-crash.patch (text/plain), 4.20 KB, created by
Ray Strode [halfline]
on 2007-04-05 20:01:27 UTC
(
hide
)
Description:
handle one font having multiple families
Filename:
MIME Type:
Creator:
Ray Strode [halfline]
Created:
2007-04-05 20:01:27 UTC
Size:
4.20 KB
patch
obsolete
>--- abiword-2.4.6/abi/src/af/xap/unix/xap_UnixFontManager.cpp.fix-font-crash 2007-04-05 13:43:15.000000000 -0400 >+++ abiword-2.4.6/abi/src/af/xap/unix/xap_UnixFontManager.cpp 2007-04-05 15:53:20.000000000 -0400 >@@ -87,13 +87,16 @@ > return pVec; > } > >-static XAP_UnixFont* buildFont(XAP_UnixFontManager* pFM, FcPattern* fp) >+static UT_GenericVector<XAP_UnixFont*>* buildFonts(XAP_UnixFontManager* pFM, FcPattern* fp) > { > unsigned char* fontFile = NULL; > bool bold = false; > int slant = FC_SLANT_ROMAN; > int weight; > UT_UTF8String metricFile; >+ UT_GenericVector<XAP_UnixFont*>* fonts; >+ >+ fonts = new UT_GenericVector<XAP_UnixFont*>; > > // is it right to assume that filenames are ASCII?? > // I though that if the result is FcResultMatch, then we can assert that fontFile is != NULL, >@@ -102,7 +105,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 fonts; > } > > if (FcPatternGetInteger(fp, FC_WEIGHT, 0, &weight) != FcResultMatch) >@@ -117,7 +120,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 fonts; > > // handle '.font' > if (fontFile[ffs - 5] == '.') >@@ -137,9 +140,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 +158,33 @@ > 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 >+ delete font; >+ font = NULL; >+ } >+ else >+ { >+ fonts->addItem(font); >+ } >+ id++; >+ } > > free(xlfd); >- return font; >+ return fonts; > } > > /* add to the cache all the scalable fonts that we find */ >@@ -180,7 +194,7 @@ > return true; > > FcFontSet* fs; >- XAP_UnixFont* pFont; >+ UT_GenericVector<XAP_UnixFont*>* pFonts; > > fs = FcConfigGetFonts(FcConfigGetCurrent(), FcSetSystem); > >@@ -190,16 +204,17 @@ > > 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) >- { >+ pFonts = buildFonts(this, fs->fonts[j]); >+ if (pFonts->size() > 0) > FcFontSetAdd(m_pFontSet, fs->fonts[j]); >+ for (UT_uint32 i = 0; i < pFonts->size(); i++) >+ { >+ XAP_UnixFont *pFont = pFonts->getNthItem(i); > _addFont(pFont,NULL); >- } >+ } >+ DELETEP(pFonts); > } > > }
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 234765
:
151392
| 151808