diff options
-rw-r--r-- | src/FreeType/ftfuncs.c | 6 | ||||
-rw-r--r-- | src/Type1/scanfont.c | 34 | ||||
-rw-r--r-- | src/fc/fserve.c | 53 | ||||
-rw-r--r-- | src/fontfile/fontdir.c | 16 | ||||
-rw-r--r-- | src/fontfile/fontfile.c | 4 |
5 files changed, 58 insertions, 55 deletions
diff --git a/src/FreeType/ftfuncs.c b/src/FreeType/ftfuncs.c index d942784..918d7e2 100644 --- a/src/FreeType/ftfuncs.c +++ b/src/FreeType/ftfuncs.c @@ -26,7 +26,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -/* $XFree86: xc/lib/font/FreeType/ftfuncs.c,v 1.37 2003/11/20 22:36:35 dawes Exp $ */ +/* $XFree86: xc/lib/font/FreeType/ftfuncs.c,v 1.38 2003/11/29 01:37:36 dawes Exp $ */ #include "fontmisc.h" @@ -3043,7 +3043,7 @@ FreeTypeLoadXFont(char *fileName, int ai_lsb,ai_rsb,ai_total; if( 0 < ins_ttcap->autoItalic ) ai=ins_ttcap->autoItalic; else ai = -ins_ttcap->autoItalic; - ai_total = (int)( b_width_diagonal * ai + 0.5); + ai_total = (int)( (ascent+descent) * ai + 0.5); ai_rsb = (int)((double)ai_total * ascent / ( ascent + descent ) + 0.5 ); ai_lsb = -(ai_total - ai_rsb); if( 0 < ins_ttcap->autoItalic ) { @@ -3121,7 +3121,7 @@ FreeTypeLoadXFont(char *fileName, int ai_lsb,ai_rsb,ai_total; if( 0 < ins_ttcap->autoItalic ) ai=ins_ttcap->autoItalic; else ai = -ins_ttcap->autoItalic; - ai_total = (int)( ai * smetrics->max_advance / 64.0 + 0.5); + ai_total = (int)( (ascent+descent) * ai + 0.5); ai_rsb = (int)((double)ai_total * ascent / ( ascent + descent ) + 0.5 ); ai_lsb = -(ai_total - ai_rsb); if( 0 < ins_ttcap->autoItalic ) { diff --git a/src/Type1/scanfont.c b/src/Type1/scanfont.c index 7b2db30..aa95736 100644 --- a/src/Type1/scanfont.c +++ b/src/Type1/scanfont.c @@ -45,7 +45,7 @@ * The Original Software is CID font code that was developed by Silicon * Graphics, Inc. */ -/* $XFree86: xc/lib/font/Type1/scanfont.c,v 1.16 2003/05/27 22:26:46 tsi Exp $ */ +/* $XFree86: xc/lib/font/Type1/scanfont.c,v 1.17 2003/11/29 04:55:28 dawes Exp $ */ #ifndef FONTMODULE #include <string.h> @@ -1727,8 +1727,9 @@ scan_cidfont(cidfont *CIDFontP, cmapres *CMapP) tokenStartP[tokenLength] = '\0'; rc = FindDictValue(CMapP->CMapInfoP); - /* we are not going to report errors */ - rc = SCAN_OK; + /* we are not going to report errors except out of memory */ + if (rc != SCAN_OUT_OF_MEMORY) + rc = SCAN_OK; break; case TOKEN_NAME: if (0 == strncmp(tokenStartP,"begincodespacerange",19)) { @@ -1983,8 +1984,9 @@ scan_cidfont(cidfont *CIDFontP, cmapres *CMapP) if (CIDWantFontInfo) { rc = FindDictValue(CIDFontP->CIDfontInfoP); - /* we are not going to report errors */ - rc = SCAN_OK; + /* we are not going to report errors except out of memory */ + if (rc != SCAN_OUT_OF_MEMORY) + rc = SCAN_OK; break; } break; @@ -2109,8 +2111,10 @@ scan_cidtype1font(psfont *FontP) /* same UniqueID. We would faile on /UniqueID get */ /* because we are expecting a int to follow UniqueID*/ /* If the correct object type does not follow a Name*/ - /* then we will skip over it without reporting error*/ - rc = SCAN_OK; + /* then we will skip over it without reporting error except */ + /* out of memory */ + if (rc != SCAN_OUT_OF_MEMORY) + rc = SCAN_OK; break; } /* end of reading Private dictionary */ else @@ -2122,8 +2126,9 @@ scan_cidtype1font(psfont *FontP) else if (WantFontInfo) { rc = FindDictValue(FontP->fontInfoP); - /* we are not going to report errors */ - rc = SCAN_OK; + /* we are not going to report errors except out of memory */ + if (rc != SCAN_OUT_OF_MEMORY) + rc = SCAN_OK; break; } break; @@ -2298,8 +2303,10 @@ scan_font(psfont *FontP) /* same UniqueID. We would faile on /UniqueID get */ /* because we are expecting a int to follow UniqueID*/ /* If the correct object type does not follow a Name*/ - /* then we will skip over it without reporting error*/ - rc = SCAN_OK; + /* then we will skip over it without reporting error except */ + /* when out of memory */ + if (rc != SCAN_OUT_OF_MEMORY) + rc = SCAN_OK; break; } /* end of reading Private dictionary */ else @@ -2311,8 +2318,9 @@ scan_font(psfont *FontP) else if (WantFontInfo) { rc = FindDictValue(FontP->fontInfoP); - /* we are not going to report errors */ - rc = SCAN_OK; + /* we are not going to report errors except out of memory */ + if (rc != SCAN_OUT_OF_MEMORY) + rc = SCAN_OK; break; } break; diff --git a/src/fc/fserve.c b/src/fc/fserve.c index c9fccc4..ee2bdb3 100644 --- a/src/fc/fserve.c +++ b/src/fc/fserve.c @@ -24,7 +24,7 @@ used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ -/* $XFree86: xc/lib/font/fc/fserve.c,v 3.25 2003/11/20 18:16:34 dawes Exp $ */ +/* $XFree86: xc/lib/font/fc/fserve.c,v 3.26 2003/11/22 02:12:37 dawes Exp $ */ /* * Copyright 1990 Network Computing Devices @@ -1052,44 +1052,27 @@ fs_read_extent_info(FontPathElementPtr fpe, FSBlockDataPtr blockrec) ci->metrics.descent = FONT_MAX_DESCENT(fi); ci->metrics.characterWidth = FONT_MAX_WIDTH(fi); ci->metrics.attributes = ii->metrics.attributes; - /* Bounds check. */ - if (ci->metrics.ascent > fi->maxbounds.ascent) - { - ErrorF("fserve: warning: %s %s ascent (%d) " - "> maxascent (%d)\n", - fpe->name, fsd->name, - ci->metrics.ascent, fi->maxbounds.ascent); - ci->metrics.ascent = fi->maxbounds.ascent; - } - if (ci->metrics.descent > fi->maxbounds.descent) - { - ErrorF("fserve: warning: %s %s descent (%d) " - "> maxdescent (%d)\n", - fpe->name, fsd->name, - ci->metrics.descent, fi->maxbounds.descent); - ci->metrics.descent = fi->maxbounds.descent; - } } else { ci->metrics = ii->metrics; - /* Bounds check. */ - if (ci->metrics.ascent > fi->maxbounds.ascent) - { - ErrorF("fserve: warning: %s %s ascent (%d) " - "> maxascent (%d)\n", - fpe->name, fsd->name, - ci->metrics.ascent, fi->maxbounds.ascent); - ci->metrics.ascent = fi->maxbounds.ascent; - } - if (ci->metrics.descent > fi->maxbounds.descent) - { - ErrorF("fserve: warning: %s %s descent (%d) " - "> maxdescent (%d)\n", - fpe->name, fsd->name, - ci->metrics.descent, fi->maxbounds.descent); - ci->metrics.descent = fi->maxbounds.descent; - } + } + /* Bounds check. */ + if (ci->metrics.ascent > fi->maxbounds.ascent) + { + ErrorF("fserve: warning: %s %s ascent (%d) " + "> maxascent (%d)\n", + fpe->name, fsd->name, + ci->metrics.ascent, fi->maxbounds.ascent); + ci->metrics.ascent = fi->maxbounds.ascent; + } + if (ci->metrics.descent > fi->maxbounds.descent) + { + ErrorF("fserve: warning: %s %s descent (%d) " + "> maxdescent (%d)\n", + fpe->name, fsd->name, + ci->metrics.descent, fi->maxbounds.descent); + ci->metrics.descent = fi->maxbounds.descent; } } } diff --git a/src/fontfile/fontdir.c b/src/fontfile/fontdir.c index 28e58b6..b558c70 100644 --- a/src/fontfile/fontdir.c +++ b/src/fontfile/fontdir.c @@ -25,7 +25,7 @@ used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ -/* $XFree86: xc/lib/font/fontfile/fontdir.c,v 3.22 2003/07/07 16:40:11 eich Exp $ */ +/* $XFree86: xc/lib/font/fontfile/fontdir.c,v 3.23 2003/12/02 19:50:40 dawes Exp $ */ /* * Author: Keith Packard, MIT X Consortium @@ -629,6 +629,9 @@ FontFileAddFontFile (FontDirectoryPtr dir, char *fontName, char *fileName) FontScalableExtraPtr extra; FontEntryPtr bitmap = 0, scalable; Bool isscale; +#ifdef FONTDIRATTRIB + Bool scalable_xlfd; +#endif renderer = FontFileMatchRenderer (fileName); if (!renderer) @@ -656,8 +659,15 @@ FontFileAddFontFile (FontDirectoryPtr dir, char *fontName, char *fileName) !(vals.values_supplied & ENHANCEMENT_SPECIFY_MASK); #ifdef FONTDIRATTRIB #define UNSCALED_ATTRIB "unscaled" - /* For scalable fonts, check if the "unscaled" attribute is present */ - if (isscale && dir->attributes && dir->attributes[0] == ':') { + scalable_xlfd = (isscale && + (((vals.values_supplied & PIXELSIZE_MASK) == 0) || + ((vals.values_supplied & POINTSIZE_MASK) == 0))); + /* + * For scalable fonts without a scalable XFLD, check if the "unscaled" + * attribute is present. + */ + if (isscale && !scalable_xlfd && + dir->attributes && dir->attributes[0] == ':') { char *ptr1 = dir->attributes + 1; char *ptr2; int length; diff --git a/src/fontfile/fontfile.c b/src/fontfile/fontfile.c index 6378c39..a0323be 100644 --- a/src/fontfile/fontfile.c +++ b/src/fontfile/fontfile.c @@ -25,7 +25,7 @@ used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ -/* $XFree86: xc/lib/font/fontfile/fontfile.c,v 3.19 2003/11/08 02:02:03 dawes Exp $ */ +/* $XFree86: xc/lib/font/fontfile/fontfile.c,v 3.21 2003/12/02 19:50:40 dawes Exp $ */ /* * Author: Keith Packard, MIT X Consortium @@ -531,6 +531,8 @@ FontFileGetInfoBitmap (FontPathElementPtr fpe, FontInfoPtr pFontInfo, dir = (FontDirectoryPtr) fpe->private; bitmap = &entry->u.bitmap; + if (!bitmap || !bitmap->renderer->GetInfoBitmap) + return BadFontName; strcpy (fileName, dir->directory); strcat (fileName, bitmap->fileName); ret = (*bitmap->renderer->GetInfoBitmap) (fpe, pFontInfo, entry, fileName); |