merge most of XFree86 RC3 (4.3.99.903) from vendor branch. bug #214

This commit is contained in:
Kaleb Keithley
2004-02-23 21:34:47 +00:00
parent ed2a4fae8e
commit 9fb4035032
8 changed files with 123 additions and 38 deletions

View File

@@ -26,8 +26,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
/* $XdotOrg: xc/lib/font/FreeType/ftfuncs.c,v 1.1.4.2 2003/12/06 13:24:22 kaleb Exp $ */
/* $XFree86: xc/lib/font/FreeType/ftfuncs.c,v 1.39 2003/12/17 18:14:40 dawes Exp $ */
/* $XFree86: xc/lib/font/FreeType/ftfuncs.c,v 1.43 2004/02/07 04:37:18 dawes Exp $ */
#include "fontmisc.h"
@@ -90,6 +89,8 @@ THE SOFTWARE.
/* Does the X accept noSuchChar? */
#define X_ACCEPTS_NO_SUCH_CHAR
/* Does the XAA accept NULL noSuchChar.bits?(dangerous) */
/* #define XAA_ACCEPTS_NULL_BITS */
#ifdef X_ACCEPTS_NO_SUCH_CHAR
static CharInfoRec noSuchChar = { /* metrics */{0,0,0,0,0,0},
@@ -612,6 +613,13 @@ FreeTypeInstanceGetGlyph(unsigned idx, int flags, CharInfoPtr *g, FTInstancePtr
xrc = FreeTypeRasteriseGlyph(idx, flags,
&(*glyphs)[segment][offset], instance,
(*available)[segment][offset] >= FT_AVAILABLE_METRICS);
if(xrc != Successful && (*available)[segment][offset] >= FT_AVAILABLE_METRICS) {
ErrorF("Warning: FreeTypeRasteriseGlyph() returns an error,\n");
ErrorF("\tso the backend tries to set a white space.\n");
xrc = FreeTypeRasteriseGlyph(idx, flags | FT_GET_DUMMY,
&(*glyphs)[segment][offset], instance,
(*available)[segment][offset] >= FT_AVAILABLE_METRICS);
}
if(xrc == Successful) {
(*available)[segment][offset] = FT_AVAILABLE_RASTERISED;
/* return the glyph */
@@ -1277,6 +1285,8 @@ FreeTypeFreeFont(FTFontPtr font)
FreeTypeFreeInstance(font->instance);
if(font->ranges)
xfree(font->ranges);
if(font->dummy_char.bits)
xfree(font->dummy_char.bits);
xfree(font);
}
@@ -1494,9 +1504,17 @@ FreeTypeAddProperties(FTFontPtr font, FontScalablePtr vals, FontInfoPtr info,
i++;
}
j = FTGetEnglishName(face->face, TT_NAME_ID_PS_NAME,
vp = (char *)FT_Get_Postscript_Name(face->face);
if (vp) {
j = strlen(vp);
} else {
j = -1;
}
if (j < 0) {
j = FTGetEnglishName(face->face, TT_NAME_ID_PS_NAME,
val, MAXFONTNAMELEN);
vp = val;
vp = val;
}
if (j < 0) {
if(t1info && t1info->full_name) {
vp = t1info->full_name;
@@ -2948,7 +2966,6 @@ FreeTypeLoadXFont(char *fileName,
if(!face->bitmap) {
int new_width;
double ratio,force_c_ratio;
double b_width_diagonal;
double width_x=0,width_y=0;
double force_c_width_x, force_c_rsb_x, force_c_lsb_x;
double tmp_rsb,tmp_lsb,tmp_asc,tmp_des;
@@ -2961,16 +2978,13 @@ FreeTypeLoadXFont(char *fileName,
tmp_rsb = face->face->bbox.xMax;
if ( tmp_rsb < face->face->max_advance_width ) tmp_rsb = face->face->max_advance_width;
/* apply scaleBBoxWidth */
/* we should not ...???
/* we should not ...??? */
tmp_lsb *= ins_ttcap->scaleBBoxWidth;
tmp_rsb *= ins_ttcap->scaleBBoxWidth;
*/
/* transform and rescale */
compute_new_extents( vals, scale, tmp_lsb, tmp_rsb, tmp_des, tmp_asc,
&minLsb, &maxRsb, &descent, &ascent );
/* */
b_width_diagonal = (tmp_rsb - tmp_lsb) /* face->face->max_advance_width */
* vals->pixel_matrix[0] * scale;
/* Consider vertical layouts */
if( 0 < face->face->max_advance_height )
max_advance_height = face->face->max_advance_height;
@@ -3455,7 +3469,33 @@ FreeTypeGetGlyphs(FontPtr pFont, unsigned long count, unsigned char *chars,
*gp++ = g;
}
#ifdef X_ACCEPTS_NO_SUCH_CHAR
else *gp++ = &noSuchChar;
else {
#ifdef XAA_ACCEPTS_NULL_BITS
*gp++ = &noSuchChar;
#else
if ( tf->dummy_char.bits ) {
*gp++ = &tf->dummy_char;
}
else {
char *raster = NULL;
int wd_actual, ht_actual, wd, ht, bpr;
wd_actual = tf->info->maxbounds.rightSideBearing - tf->info->maxbounds.leftSideBearing;
ht_actual = tf->info->maxbounds.ascent + tf->info->maxbounds.descent;
if(wd_actual <= 0) wd = 1;
else wd=wd_actual;
if(ht_actual <= 0) ht = 1;
else ht=ht_actual;
bpr = (((wd + (tf->instance->bmfmt.glyph<<3) - 1) >> 3) &
-tf->instance->bmfmt.glyph);
raster = (char*)xalloc(ht * bpr);
if(raster) {
memset(raster, 0, ht * bpr);
tf->dummy_char.bits = raster;
*gp++ = &tf->dummy_char;
}
}
#endif
}
#endif
}

View File

@@ -20,7 +20,7 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
/* $XFree86: xc/lib/font/FreeType/ftfuncs.h,v 1.16 2003/11/02 04:30:56 dawes Exp $ */
/* $XFree86: xc/lib/font/FreeType/ftfuncs.h,v 1.17 2003/12/21 04:02:07 dawes Exp $ */
/* Number of buckets in the hashtable holding faces */
#define NUMFACEBUCKETS 32
@@ -147,6 +147,7 @@ typedef struct _FTFont{
unsigned zero_idx;
FontInfoPtr info;
int nranges;
CharInfoRec dummy_char;
fsRange *ranges;
} FTFontRec, *FTFontPtr;

View File

@@ -71,7 +71,7 @@
* The Original Software is CID font code that was developed by Silicon
* Graphics, Inc.
*/
/* $XFree86: xc/lib/font/Type1/t1funcs.c,v 3.33 2003/07/19 13:16:40 tsi Exp $ */
/* $XFree86: xc/lib/font/Type1/t1funcs.c,v 3.34 2004/02/02 03:55:27 dawes Exp $ */
/*
@@ -123,10 +123,14 @@ from The Open Group.
#else
#include "Xmd.h"
#include "Xdefs.h"
#include "xf86_ansic.h"
#endif
#include "os.h"
#ifdef FONTMODULE
#include "xf86_ansic.h"
#endif
#include "fntfilst.h"
#include "fontutil.h"
#include "FSproto.h"

View File

@@ -26,7 +26,7 @@
* ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
* THIS SOFTWARE.
*/
/* $XFree86: xc/lib/font/Type1/t1malloc.c,v 1.11 2002/02/18 20:51:57 herrb Exp $ */
/* $XFree86: xc/lib/font/Type1/t1malloc.c,v 1.12 2004/01/23 03:55:25 dawes Exp $ */
/* MALLOC CWEB V0004 LOTS */
/*
:h1.MALLOC - Fast Memory Allocation
@@ -258,13 +258,13 @@ If we have too many uncombined blocks, call combine() to combine one.
if (++uncombined > MAXUNCOMBINED) {
combine();
if (mallocdebug) {
printf("xiFree(%p) with combine, ", addr);
printf("xiFree(%p) with combine, ", (void *)addr);
dumpchain();
}
}
else {
if (mallocdebug) {
printf("xiFree(%p), ", addr);
printf("xiFree(%p), ", (void *)addr);
dumpchain();
}
}
@@ -470,7 +470,8 @@ only to be "unhook"ed:
unhook(p);
uncombined--;
if (mallocdebug) {
printf("fast xiMalloc(%ld) = %p, ", size, p);
printf("fast xiMalloc(%ld) = %p, ", size,
(void *)p);
dumpchain();
}
AvailableWords += size; /* decreases AvailableWords */
@@ -527,7 +528,7 @@ flag that this block is allocated:
area[size - 1] = area[0] = - size;
if (mallocdebug) {
printf("slow xiMalloc(%ld) @ %p, ", size, area);
printf("slow xiMalloc(%ld) @ %p, ", size, (void *)area);
dumpchain();
}
whocalledme(area, &Size);
@@ -646,7 +647,7 @@ dumpchain(void)
if (--i < 0)
Abort("too many uncombined areas");
size = p->size;
printf(". . . area @ %p, size = %ld\n", p, -size);
printf(". . . area @ %p, size = %ld\n", (void *)p, -size);
if (size >= 0 || size != ((int *) p)[-1 - size])
Abort("dumpchain: bad size");
if (p->back != back)
@@ -656,7 +657,7 @@ dumpchain(void)
printf("DUMPING COMBINED FREE LIST:\n");
for (; p != &lastfree; p = p->fore) {
size = p->size;
printf(". . . area @ %p, size = %ld\n", p, size);
printf(". . . area @ %p, size = %ld\n", (void *)p, size);
if (size <= 0 || size != ((int *) p)[size - 1])
Abort("dumpchain: bad size");
if (p->back != back)

View File

@@ -1,4 +1,4 @@
/* $XdotOrg: fserve.c,v 1.4 2001/02/09 02:04:02 xorgcvs Exp $ */
/* $XdotOrg: xc/lib/font/fc/fserve.c,v 1.1.4.3 2003/12/06 13:24:22 kaleb Exp $ */
/* $Xorg: fserve.c,v 1.4 2001/02/09 02:04:02 xorgcvs Exp $ */
/*
@@ -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/fc/fserve.c,v 3.26 2003/11/22 02:12:37 dawes Exp $ */
/* $XFree86: xc/lib/font/fc/fserve.c,v 3.27 2004/01/12 17:19:30 tsi Exp $ */
/*
* Copyright 1990 Network Computing Devices
@@ -2215,7 +2215,7 @@ _fs_load_glyphs(pointer client, FontPtr pfont, Bool range_flag,
xfree(ranges);
/* Now try to reopen the font. */
return fs_send_open_font(client, (FontPathElementPtr)0,
return fs_send_open_font(client, pfont->fpe,
(Mask)FontReopen, (char *)0, 0,
(fsBitmapFormat)0, (fsBitmapFormatMask)0,
(XID)0, &pfont);

View File

@@ -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/dirfile.c,v 3.16 2003/04/07 16:23:31 eich Exp $ */
/* $XFree86: xc/lib/font/fontfile/dirfile.c,v 3.18 2004/02/11 21:11:18 dawes Exp $ */
/*
* Author: Keith Packard, MIT X Consortium
@@ -68,6 +68,9 @@ FontFileReadDirectory (char *directory, FontDirectoryPtr *pdir)
FontDirectoryPtr dir = NullFontDirectory;
if (strlen(directory) + 1 + sizeof(FontDirFile) > sizeof(dir_file))
return BadFontPath;
#ifdef FONTDIRATTRIB
/* Check for font directory attributes */
#ifndef __UNIXOS2__
@@ -159,6 +162,9 @@ FontFileDirectoryChanged(FontDirectoryPtr dir)
char dir_file[MAXFONTFILENAMELEN];
struct stat statb;
if (strlen(dir->directory) + sizeof(FontDirFile) > sizeof(dir_file))
return FALSE;
strcpy (dir_file, dir->directory);
strcat (dir_file, FontDirFile);
if (stat (dir_file, &statb) == -1)
@@ -207,6 +213,8 @@ AddFileNameAliases(FontDirectoryPtr dir)
continue;
len = strlen (fileName) - renderer->fileSuffixLen;
if (len >= sizeof(copy))
continue;
CopyISOLatin1Lowered (copy, fileName, len);
copy[len] = '\0';
name.name = copy;
@@ -256,9 +264,13 @@ ReadFontAlias(char *directory, Bool isFile, FontDirectoryPtr *pdir)
int status = Successful;
struct stat statb;
if (strlen(directory) >= sizeof(alias_file))
return BadFontPath;
dir = *pdir;
strcpy(alias_file, directory);
if (!isFile) {
if (strlen(directory) + 1 + sizeof(FontAliasFile) > sizeof(alias_file))
return BadFontPath;
if (directory[strlen(directory) - 1] != '/')
strcat(alias_file, "/");
strcat(alias_file, FontAliasFile);
@@ -291,6 +303,10 @@ ReadFontAlias(char *directory, Bool isFile, FontDirectoryPtr *pdir)
status = AllocError;
break;
case NAME:
if (strlen(lexToken) >= sizeof(alias)) {
status = BadFontPath;
break;
}
strcpy(alias, lexToken);
token = lexAlias(file, &lexToken);
switch (token) {
@@ -307,6 +323,10 @@ ReadFontAlias(char *directory, Bool isFile, FontDirectoryPtr *pdir)
status = AllocError;
break;
case NAME:
if (strlen(lexToken) >= sizeof(font_name)) {
status = BadFontPath;
break;
}
CopyISOLatin1Lowered(alias, alias, strlen(alias));
CopyISOLatin1Lowered(font_name, lexToken, strlen(lexToken));
if (!FontFileAddFontAlias (dir, alias, font_name))

View File

@@ -1,4 +1,4 @@
/* $XdotOrg: fontfile.c,v 1.4 2001/02/09 02:04:03 xorgcvs Exp $ */
/* $XdotOrg: xc/lib/font/fontfile/fontfile.c,v 1.1.4.3 2003/12/06 13:24:23 kaleb Exp $ */
/* $Xorg: fontfile.c,v 1.4 2001/02/09 02:04:03 xorgcvs Exp $ */
/*
@@ -26,7 +26,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.21 2003/12/02 19:50:40 dawes Exp $ */
/* $XFree86: xc/lib/font/fontfile/fontfile.c,v 3.22 2004/02/11 21:11:20 dawes Exp $ */
/*
* Author: Keith Packard, MIT X Consortium
@@ -424,11 +424,16 @@ FontFileOpenFont (pointer client, FontPathElementPtr fpe, Mask flags,
vals.ranges = ranges;
vals.nranges = nranges;
strcpy (fileName, dir->directory);
strcat (fileName, scalable->fileName);
ret = (*scalable->renderer->OpenScalable) (fpe, pFont,
if (strlen(dir->directory) + strlen(scalable->fileName) >=
sizeof(fileName)) {
ret = BadFontName;
} else {
strcpy (fileName, dir->directory);
strcat (fileName, scalable->fileName);
ret = (*scalable->renderer->OpenScalable) (fpe, pFont,
flags, entry, fileName, &vals, format, fmask,
non_cachable_font);
}
/* In case rasterizer does something bad because of
charset subsetting... */
@@ -499,6 +504,8 @@ FontFileOpenBitmapNCF (FontPathElementPtr fpe, FontPtr *pFont,
bitmap = &entry->u.bitmap;
if(!bitmap || !bitmap->renderer->OpenBitmap)
return BadFontName;
if (strlen(dir->directory) + strlen(bitmap->fileName) >= sizeof(fileName))
return BadFontName;
strcpy (fileName, dir->directory);
strcat (fileName, bitmap->fileName);
ret = (*bitmap->renderer->OpenBitmap)
@@ -534,6 +541,8 @@ FontFileGetInfoBitmap (FontPathElementPtr fpe, FontInfoPtr pFontInfo,
bitmap = &entry->u.bitmap;
if (!bitmap || !bitmap->renderer->GetInfoBitmap)
return BadFontName;
if (strlen(dir->directory) + strlen(bitmap->fileName) >= sizeof(fileName))
return BadFontName;
strcpy (fileName, dir->directory);
strcat (fileName, bitmap->fileName);
ret = (*bitmap->renderer->GetInfoBitmap) (fpe, pFontInfo, entry, fileName);
@@ -873,10 +882,15 @@ FontFileListOneFontWithInfo (pointer client, FontPathElementPtr fpe,
bc = &entry->u.bc;
entry = bc->entry;
/* Make a new scaled instance */
strcpy (fileName, dir->directory);
strcat (fileName, scalable->fileName);
ret = (*scalable->renderer->GetInfoScalable)
if (strlen(dir->directory) + strlen(scalable->fileName) >=
sizeof(fileName)) {
ret = BadFontName;
} else {
strcpy (fileName, dir->directory);
strcat (fileName, scalable->fileName);
ret = (*scalable->renderer->GetInfoScalable)
(fpe, *pFontInfo, entry, tmpName, fileName, &bc->vals);
}
break;
#endif
default:
@@ -981,10 +995,15 @@ FontFileListOneFontWithInfo (pointer client, FontPathElementPtr fpe,
vals.nranges = nranges;
/* Make a new scaled instance */
strcpy (fileName, dir->directory);
strcat (fileName, scalable->fileName);
ret = (*scalable->renderer->GetInfoScalable)
(fpe, *pFontInfo, entry, &tmpName, fileName, &vals);
if (strlen(dir->directory) + strlen(scalable->fileName) >=
sizeof(fileName)) {
ret = BadFontName;
} else {
strcpy (fileName, dir->directory);
strcat (fileName, scalable->fileName);
ret = (*scalable->renderer->GetInfoScalable)
(fpe, *pFontInfo, entry, &tmpName, fileName, &vals);
}
if (ranges) xfree(ranges);
}
}

View File

@@ -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/renderers.c,v 1.7 2002/12/09 17:30:00 dawes Exp $ */
/* $XFree86: xc/lib/font/fontfile/renderers.c,v 1.8 2004/01/06 16:28:21 martin Exp $ */
/*
* Author: Keith Packard, MIT X Consortium
@@ -58,7 +58,7 @@ FontFilePriorityRegisterRenderer (FontRendererPtr renderer, int priority)
if (rendererGeneration != serverGeneration) {
rendererGeneration = serverGeneration;
renderers.number = 0;
if (!renderers.renderers)
if (renderers.renderers)
xfree(renderers.renderers);
renderers.renderers = NULL;
}