aboutsummaryrefslogtreecommitdiff
path: root/libXfont/src
diff options
context:
space:
mode:
Diffstat (limited to 'libXfont/src')
-rw-r--r--libXfont/src/FreeType/Makefile.in1
-rw-r--r--libXfont/src/FreeType/ftenc.c30
-rw-r--r--libXfont/src/FreeType/ftfuncs.c278
-rw-r--r--libXfont/src/Makefile.in7
-rw-r--r--libXfont/src/bitmap/Makefile.in1
-rw-r--r--libXfont/src/bitmap/bdfread.c40
-rw-r--r--libXfont/src/bitmap/bdfutils.c21
-rw-r--r--libXfont/src/bitmap/bitscale.c106
-rw-r--r--libXfont/src/bitmap/pcfread.c54
-rw-r--r--libXfont/src/bitmap/pcfwrite.c7
-rw-r--r--libXfont/src/bitmap/snfread.c18
-rw-r--r--libXfont/src/builtins/Makefile.in1
-rw-r--r--libXfont/src/builtins/builtin.h4
-rw-r--r--libXfont/src/fc/Makefile.in1
-rw-r--r--libXfont/src/fc/fsio.c26
-rw-r--r--libXfont/src/fc/fsio.h8
-rw-r--r--libXfont/src/fontfile/Makefile.in1
-rw-r--r--libXfont/src/fontfile/decompress.c61
-rw-r--r--libXfont/src/fontfile/fontdir.c16
-rw-r--r--libXfont/src/stubs/Makefile.in3
-rw-r--r--libXfont/src/util/Makefile.in1
-rw-r--r--libXfont/src/util/atom.c8
-rw-r--r--libXfont/src/util/fontxlfd.c18
23 files changed, 361 insertions, 350 deletions
diff --git a/libXfont/src/FreeType/Makefile.in b/libXfont/src/FreeType/Makefile.in
index 5682616bb..21b05b46c 100644
--- a/libXfont/src/FreeType/Makefile.in
+++ b/libXfont/src/FreeType/Makefile.in
@@ -95,6 +95,7 @@ AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
+BASE_CFLAGS = @BASE_CFLAGS@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
diff --git a/libXfont/src/FreeType/ftenc.c b/libXfont/src/FreeType/ftenc.c
index 99defbed6..9e31d7529 100644
--- a/libXfont/src/FreeType/ftenc.c
+++ b/libXfont/src/FreeType/ftenc.c
@@ -1,15 +1,15 @@
-/*
+/*
Copyright (c) 1998-2003 by Juliusz Chroboczek
-
+
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
+furnished to do so, subject to the following conditions:
+
The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
+all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
@@ -43,13 +43,13 @@ THE SOFTWARE.
static int find_cmap(int, int, int, FT_Face, FT_CharMap *);
static int
-FTEncFontSpecific(char *encoding)
+FTEncFontSpecific(const char *encoding)
{
- char *p = encoding;
+ const char *p = encoding;
if(strcasecmp(encoding, "microsoft-symbol") == 0)
return 1;
-
+
while(*p != '-') {
if(*p == '\0')
return 0;
@@ -69,7 +69,7 @@ FTPickMapping(char *xlfd, int length, char *filename, FT_Face face,
int ftrc;
int symbol = 0;
const char *enc, *reg;
- char *encoding_name = 0;
+ const char *encoding_name = 0;
char buf[20];
if(xlfd)
@@ -123,9 +123,9 @@ FTPickMapping(char *xlfd, int length, char *filename, FT_Face face,
}
}
}
-
+
for(mapping = encoding->mappings; mapping; mapping = mapping->next) {
- if(find_cmap(mapping->type, mapping->pid, mapping->eid, face,
+ if(find_cmap(mapping->type, mapping->pid, mapping->eid, face,
&cmap)) {
tm->named = 0;
tm->cmap = cmap;
@@ -144,7 +144,7 @@ FTPickMapping(char *xlfd, int length, char *filename, FT_Face face,
return Successful;
}
}
-
+
return BadFontFormat;
native:
@@ -155,7 +155,7 @@ FTPickMapping(char *xlfd, int length, char *filename, FT_Face face,
return Successful;
}
-static int
+static int
find_cmap(int type, int pid, int eid, FT_Face face, FT_CharMap *cmap_return)
{
int i, n;
@@ -177,7 +177,7 @@ find_cmap(int type, int pid, int eid, FT_Face face, FT_CharMap *cmap_return)
/* prefer Microsoft Unicode */
for(i=0; i<n; i++) {
cmap = face->charmaps[i];
- if(cmap->platform_id == TT_PLATFORM_MICROSOFT &&
+ if(cmap->platform_id == TT_PLATFORM_MICROSOFT &&
cmap->encoding_id == TT_MS_ID_UNICODE_CS) {
*cmap_return = cmap;
return 1;
@@ -207,7 +207,7 @@ find_cmap(int type, int pid, int eid, FT_Face face, FT_CharMap *cmap_return)
return 0;
}
-unsigned
+unsigned
FTRemap(FT_Face face, FTMappingPtr tm, unsigned code)
{
unsigned index;
diff --git a/libXfont/src/FreeType/ftfuncs.c b/libXfont/src/FreeType/ftfuncs.c
index fd8e53e5f..918e3f37e 100644
--- a/libXfont/src/FreeType/ftfuncs.c
+++ b/libXfont/src/FreeType/ftfuncs.c
@@ -48,7 +48,7 @@ THE SOFTWARE.
#include FT_BBOX_H
#include FT_TRUETYPE_TAGS_H
/*
- * If you want to use FT_Outline_Get_CBox instead of
+ * If you want to use FT_Outline_Get_CBox instead of
* FT_Outline_Get_BBox, define here.
*/
/* #define USE_GET_CBOX */
@@ -94,7 +94,7 @@ static CharInfoRec noSuchChar = { /* metrics */{0,0,0,0,0,0},
/* The propery names for all the XLFD properties. */
-static char *xlfd_props[] = {
+static const char *xlfd_props[] = {
"FOUNDRY",
"FAMILY_NAME",
"WEIGHT_NAME",
@@ -122,7 +122,7 @@ sfnt_get_ushort( FT_Face face,
FT_ULong len = sizeof(buff);
FT_UShort result = 0;
- if ( !FT_Load_Sfnt_Table( face, table_tag, table_offset, buff, &len ) );
+ if ( !FT_Load_Sfnt_Table( face, table_tag, table_offset, buff, &len ) )
result = (FT_UShort)( (buff[0] << 8) | buff[1] );
return result;
@@ -160,7 +160,7 @@ iceil(int x, int y)
{
return ifloor(x + y - 1, y);
}
-
+
static int
FreeTypeOpenFace(FTFacePtr *facep, char *FTFileName, char *realFileName, int faceNumber)
{
@@ -267,7 +267,7 @@ TransEqual(FTNormalisedTransformationPtr t1, FTNormalisedTransformationPtr t2)
else if(t1->nonIdentity != t2->nonIdentity)
return 0;
else if(t1->nonIdentity && t2->nonIdentity) {
- return
+ return
t1->matrix.xx == t2->matrix.xx &&
t1->matrix.yx == t2->matrix.yx &&
t1->matrix.yy == t2->matrix.yy &&
@@ -300,7 +300,7 @@ TTCapEqual(struct TTCapInfo *t1, struct TTCapInfo *t2)
t1->flags == t2->flags &&
t1->scaleBitmap == t2->scaleBitmap &&
/*
- If we use forceConstantSpacing,
+ If we use forceConstantSpacing,
we *MUST* allocate new instance.
*/
t1->forceConstantSpacingEnd < 0 &&
@@ -311,7 +311,7 @@ static int
FTInstanceMatch(FTInstancePtr instance,
char *FTFileName, FTNormalisedTransformationPtr trans,
int spacing, FontBitmapFormatPtr bmfmt,
- struct TTCapInfo *tmp_ttcap, FT_Int32 load_flags)
+ struct TTCapInfo *tmp_ttcap, FT_Int32 load_flags)
{
if(strcmp(instance->face->filename, FTFileName) != 0) {
return 0;
@@ -347,7 +347,7 @@ FreeTypeActivateInstance(FTInstancePtr instance)
instance->transformation.nonIdentity ?
&instance->transformation.matrix : 0,
0);
-
+
instance->face->active_instance = instance;
return Successful;
}
@@ -377,7 +377,7 @@ FTFindSize(FT_Face face, FTNormalisedTransformationPtr trans,
j = i;
d = dd;
}
- }
+ }
}
if(j < 0)
return BadFontName;
@@ -530,7 +530,7 @@ FreeTypeOpenInstance(FTInstancePtr *instance_return, FTFacePtr face,
/* maintain a linked list of instances */
instance->next = instance->face->instances;
instance->face->instances = instance;
-
+
*instance_return = instance;
return Successful;
}
@@ -547,7 +547,7 @@ FreeTypeFreeInstance(FTInstancePtr instance)
instance->refcount--;
if(instance->refcount <= 0) {
int i,j;
-
+
if(instance->face->instances == instance)
instance->face->instances = instance->next;
else {
@@ -573,7 +573,7 @@ FreeTypeFreeInstance(FTInstancePtr instance)
for(i = 0; i < iceil(instance->nglyphs, FONTSEGMENTSIZE); i++) {
if(instance->glyphs[i]) {
for(j = 0; j < FONTSEGMENTSIZE; j++) {
- if(instance->available[i][j] ==
+ if(instance->available[i][j] ==
FT_AVAILABLE_RASTERISED)
free(instance->glyphs[i][j].bits);
}
@@ -610,7 +610,7 @@ FreeTypeInstanceFindGlyph(unsigned idx_in, int flags, FTInstancePtr instance,
*found = 0;
return Successful;
}
-
+
if(*available == NULL) {
*available = calloc(iceil(instance->nglyphs, FONTSEGMENTSIZE),
sizeof(int *));
@@ -653,7 +653,7 @@ FreeTypeInstanceGetGlyph(unsigned idx, int flags, CharInfoPtr *g, FTInstancePtr
int xrc;
int ***available;
CharInfoPtr **glyphs;
-
+
available = &instance->available;
glyphs = &instance->glyphs;
@@ -665,17 +665,17 @@ FreeTypeInstanceGetGlyph(unsigned idx, int flags, CharInfoPtr *g, FTInstancePtr
if(!found || (*available)[segment][offset] == FT_AVAILABLE_NO) {
*g = NULL;
return Successful;
- }
+ }
if((*available)[segment][offset] == FT_AVAILABLE_RASTERISED) {
*g = &(*glyphs)[segment][offset];
return Successful;
}
-
+
flags |= FT_GET_GLYPH_BOTH;
- xrc = FreeTypeRasteriseGlyph(idx, flags,
- &(*glyphs)[segment][offset], instance,
+ 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");
@@ -698,7 +698,7 @@ FreeTypeInstanceGetGlyphMetrics(unsigned idx, int flags,
{
int xrc;
int found, segment, offset;
-
+
/* Char cell */
if(instance->spacing == FT_CHARCELL) {
*metrics = instance->charcellMetrics;
@@ -712,8 +712,8 @@ FreeTypeInstanceGetGlyphMetrics(unsigned idx, int flags,
/* Not char cell */
- xrc = FreeTypeInstanceFindGlyph(idx, flags, instance,
- &instance->glyphs, &instance->available,
+ xrc = FreeTypeInstanceFindGlyph(idx, flags, instance,
+ &instance->glyphs, &instance->available,
&found, &segment, &offset);
if(xrc != Successful)
return xrc;
@@ -724,16 +724,16 @@ FreeTypeInstanceGetGlyphMetrics(unsigned idx, int flags,
if( instance->available[segment][offset] == FT_AVAILABLE_NO ) {
*metrics = NULL;
return Successful;
- }
+ }
if( instance->available[segment][offset] >= FT_AVAILABLE_METRICS ) {
*metrics = &instance->glyphs[segment][offset].metrics;
return Successful;
}
-
+
flags |= FT_GET_GLYPH_METRICS_ONLY;
- xrc = FreeTypeRasteriseGlyph(idx, flags,
+ xrc = FreeTypeRasteriseGlyph(idx, flags,
&instance->glyphs[segment][offset],
instance, 0);
if(xrc == Successful) {
@@ -742,7 +742,7 @@ FreeTypeInstanceGetGlyphMetrics(unsigned idx, int flags,
}
return xrc;
}
-
+
/*
* Pseudo enbolding similar as Microsoft Windows.
* It is useful but poor.
@@ -796,7 +796,7 @@ ft_make_up_italic_bitmap( char *raster, int bpr, int ht, int shift,
tmp_shift %= 8;
if ( tmp_shift ) {
for (x=bpr-1;0<=x;x--) {
- if ( x != bpr-1 )
+ if ( x != bpr-1 )
tmp_p[x+1] |= tmp_p[x]<<(8-tmp_shift);
tmp_p[x]>>=tmp_shift;
}
@@ -814,7 +814,7 @@ ft_make_up_italic_bitmap( char *raster, int bpr, int ht, int shift,
tmp_shift %= 8;
if ( tmp_shift ) {
for (x=0;x<bpr;x++) {
- if ( x != 0 )
+ if ( x != 0 )
tmp_p[x-1] |= tmp_p[x]>>(8-tmp_shift);
tmp_p[x]<<=tmp_shift;
}
@@ -892,7 +892,7 @@ tt_get_metrics( FT_Face face,
}
}
-static int
+static int
ft_get_very_lazy_bbox( FT_UInt index,
FT_Face face,
FT_Size size,
@@ -1049,7 +1049,7 @@ FT_Do_SBit_Metrics( FT_Face ft_face, FT_Size ft_size, FT_ULong strike_index,
metrics_return->horiBearingX = (FT_Pos)elem_metrics.horiBearingX << 6;
metrics_return->horiBearingY = (FT_Pos)elem_metrics.horiBearingY << 6;
metrics_return->horiAdvance = (FT_Pos)elem_metrics.horiAdvance << 6;
-
+
metrics_return->vertBearingX = (FT_Pos)elem_metrics.vertBearingX << 6;
metrics_return->vertBearingY = (FT_Pos)elem_metrics.vertBearingY << 6;
metrics_return->vertAdvance = (FT_Pos)elem_metrics.vertAdvance << 6;
@@ -1100,12 +1100,12 @@ FreeTypeRasteriseGlyph(unsigned idx, int flags, CharInfoPtr tgp,
if(!hasMetrics) {
if( instance->spacing == FT_CHARCELL || flags & FT_GET_DUMMY ){
- memcpy((char*)&tgp->metrics,
+ memcpy((char*)&tgp->metrics,
(char*)instance->charcellMetrics,
sizeof(xCharInfo));
}
else if( flags & FT_FORCE_CONSTANT_SPACING ) {
- memcpy((char*)&tgp->metrics,
+ memcpy((char*)&tgp->metrics,
(char*)instance->forceConstantMetrics,
sizeof(xCharInfo));
}
@@ -1123,16 +1123,16 @@ FreeTypeRasteriseGlyph(unsigned idx, int flags, CharInfoPtr tgp,
}
if( bitmap_metrics == NULL ) {
if ( sbitchk_incomplete_but_exist==0 && (instance->ttcap.flags & TTCAP_IS_VERY_LAZY) ) {
- if( ft_get_very_lazy_bbox( idx, face->face, instance->size,
+ if( ft_get_very_lazy_bbox( idx, face->face, instance->size,
face->num_hmetrics,
instance->ttcap.vl_slant,
&instance->transformation.matrix,
- &bbox, &outline_hori_advance,
+ &bbox, &outline_hori_advance,
&outline_vert_advance ) == 0 ) {
goto bbox_ok; /* skip exact calculation */
}
}
- ftrc = FT_Load_Glyph(instance->face->face, idx,
+ ftrc = FT_Load_Glyph(instance->face->face, idx,
instance->load_flags);
if(ftrc != 0) return FTtoXReturnCode(ftrc);
metrics = &face->face->glyph->metrics;
@@ -1143,11 +1143,11 @@ FreeTypeRasteriseGlyph(unsigned idx, int flags, CharInfoPtr tgp,
if( bitmap_metrics ) {
FT_Pos factor;
-
+
leftSideBearing = bitmap_metrics->horiBearingX / 64;
rightSideBearing = (bitmap_metrics->width + bitmap_metrics->horiBearingX) / 64;
bbox_center_raw = (2.0 * bitmap_metrics->horiBearingX + bitmap_metrics->width)/2.0/64.0;
- characterWidth = (int)floor(bitmap_metrics->horiAdvance
+ characterWidth = (int)floor(bitmap_metrics->horiAdvance
* instance->ttcap.scaleBBoxWidth / 64.0 + .5);
ascent = bitmap_metrics->horiBearingY / 64;
descent = (bitmap_metrics->height - bitmap_metrics->horiBearingY) / 64 ;
@@ -1192,11 +1192,11 @@ FreeTypeRasteriseGlyph(unsigned idx, int flags, CharInfoPtr tgp,
bbox_center_raw = (double)(bbox.xMax + bbox.xMin)/2.0/64.;
if ( instance->pixel_width_unit_x != 0 )
characterWidth =
- (int)floor( outline_hori_advance
+ (int)floor( outline_hori_advance
* instance->ttcap.scaleBBoxWidth
* instance->pixel_width_unit_x / 64. + .5);
else {
- characterWidth =
+ characterWidth =
(int)floor( outline_vert_advance
* instance->ttcap.scaleBBoxHeight
* instance->pixel_width_unit_y / 64. + .5);
@@ -1212,12 +1212,12 @@ FreeTypeRasteriseGlyph(unsigned idx, int flags, CharInfoPtr tgp,
characterWidth = new_width;
if ( instance->pixel_width_unit_x != 0 )
rawCharacterWidth =
- (unsigned short)(short)(floor(1000 * outline_hori_advance
+ (unsigned short)(short)(floor(1000 * outline_hori_advance
* instance->ttcap.scaleBBoxWidth * ratio
* instance->pixel_width_unit_x / 64.));
else {
rawCharacterWidth =
- (unsigned short)(short)(floor(1000 * outline_vert_advance
+ (unsigned short)(short)(floor(1000 * outline_vert_advance
* instance->ttcap.scaleBBoxHeight * ratio
* instance->pixel_width_unit_y / 64.));
if(rawCharacterWidth <= 0)
@@ -1281,7 +1281,7 @@ FreeTypeRasteriseGlyph(unsigned idx, int flags, CharInfoPtr tgp,
if( flags & FT_GET_DUMMY ) is_outline = -1;
else {
if( !metrics ) {
- ftrc = FT_Load_Glyph(instance->face->face, idx,
+ ftrc = FT_Load_Glyph(instance->face->face, idx,
instance->load_flags);
metrics = &face->face->glyph->metrics;
@@ -1299,7 +1299,7 @@ FreeTypeRasteriseGlyph(unsigned idx, int flags, CharInfoPtr tgp,
bbox.yMin = FLOOR64( bbox.yMin );
bbox.yMax = CEIL64 ( bbox.yMax );
ht_actual = ( bbox.yMax - bbox.yMin ) >> 6;
- /* FreeType think a glyph with 0 height control box is invalid.
+ /* FreeType think a glyph with 0 height control box is invalid.
* So just let X to create a empty bitmap instead. */
if ( ht_actual == 0 )
is_outline = -1;
@@ -1319,11 +1319,11 @@ FreeTypeRasteriseGlyph(unsigned idx, int flags, CharInfoPtr tgp,
if( (instance->ttcap.flags & TTCAP_MONO_CENTER) && hasMetrics ) {
if( is_outline == 1 ){
if( correct ){
- if( ft_get_very_lazy_bbox( idx, face->face, instance->size,
+ if( ft_get_very_lazy_bbox( idx, face->face, instance->size,
face->num_hmetrics,
instance->ttcap.vl_slant,
&instance->transformation.matrix,
- &bbox, &outline_hori_advance,
+ &bbox, &outline_hori_advance,
&outline_vert_advance ) != 0 ){
is_outline = -1; /* <- error */
}
@@ -1357,10 +1357,10 @@ FreeTypeRasteriseGlyph(unsigned idx, int flags, CharInfoPtr tgp,
if(ht_actual <= 0) ht = 1;
else ht=ht_actual;
- bpr = (((wd + (instance->bmfmt.glyph<<3) - 1) >> 3) &
+ bpr = (((wd + (instance->bmfmt.glyph<<3) - 1) >> 3) &
-instance->bmfmt.glyph);
raster = calloc(1, ht * bpr);
- if(raster == NULL)
+ if(raster == NULL)
return AllocError;
tgp->bits = raster;
@@ -1483,7 +1483,7 @@ FreeTypeRasteriseGlyph(unsigned idx, int flags, CharInfoPtr tgp,
if ( is_outline == 0 &&
( instance->ttcap.lsbShiftOfBitmapAutoItalic != 0 ||
instance->ttcap.rsbShiftOfBitmapAutoItalic != 0 ) ) {
- ft_make_up_italic_bitmap( raster, bpr, ht,
+ ft_make_up_italic_bitmap( raster, bpr, ht,
- instance->ttcap.lsbShiftOfBitmapAutoItalic
+ instance->ttcap.rsbShiftOfBitmapAutoItalic,
instance->charcellMetrics->ascent
@@ -1492,11 +1492,11 @@ FreeTypeRasteriseGlyph(unsigned idx, int flags, CharInfoPtr tgp,
- tgp->metrics.ascent,
instance->ttcap.autoItalic);
}
-
+
if(instance->bmfmt.bit == LSBFirst) {
BitOrderInvert((unsigned char*)(tgp->bits), ht*bpr);
}
-
+
if(instance->bmfmt.byte != instance->bmfmt.bit) {
switch(instance->bmfmt.scan) {
case 1:
@@ -1532,7 +1532,7 @@ static void
FreeTypeFreeXFont(FontPtr pFont, int freeProps)
{
FTFontPtr tf;
-
+
if(pFont) {
if((tf = (FTFontPtr)pFont->fontPrivate)) {
FreeTypeFreeFont(tf);
@@ -1562,7 +1562,7 @@ FreeTypeUnloadXFont(FontPtr pFont)
used by Xaw. */
static int
-FreeTypeAddProperties(FTFontPtr font, FontScalablePtr vals, FontInfoPtr info,
+FreeTypeAddProperties(FTFontPtr font, FontScalablePtr vals, FontInfoPtr info,
char *fontname, int rawAverageWidth, Bool font_properties)
{
int i, j, maxprops;
@@ -1600,7 +1600,7 @@ FreeTypeAddProperties(FTFontPtr font, FontScalablePtr vals, FontInfoPtr info,
}
info->nprops = 0; /* in case we abort */
-
+
strcpy(val, fontname);
if(FontParseXLFDName(val, vals, FONT_XLFD_REPLACE_VALUE)) {
xlfdProps = 1;
@@ -1618,11 +1618,11 @@ FreeTypeAddProperties(FTFontPtr font, FontScalablePtr vals, FontInfoPtr info,
( (font_properties && os2) ? 6 : 0 ) +
( (font_properties && (post || t1info)) ? 3 : 0 ) +
2; /* type */
-
+
info->props = malloc(maxprops * sizeof(FontPropRec));
if(info->props == NULL)
return AllocError;
-
+
info->isStringProp = malloc(maxprops);
if(info->isStringProp == NULL) {
free(info->props);
@@ -1646,18 +1646,18 @@ FreeTypeAddProperties(FTFontPtr font, FontScalablePtr vals, FontInfoPtr info,
for (ep = sp; *ep && *ep != '['; ep++);
else
for (ep = sp; *ep && *ep != '-'; ep++);
-
+
info->props[i].name =
MakeAtom(xlfd_props[j], strlen(xlfd_props[j]), TRUE);
-
+
switch(j) {
case 6: /* pixel size */
- info->props[i].value =
+ info->props[i].value =
(int)(fabs(vals->pixel_matrix[3]) + 0.5);
i++;
break;
case 7: /* point size */
- info->props[i].value =
+ info->props[i].value =
(int)(fabs(vals->point_matrix[3])*10.0 + 0.5);
i++;
break;
@@ -1704,7 +1704,7 @@ FreeTypeAddProperties(FTFontPtr font, FontScalablePtr vals, FontInfoPtr info,
if(!face->bitmap) {
info->props[i].name = MakeAtom("RAW_ASCENT", 10, TRUE);
- info->props[i].value =
+ info->props[i].value =
((double)face->face->ascender/(double)upm*1000.0);
i++;
}
@@ -1717,7 +1717,7 @@ FreeTypeAddProperties(FTFontPtr font, FontScalablePtr vals, FontInfoPtr info,
if(!face->bitmap) {
info->props[i].name = MakeAtom("RAW_DESCENT", 11, TRUE);
- info->props[i].value =
+ info->props[i].value =
-((double)face->face->descender/(double)upm*1000.0);
i++;
}
@@ -1737,7 +1737,7 @@ FreeTypeAddProperties(FTFontPtr font, FontScalablePtr vals, FontInfoPtr info,
info->isStringProp[i] = 1;
i++;
}
-
+
j = FTGetEnglishName(face->face, TT_NAME_ID_FULL_NAME,
val, MAXFONTNAMELEN);
vp = val;
@@ -1790,30 +1790,30 @@ FreeTypeAddProperties(FTFontPtr font, FontScalablePtr vals, FontInfoPtr info,
/* In what follows, we assume the matrix is diagonal. In the rare
case when it is not, the values will be somewhat wrong. */
-
+
if( font_properties && os2 ) {
info->props[i].name = MakeAtom("SUBSCRIPT_SIZE",14,TRUE);
- info->props[i].value =
+ info->props[i].value =
TRANSFORM_FUNITS_Y(os2->ySubscriptYSize);
i++;
info->props[i].name = MakeAtom("SUBSCRIPT_X",11,TRUE);
- info->props[i].value =
+ info->props[i].value =
TRANSFORM_FUNITS_X(os2->ySubscriptXOffset);
i++;
info->props[i].name = MakeAtom("SUBSCRIPT_Y",11,TRUE);
- info->props[i].value =
+ info->props[i].value =
TRANSFORM_FUNITS_Y(os2->ySubscriptYOffset);
i++;
info->props[i].name = MakeAtom("SUPERSCRIPT_SIZE",16,TRUE);
- info->props[i].value =
+ info->props[i].value =
TRANSFORM_FUNITS_Y(os2->ySuperscriptYSize);
i++;
info->props[i].name = MakeAtom("SUPERSCRIPT_X",13,TRUE);
- info->props[i].value =
+ info->props[i].value =
TRANSFORM_FUNITS_X(os2->ySuperscriptXOffset);
i++;
info->props[i].name = MakeAtom("SUPERSCRIPT_Y",13,TRUE);
- info->props[i].value =
+ info->props[i].value =
TRANSFORM_FUNITS_Y(os2->ySuperscriptYOffset);
i++;
}
@@ -1821,15 +1821,15 @@ FreeTypeAddProperties(FTFontPtr font, FontScalablePtr vals, FontInfoPtr info,
if( font_properties && (post || t1info) ) {
int underlinePosition, underlineThickness;
- /* Raw underlineposition counts upwards,
+ /* Raw underlineposition counts upwards,
but UNDERLINE_POSITION counts downwards. */
if(post) {
underlinePosition = TRANSFORM_FUNITS_Y(-post->underlinePosition);
underlineThickness = TRANSFORM_FUNITS_Y(post->underlineThickness);
} else {
- underlinePosition =
+ underlinePosition =
TRANSFORM_FUNITS_Y(-t1info->underline_position);
- underlineThickness =
+ underlineThickness =
TRANSFORM_FUNITS_Y(t1info->underline_thickness);
}
if(underlineThickness <= 0)
@@ -1848,8 +1848,8 @@ FreeTypeAddProperties(FTFontPtr font, FontScalablePtr vals, FontInfoPtr info,
/* The italic angle is often unreliable for Type 1 fonts */
if(post && trans->matrix.xx == trans->matrix.yy) {
info->props[i].name = MakeAtom("ITALIC_ANGLE",12,TRUE);
- info->props[i].value =
- /* Convert from TT_Fixed to
+ info->props[i].value =
+ /* Convert from TT_Fixed to
64th of a degree counterclockwise from 3 o'clock */
90*64+(post->italicAngle >> 10);
i++;
@@ -1863,12 +1863,12 @@ FreeTypeAddProperties(FTFontPtr font, FontScalablePtr vals, FontInfoPtr info,
info->props[i].value = MakeAtom(vp, strlen(vp), TRUE);
info->isStringProp[i] = 1;
i++;
-
+
info->props[i].name = MakeAtom("RASTERIZER_NAME", 15, TRUE);
info->props[i].value = MakeAtom("FreeType", 10, TRUE);
info->isStringProp[i] = 1;
i++;
-
+
info->nprops = i;
return Successful;
}
@@ -1876,20 +1876,20 @@ FreeTypeAddProperties(FTFontPtr font, FontScalablePtr vals, FontInfoPtr info,
static int
ft_get_index(unsigned code, FTFontPtr font, unsigned *idx)
{
-
+
/* As a special case, we pass 0 even when it is not in the ranges;
this will allow for the default glyph, which should exist in any
TrueType font. */
-
+
/* This is not required...
if(code > 0 && font->nranges) {
int i;
for(i = 0; i < font->nranges; i++)
- if((code >=
+ if((code >=
font->ranges[i].min_char_low+
(font->ranges[i].min_char_high<<8)) &&
(code <=
- font->ranges[i].max_char_low +
+ font->ranges[i].max_char_low +
(font->ranges[i].max_char_high<<8)))
break;
if(i == font->nranges) {
@@ -1911,7 +1911,7 @@ ft_get_index(unsigned code, FTFontPtr font, unsigned *idx)
}
*idx = FTRemap(font->instance->face->face, &font->mapping, code);
-
+
return 0;
}
@@ -1920,7 +1920,7 @@ FreeTypeFontGetGlyph(unsigned code, int flags, CharInfoPtr *g, FTFontPtr font)
{
unsigned idx = 0;
int xrc;
-
+
#ifdef X_ACCEPTS_NO_SUCH_CHAR
if( ft_get_index(code,font,&idx) || idx == 0 || idx == font->zero_idx ) {
*g = NULL;
@@ -1972,7 +1972,7 @@ FreeTypeFontGetGlyphMetrics(unsigned code, int flags, xCharInfo **metrics, FTFon
if( xrc == Successful && *metrics != NULL )
return Successful;
if( font->zero_idx != idx ) {
- xrc = FreeTypeInstanceGetGlyphMetrics(font->zero_idx, flags,
+ xrc = FreeTypeInstanceGetGlyphMetrics(font->zero_idx, flags,
metrics, font->instance);
if( xrc == Successful && *metrics != NULL )
return Successful;
@@ -2156,7 +2156,7 @@ restrict_code_range_by_str(int count,unsigned short *refFirstCol,
}
/* *face_number and *spacing are initialized but *load_flags is NOT. */
-static int
+static int
FreeTypeSetUpTTCap( char *fileName, FontScalablePtr vals,
char **dynStrRealFileName, char **dynStrFTFileName,
struct TTCapInfo *ret, int *face_number, FT_Int32 *load_flags,
@@ -2185,7 +2185,7 @@ FreeTypeSetUpTTCap( char *fileName, FontScalablePtr vals,
{
/* font cap */
char *p1=NULL, *p2=NULL;
-
+
p1=strrchr(fileName, '/');
if ( p1 == NULL ) p1 = fileName;
else p1++;
@@ -2193,7 +2193,7 @@ FreeTypeSetUpTTCap( char *fileName, FontScalablePtr vals,
/* colon exist in the right side of slash. */
int dirLen = p1-fileName;
int baseLen = fileName+len - p2 -1;
-
+
*dynStrRealFileName = malloc(dirLen+baseLen+1);
if( *dynStrRealFileName == NULL ) {
result = AllocError;
@@ -2302,7 +2302,7 @@ FreeTypeSetUpTTCap( char *fileName, FontScalablePtr vals,
fprintf(stderr,"[Filename:%s]\n",fileName);
fprintf(stderr,"[RealFilename:%s]\n",*dynStrRealFileName);
fprintf(stderr,"[FTFilename:%s]\n",*dynStrFTFileName);
- */
+ */
/* slant control */
if (SPropRecValList_search_record(&listPropRecVal,
&contRecValue,
@@ -2587,15 +2587,15 @@ FreeTypeSetUpTTCap( char *fileName, FontScalablePtr vals,
semic_ptr=strchr(strMetrics,';');
comma_ptr=strchr(strMetrics,',');
period_ptr=strchr(strMetrics,'.');
- if ( semic_ptr && comma_ptr )
+ if ( semic_ptr && comma_ptr )
if ( semic_ptr < comma_ptr ) comma_ptr=NULL;
- if ( semic_ptr && period_ptr )
+ if ( semic_ptr && period_ptr )
if ( semic_ptr < period_ptr ) period_ptr=NULL;
if ( !comma_ptr && !period_ptr && strMetrics != semic_ptr ) {
if ( restrict_code_range_by_str(1,&first_col, &first_row,
&last_col, &last_row,
SPropContainer_value_str(contRecValue)) == 1 ) {
- ret->force_c_representative_metrics_char_code =
+ ret->force_c_representative_metrics_char_code =
(int)( first_row<<8 | first_col );
}
}
@@ -2688,14 +2688,14 @@ ft_get_trans_from_vals( FontScalablePtr vals, FTNormalisedTransformationPtr tran
{
/* Compute the transformation matrix. We use floating-point
arithmetic for simplicity */
-
+
trans->xres = vals->x;
trans->yres = vals->y;
-
+
/* This value cannot be 0. */
trans->scale = hypot(vals->point_matrix[2], vals->point_matrix[3]);
trans->nonIdentity = 0;
-
+
/* Try to round stuff. We want approximate zeros to be exact zeros,
and if the elements on the diagonal are approximately equal, we
want them equal. We do this to avoid breaking hinting. */
@@ -2710,14 +2710,14 @@ ft_get_trans_from_vals( FontScalablePtr vals, FTNormalisedTransformationPtr tran
((vals->point_matrix[0] + vals->point_matrix[3])/2*
(double)TWO_SIXTEENTH)/trans->scale;
}
-
+
if(DIFFER0(vals->point_matrix[1], trans->scale)) {
trans->matrix.yx =
(int)((vals->point_matrix[1]*(double)TWO_SIXTEENTH)/trans->scale);
trans->nonIdentity = 1;
} else
trans->matrix.yx = 0;
-
+
if(DIFFER0(vals->point_matrix[2], trans->scale)) {
trans->matrix.xy =
(int)((vals->point_matrix[2]*(double)TWO_SIXTEENTH)/trans->scale);
@@ -2749,7 +2749,7 @@ is_fixed_width(FT_Face face)
static int
FreeTypeLoadFont(FTFontPtr font, FontInfoPtr info, FTFacePtr face,
char *FTFileName, FontScalablePtr vals, FontEntryPtr entry,
- FontBitmapFormatPtr bmfmt, FT_Int32 load_flags,
+ FontBitmapFormatPtr bmfmt, FT_Int32 load_flags,
struct TTCapInfo *tmp_ttcap, char *dynStrTTCapCodeRange,
int ttcap_spacing )
{
@@ -2766,7 +2766,7 @@ FreeTypeLoadFont(FTFontPtr font, FontInfoPtr info, FTFacePtr face,
if(entry->name.ndashes == 14) {
char *p;
int dashes = 0;
- for(p = entry->name.name;
+ for(p = entry->name.name;
p <= entry->name.name + entry->name.length - 2;
p++) {
if(*p == '-') {
@@ -2800,17 +2800,17 @@ FreeTypeLoadFont(FTFontPtr font, FontInfoPtr info, FTFacePtr face,
if (xrc != Successful)
return xrc;
} else {
- xrc = FTPickMapping(0, 0, FTFileName,
+ xrc = FTPickMapping(0, 0, FTFileName,
face->face, &font->mapping);
if (xrc != Successful)
return xrc;
}
-
+
font->nranges = vals->nranges;
font->ranges = 0;
if(font->nranges) {
font->ranges = malloc(vals->nranges*sizeof(fsRange));
- if(font->ranges == NULL)
+ if(font->ranges == NULL)
return AllocError;
memcpy((char*)font->ranges, (char*)vals->ranges,
vals->nranges*sizeof(fsRange));
@@ -2820,7 +2820,7 @@ FreeTypeLoadFont(FTFontPtr font, FontInfoPtr info, FTFacePtr face,
if(info) {
firstCode = 0;
lastCode = 0xFFFFL;
- if(!font->mapping.mapping ||
+ if(!font->mapping.mapping ||
font->mapping.mapping->encoding->row_size == 0) {
/* linear indexing */
lastCode=MIN(lastCode,
@@ -2841,7 +2841,7 @@ FreeTypeLoadFont(FTFontPtr font, FontInfoPtr info, FTFacePtr face,
info->lastRow = MIN(font->mapping.mapping->encoding->size-1,
lastCode/0x100);
info->firstCol = font->mapping.mapping->encoding->first_col;
- info->lastCol = MIN(font->mapping.mapping->encoding->row_size-1,
+ info->lastCol = MIN(font->mapping.mapping->encoding->row_size-1,
lastCode<0x100?lastCode:0xFF);
if( info->firstRow == 0 && info->firstCol == 0 ) zero_code=0;
}
@@ -2868,7 +2868,7 @@ FreeTypeLoadFont(FTFontPtr font, FontInfoPtr info, FTFacePtr face,
font->zero_idx = 0;
}
else
- font->zero_idx = FTRemap(face->face,
+ font->zero_idx = FTRemap(face->face,
&font->mapping, zero_code);
post = FT_Get_Sfnt_Table(face->face, ft_sfnt_post);
@@ -2954,7 +2954,7 @@ ft_compute_bounds(FTFontPtr font, FontInfoPtr pinfo, FontScalablePtr vals )
for (row = pinfo->firstRow; row <= pinfo->lastRow; row++) {
if ( skip_ok && tmpchar ) {
if ( !force_c_outside ) {
- if ( instance->ttcap.forceConstantSpacingBegin < row<<8
+ if ( instance->ttcap.forceConstantSpacingBegin < row<<8
&& row<<8 < (instance->ttcap.forceConstantSpacingEnd & 0x0ff00) ) {
if (tmpchar->characterWidth) {
num_chars += num_cols;
@@ -2966,7 +2966,7 @@ ft_compute_bounds(FTFontPtr font, FontInfoPtr pinfo, FontScalablePtr vals )
else skip_ok=0;
}
else { /* for GB18030 proportional */
- if ( instance->ttcap.forceConstantSpacingBegin < row<<8
+ if ( instance->ttcap.forceConstantSpacingBegin < row<<8
|| row<<8 < (instance->ttcap.forceConstantSpacingEnd & 0x0ff00) ) {
if (tmpchar->characterWidth) {
num_chars += num_cols;
@@ -2982,12 +2982,12 @@ ft_compute_bounds(FTFontPtr font, FontInfoPtr pinfo, FontScalablePtr vals )
c = row<<8|col;
flags=0;
if ( !force_c_outside ) {
- if ( c <= instance->ttcap.forceConstantSpacingEnd
+ if ( c <= instance->ttcap.forceConstantSpacingEnd
&& instance->ttcap.forceConstantSpacingBegin <= c )
flags|=FT_FORCE_CONSTANT_SPACING;
}
else { /* for GB18030 proportional */
- if ( c <= instance->ttcap.forceConstantSpacingEnd
+ if ( c <= instance->ttcap.forceConstantSpacingEnd
|| instance->ttcap.forceConstantSpacingBegin <= c )
flags|=FT_FORCE_CONSTANT_SPACING;
}
@@ -3007,13 +3007,13 @@ ft_compute_bounds(FTFontPtr font, FontInfoPtr pinfo, FontScalablePtr vals )
overlap = tmpchar->rightSideBearing - tmpchar->characterWidth;
if (maxOverlap < overlap)
maxOverlap = overlap;
-
+
if (!tmpchar->characterWidth)
continue;
num_chars++;
swidth += ABS(tmpchar->characterWidth);
total_width += tmpchar->characterWidth;
-
+
if ( flags & FT_FORCE_CONSTANT_SPACING ) skip_ok=1;
}
}
@@ -3107,7 +3107,7 @@ is_matrix_unit(FontScalablePtr vals)
m.yx = vals->point_matrix[1] / base_size * 65536;
m.yy = vals->point_matrix[3] / base_size * 65536;
- return (m.xx == 65536) && (m.yx == 0) &&
+ return (m.xx == 65536) && (m.yx == 0) &&
(m.xy == 0) && (m.yy == 65536);
}
@@ -3115,7 +3115,7 @@ is_matrix_unit(FontScalablePtr vals)
/* xf->info is only accessed through info, and xf might be null */
static int
-FreeTypeLoadXFont(char *fileName,
+FreeTypeLoadXFont(char *fileName,
FontScalablePtr vals, FontPtr xf, FontInfoPtr info,
FontBitmapFormatPtr bmfmt, FontEntryPtr entry)
{
@@ -3143,9 +3143,9 @@ FreeTypeLoadXFont(char *fileName,
goto quit;
}
- xrc = FreeTypeSetUpTTCap(fileName, vals,
+ xrc = FreeTypeSetUpTTCap(fileName, vals,
&dynStrRealFileName, &dynStrFTFileName,
- &tmp_ttcap, &face_number,
+ &tmp_ttcap, &face_number,
&load_flags, &ttcap_spacing,
&font_properties, &dynStrTTCapCodeRange);
if ( xrc != Successful ) {
@@ -3187,7 +3187,7 @@ FreeTypeLoadXFont(char *fileName,
}
xrc = FreeTypeLoadFont(font, info, face, dynStrFTFileName, vals, entry, bmfmt,
- load_flags, &tmp_ttcap, dynStrTTCapCodeRange,
+ load_flags, &tmp_ttcap, dynStrTTCapCodeRange,
ttcap_spacing );
if(xrc != Successful) {
goto quit;
@@ -3258,9 +3258,9 @@ FreeTypeLoadXFont(char *fileName,
width_x = max_advance_height * ins_ttcap->scaleBBoxHeight * unit_y;
}
else{
- unit_x = fabs(vals->pixel_matrix[0] -
+ unit_x = fabs(vals->pixel_matrix[0] -
vals->pixel_matrix[1]*vals->pixel_matrix[2]/vals->pixel_matrix[3]);
- unit_y = fabs(vals->pixel_matrix[2] -
+ unit_y = fabs(vals->pixel_matrix[2] -
vals->pixel_matrix[3]*vals->pixel_matrix[0]/vals->pixel_matrix[1]);
width_x = face->face->max_advance_width * ins_ttcap->scaleBBoxWidth * unit_x;
width_y = max_advance_height * ins_ttcap->scaleBBoxHeight * unit_y;
@@ -3346,7 +3346,7 @@ FreeTypeLoadXFont(char *fileName,
force_c_rsb += ins_ttcap->force_c_adjust_rsb_by_pixel;
force_c_lsb += ins_ttcap->force_c_adjust_lsb_by_pixel;
/* apply to rawWidth */
- averageWidth = (int)floor(10 * width_x * scale
+ averageWidth = (int)floor(10 * width_x * scale
* ratio + 0.5);
rawWidth = floor(width_x * scale
* ratio * 1000. / base_height + 0.5);
@@ -3505,7 +3505,7 @@ FreeTypeLoadXFont(char *fileName,
instance->forceConstantMetrics->attributes = force_c_rawWidth;
}
/* Check code 0 */
- if( FreeTypeInstanceGetGlyph(font->zero_idx, FT_FORCE_CONSTANT_SPACING,
+ if( FreeTypeInstanceGetGlyph(font->zero_idx, FT_FORCE_CONSTANT_SPACING,
&tmpglyph, font->instance) != Successful
|| tmpglyph == NULL)
if( FreeTypeInstanceGetGlyph(font->zero_idx, FT_FORCE_CONSTANT_SPACING | FT_GET_DUMMY,
@@ -3541,10 +3541,10 @@ FreeTypeLoadXFont(char *fileName,
if( !charcell ) { /* NOT CHARCELL */
if( info ){
- /*
+ /*
Calculate all glyphs' metrics.
maxbounds.ascent and maxbounds.descent are quite important values
- for XAA. If ascent/descent of each glyph exceeds
+ for XAA. If ascent/descent of each glyph exceeds
maxbounds.ascent/maxbounds.descent, XAA causes SERVER CRASH.
Therefore, THIS MUST BE DONE.
*/
@@ -3558,7 +3558,7 @@ FreeTypeLoadXFont(char *fileName,
*/
vals->width = averageWidth;
-
+
if( info ){
info->maxbounds.leftSideBearing = minLsb;
@@ -3568,7 +3568,7 @@ FreeTypeLoadXFont(char *fileName,
info->maxbounds.descent = descent;
info->maxbounds.attributes =
(unsigned short)(short)rawWidth;
-
+
info->minbounds = info->maxbounds;
}
}
@@ -3584,12 +3584,12 @@ FreeTypeLoadXFont(char *fileName,
info->fontDescent = info->maxbounds.descent;
/* Glyph metrics are accurate */
info->inkMetrics=1;
-
+
memcpy((char *)&info->ink_maxbounds,
(char *)&info->maxbounds, sizeof(xCharInfo));
memcpy((char *)&info->ink_minbounds,
(char *)&info->minbounds, sizeof(xCharInfo));
-
+
/* XXX - hack */
info->defaultCh=0;
@@ -3607,9 +3607,9 @@ FreeTypeLoadXFont(char *fileName,
if(xf)
xf->fontPrivate = (void*)font;
-
+
if(info) {
- xrc = FreeTypeAddProperties(font, vals, info, entry->name.name,
+ xrc = FreeTypeAddProperties(font, vals, info, entry->name.name,
rawAverageWidth, font_properties);
if (xrc != Successful) {
goto quit;
@@ -3650,23 +3650,23 @@ FreeTypeGetMetrics(FontPtr pFont, unsigned long count, unsigned char *chars,
while (count-- > 0) {
switch (charEncoding) {
- case Linear8Bit:
+ case Linear8Bit:
case TwoD8Bit:
code = *chars++;
break;
- case Linear16Bit:
+ case Linear16Bit:
case TwoD16Bit:
code = (*chars++ << 8);
code |= *chars++;
/* */
if ( !(ttcap->flags & TTCAP_FORCE_C_OUTSIDE) ) {
- if ( (int)code <= ttcap->forceConstantSpacingEnd
+ if ( (int)code <= ttcap->forceConstantSpacingEnd
&& ttcap->forceConstantSpacingBegin <= (int)code )
flags|=FT_FORCE_CONSTANT_SPACING;
else flags=0;
}
else { /* for GB18030 proportional */
- if ( (int)code <= ttcap->forceConstantSpacingEnd
+ if ( (int)code <= ttcap->forceConstantSpacingEnd
|| ttcap->forceConstantSpacingBegin <= (int)code )
flags|=FT_FORCE_CONSTANT_SPACING;
else flags=0;
@@ -3681,7 +3681,7 @@ FreeTypeGetMetrics(FontPtr pFont, unsigned long count, unsigned char *chars,
else *mp++ = &noSuchChar.metrics;
#endif
}
-
+
*metricCount = mp - metrics;
return Successful;
}
@@ -3708,24 +3708,24 @@ FreeTypeGetGlyphs(FontPtr pFont, unsigned long count, unsigned char *chars,
code = *chars++;
break;
case Linear16Bit: case TwoD16Bit:
- code = *chars++ << 8;
+ code = *chars++ << 8;
code |= *chars++;
/* */
if ( !(ttcap->flags & TTCAP_FORCE_C_OUTSIDE) ) {
- if ( (int)code <= ttcap->forceConstantSpacingEnd
+ if ( (int)code <= ttcap->forceConstantSpacingEnd
&& ttcap->forceConstantSpacingBegin <= (int)code )
flags|=FT_FORCE_CONSTANT_SPACING;
else flags=0;
}
else { /* for GB18030 proportional */
- if ( (int)code <= ttcap->forceConstantSpacingEnd
+ if ( (int)code <= ttcap->forceConstantSpacingEnd
|| ttcap->forceConstantSpacingBegin <= (int)code )
flags|=FT_FORCE_CONSTANT_SPACING;
else flags=0;
}
break;
}
-
+
if(FreeTypeFontGetGlyph(code, flags, &g, tf) == Successful && g!=NULL) {
*gp++ = g;
}
@@ -3746,7 +3746,7 @@ FreeTypeGetGlyphs(FontPtr pFont, unsigned long count, unsigned char *chars,
else wd=wd_actual;
if(ht_actual <= 0) ht = 1;
else ht=ht_actual;
- bpr = (((wd + (tf->instance->bmfmt.glyph<<3) - 1) >> 3) &
+ bpr = (((wd + (tf->instance->bmfmt.glyph<<3) - 1) >> 3) &
-tf->instance->bmfmt.glyph);
raster = calloc(1, ht * bpr);
if(raster) {
@@ -3758,13 +3758,13 @@ FreeTypeGetGlyphs(FontPtr pFont, unsigned long count, unsigned char *chars,
}
#endif
}
-
+
*glyphCount = gp - glyphs;
return Successful;
}
static int
-FreeTypeSetUpFont(FontPathElementPtr fpe, FontPtr xf, FontInfoPtr info,
+FreeTypeSetUpFont(FontPathElementPtr fpe, FontPtr xf, FontInfoPtr info,
fsBitmapFormat format, fsBitmapFormatMask fmask,
FontBitmapFormatPtr bmfmt)
{
@@ -3907,9 +3907,9 @@ static FontRendererRec alt_renderers[] = {
FreeTypeGetInfoScalable, 0, CAPABILITIES},
};
-static int num_alt_renderers =
+static int num_alt_renderers =
sizeof(alt_renderers) / sizeof(alt_renderers[0]);
-
+
void
FreeTypeRegisterFontFileFunctions(void)
diff --git a/libXfont/src/Makefile.in b/libXfont/src/Makefile.in
index 2f3dfdbf9..65b68f7e9 100644
--- a/libXfont/src/Makefile.in
+++ b/libXfont/src/Makefile.in
@@ -15,9 +15,9 @@
@SET_MAKE@
-#
+#
# Copyright © 2003 Keith Packard, Noah Levitt
-#
+#
# Permission to use, copy, modify, distribute, and sell this software and its
# documentation for any purpose is hereby granted without fee, provided that
# the above copyright notice appear in all copies and that both that
@@ -27,7 +27,7 @@
# specific, written prior permission. Keith Packard makes no
# representations about the suitability of this software for any purpose. It
# is provided "as is" without express or implied warranty.
-#
+#
# KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
# INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
# EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
@@ -183,6 +183,7 @@ AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
+BASE_CFLAGS = @BASE_CFLAGS@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
diff --git a/libXfont/src/bitmap/Makefile.in b/libXfont/src/bitmap/Makefile.in
index 583e9b1e6..0b88ec1da 100644
--- a/libXfont/src/bitmap/Makefile.in
+++ b/libXfont/src/bitmap/Makefile.in
@@ -97,6 +97,7 @@ AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
+BASE_CFLAGS = @BASE_CFLAGS@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
diff --git a/libXfont/src/bitmap/bdfread.c b/libXfont/src/bitmap/bdfread.c
index 2464c03cc..e2770dc1c 100644
--- a/libXfont/src/bitmap/bdfread.c
+++ b/libXfont/src/bitmap/bdfread.c
@@ -76,7 +76,7 @@ extern int bdfFileLineNum;
/***====================================================================***/
static Bool
-bdfReadBitmap(CharInfoPtr pCI, FontFilePtr file, int bit, int byte,
+bdfReadBitmap(CharInfoPtr pCI, FontFilePtr file, int bit, int byte,
int glyph, int scan, CARD32 *sizes)
{
int widthBits,
@@ -99,7 +99,7 @@ bdfReadBitmap(CharInfoPtr pCI, FontFilePtr file, int bit, int byte,
if (widthBytes * height > 0) {
picture = malloc(widthBytes * height);
if (!picture) {
- bdfError("Couldn't allocate picture (%d*%d)\n", widthBytes, height);
+ bdfError("Couldn't allocate picture (%d*%d)\n", widthBytes, height);
goto BAILOUT;
}
} else
@@ -247,7 +247,7 @@ bdfFreeFontBits(FontPtr pFont)
static Bool
-bdfReadCharacters(FontFilePtr file, FontPtr pFont, bdfFileState *pState,
+bdfReadCharacters(FontFilePtr file, FontPtr pFont, bdfFileState *pState,
int bit, int byte, int glyph, int scan)
{
unsigned char *line;
@@ -291,13 +291,13 @@ bdfReadCharacters(FontFilePtr file, FontPtr pFont, bdfFileState *pState,
}
if (nchars > INT32_MAX / sizeof(CharInfoRec)) {
bdfError("Couldn't allocate pCI (%d*%d)\n", nchars,
- sizeof(CharInfoRec));
+ (int) sizeof(CharInfoRec));
goto BAILOUT;
}
ci = calloc(nchars, sizeof(CharInfoRec));
if (!ci) {
bdfError("Couldn't allocate pCI (%d*%d)\n", nchars,
- sizeof(CharInfoRec));
+ (int) sizeof(CharInfoRec));
goto BAILOUT;
}
bitmapFont->metrics = ci;
@@ -306,7 +306,7 @@ bdfReadCharacters(FontFilePtr file, FontPtr pFont, bdfFileState *pState,
bitmapExtra->glyphNames = malloc(nchars * sizeof(Atom));
if (!bitmapExtra->glyphNames) {
bdfError("Couldn't allocate glyphNames (%d*%d)\n",
- nchars, sizeof(Atom));
+ nchars, (int) sizeof(Atom));
goto BAILOUT;
}
}
@@ -314,7 +314,7 @@ bdfReadCharacters(FontFilePtr file, FontPtr pFont, bdfFileState *pState,
bitmapExtra->sWidths = malloc(nchars * sizeof(int));
if (!bitmapExtra->sWidths) {
bdfError("Couldn't allocate sWidth (%d *%d)\n",
- nchars, sizeof(int));
+ nchars, (int) sizeof(int));
return FALSE;
}
}
@@ -380,7 +380,7 @@ bdfReadCharacters(FontFilePtr file, FontPtr pFont, bdfFileState *pState,
bdfEncoding[char_row] = malloc(256 * sizeof(CharInfoPtr));
if (!bdfEncoding[char_row]) {
bdfError("Couldn't allocate row %d of encoding (%d*%d)\n",
- char_row, INDICES, sizeof(CharInfoPtr));
+ char_row, INDICES, (int) sizeof(CharInfoPtr));
goto BAILOUT;
}
for (i = 0; i < 256; i++)
@@ -490,7 +490,7 @@ bdfReadCharacters(FontFilePtr file, FontPtr pFont, bdfFileState *pState,
if (!bitmapFont->encoding) {
bdfError("Couldn't allocate ppCI (%d,%d)\n",
NUM_SEGMENTS(nencoding),
- sizeof(CharInfoPtr*));
+ (int) sizeof(CharInfoPtr*));
goto BAILOUT;
}
pFont->info.allExist = TRUE;
@@ -515,7 +515,7 @@ bdfReadCharacters(FontFilePtr file, FontPtr pFont, bdfFileState *pState,
if (!bitmapFont->encoding[SEGMENT_MAJOR(i)])
goto BAILOUT;
}
- ACCESSENCODINGL(bitmapFont->encoding,i) =
+ ACCESSENCODINGL(bitmapFont->encoding,i) =
bdfEncoding[char_row][char_col];
}
i++;
@@ -610,14 +610,14 @@ bdfReadProperties(FontFilePtr file, FontPtr pFont, bdfFileState *pState)
pFont->info.isStringProp = stringProps;
if (stringProps == NULL) {
bdfError("Couldn't allocate stringProps (%d*%d)\n",
- (nProps + BDF_GENPROPS), sizeof(Bool));
+ (nProps + BDF_GENPROPS), (int) sizeof(Bool));
goto BAILOUT;
}
pFont->info.props = props = calloc(nProps + BDF_GENPROPS,
sizeof(FontPropRec));
if (props == NULL) {
bdfError("Couldn't allocate props (%d*%d)\n", nProps + BDF_GENPROPS,
- sizeof(FontPropRec));
+ (int) sizeof(FontPropRec));
goto BAILOUT;
}
@@ -782,7 +782,7 @@ bdfUnloadFont(FontPtr pFont)
}
int
-bdfReadFont(FontPtr pFont, FontFilePtr file,
+bdfReadFont(FontPtr pFont, FontFilePtr file,
int bit, int byte, int glyph, int scan)
{
bdfFileState state;
@@ -800,7 +800,8 @@ bdfReadFont(FontPtr pFont, FontFilePtr file,
bitmapFont = calloc(1, sizeof(BitmapFontRec));
if (!bitmapFont) {
- bdfError("Couldn't allocate bitmapFontRec (%d)\n", sizeof(BitmapFontRec));
+ bdfError("Couldn't allocate bitmapFontRec (%d)\n",
+ (int) sizeof(BitmapFontRec));
goto BAILOUT;
}
@@ -813,10 +814,11 @@ bdfReadFont(FontPtr pFont, FontFilePtr file,
bitmapFont->bitmapExtra = calloc(1, sizeof(BitmapExtraRec));
if (!bitmapFont->bitmapExtra) {
- bdfError("Couldn't allocate bitmapExtra (%d)\n", sizeof(BitmapExtraRec));
+ bdfError("Couldn't allocate bitmapExtra (%d)\n",
+ (int) sizeof(BitmapExtraRec));
goto BAILOUT;
}
-
+
bitmapFont->bitmapExtra->glyphNames = 0;
bitmapFont->bitmapExtra->sWidths = 0;
@@ -836,7 +838,7 @@ bdfReadFont(FontPtr pFont, FontFilePtr file,
cols = pFont->info.lastCol - pFont->info.firstCol + 1;
r = r - pFont->info.firstRow;
c = c - pFont->info.firstCol;
- bitmapFont->pDefault = ACCESSENCODING(bitmapFont->encoding,
+ bitmapFont->pDefault = ACCESSENCODING(bitmapFont->encoding,
r * cols + c);
}
}
@@ -859,7 +861,7 @@ bdfReadFont(FontPtr pFont, FontFilePtr file,
bdfError("Failed to add bitmap ink metrics\n");
goto BAILOUT;
}
- }
+ }
if (bitmapFont->bitmapExtra)
bitmapFont->bitmapExtra->info.inkMetrics = pFont->info.inkMetrics;
@@ -924,7 +926,7 @@ bdfPadToTerminal(FontPtr pFont)
bitmapFont = (BitmapFontPtr) pFont->fontPrivate;
- bzero(&new, sizeof(CharInfoRec));
+ bzero(&new, sizeof(CharInfoRec));
new.metrics.ascent = pFont->info.fontAscent;
new.metrics.descent = pFont->info.fontDescent;
new.metrics.leftSideBearing = 0;
diff --git a/libXfont/src/bitmap/bdfutils.c b/libXfont/src/bitmap/bdfutils.c
index 1d6cc7253..288148b36 100644
--- a/libXfont/src/bitmap/bdfutils.c
+++ b/libXfont/src/bitmap/bdfutils.c
@@ -68,7 +68,7 @@ int bdfFileLineNum;
/***====================================================================***/
void
-bdfError(char* message, ...)
+bdfError(const char* message, ...)
{
va_list args;
@@ -81,7 +81,7 @@ bdfError(char* message, ...)
/***====================================================================***/
void
-bdfWarning(char *message, ...)
+bdfWarning(const char *message, ...)
{
va_list args;
@@ -127,7 +127,7 @@ bdfGetLine(FontFilePtr file, unsigned char *buf, int len)
/***====================================================================***/
Atom
-bdfForceMakeAtom(char *str, int *size)
+bdfForceMakeAtom(const char *str, int *size)
{
register int len = strlen(str);
Atom the_atom;
@@ -174,8 +174,9 @@ bdfGetPropertyValue(char *s)
s++;
pp = p = malloc((unsigned) strlen(s) + 1);
if (pp == NULL) {
- bdfError("Couldn't allocate property value string (%d)\n", strlen(s) + 1);
- return None;
+ bdfError("Couldn't allocate property value string (%d)\n",
+ (int) strlen(s) + 1);
+ return None;
}
while (*s) {
if (*s == '"') {
@@ -191,7 +192,7 @@ bdfGetPropertyValue(char *s)
*p++ = *s++;
}
free (pp);
- bdfError("unterminated quoted string property: %s\n", (pointer) orig_s);
+ bdfError("unterminated quoted string property: %s\n", orig_s);
return None;
}
@@ -249,7 +250,7 @@ bdfHexByte(unsigned char *s)
* check for known special property values
*/
-static char *SpecialAtoms[] = {
+static const char *SpecialAtoms[] = {
"FONT_ASCENT",
#define BDF_FONT_ASCENT 0
"FONT_DESCENT",
@@ -276,11 +277,11 @@ static char *SpecialAtoms[] = {
};
Bool
-bdfSpecialProperty(FontPtr pFont, FontPropPtr prop,
+bdfSpecialProperty(FontPtr pFont, FontPropPtr prop,
char isString, bdfFileState *bdfState)
{
- char **special;
- char *name;
+ const char **special;
+ const char *name;
name = NameForAtom(prop->name);
for (special = SpecialAtoms; *special; special++)
diff --git a/libXfont/src/bitmap/bitscale.c b/libXfont/src/bitmap/bitscale.c
index 50818c66e..e89ba7ce0 100644
--- a/libXfont/src/bitmap/bitscale.c
+++ b/libXfont/src/bitmap/bitscale.c
@@ -63,11 +63,11 @@ from The Open Group.
extern unsigned long serverGeneration;
static void bitmapUnloadScalable (FontPtr pFont);
-static void ScaleBitmap ( FontPtr pFont, CharInfoPtr opci,
- CharInfoPtr pci, double *inv_xform,
+static void ScaleBitmap ( FontPtr pFont, CharInfoPtr opci,
+ CharInfoPtr pci, double *inv_xform,
double widthMult, double heightMult );
-static FontPtr BitmapScaleBitmaps(FontPtr pf, FontPtr opf,
- double widthMult, double heightMult,
+static FontPtr BitmapScaleBitmaps(FontPtr pf, FontPtr opf,
+ double widthMult, double heightMult,
FontScalablePtr vals);
enum scaleType {
@@ -78,17 +78,17 @@ enum scaleType {
};
typedef struct _fontProp {
- char *name;
+ const char *name;
Atom atom;
enum scaleType type;
} fontProp;
-static FontEntryPtr FindBestToScale ( FontPathElementPtr fpe,
- FontEntryPtr entry,
- FontScalablePtr vals,
- FontScalablePtr best,
- double *dxp, double *dyp,
- double *sdxp, double *sdyp,
+static FontEntryPtr FindBestToScale ( FontPathElementPtr fpe,
+ FontEntryPtr entry,
+ FontScalablePtr vals,
+ FontScalablePtr best,
+ double *dxp, double *dyp,
+ double *sdxp, double *sdyp,
FontPathElementPtr *fpep );
static unsigned long bitscaleGeneration = 0; /* initialization flag */
@@ -231,8 +231,8 @@ get_matrix_vertical_component(double *matrix)
static Bool
-ComputeScaleFactors(FontScalablePtr from, FontScalablePtr to,
- double *dx, double *dy, double *sdx, double *sdy,
+ComputeScaleFactors(FontScalablePtr from, FontScalablePtr to,
+ double *dx, double *dy, double *sdx, double *sdy,
double *rescale_x)
{
double srcpixelset, destpixelset, srcpixel, destpixel;
@@ -318,10 +318,10 @@ else \
score += (int)(((double)(8 * s)) * m);
static FontEntryPtr
-FindBestToScale(FontPathElementPtr fpe, FontEntryPtr entry,
- FontScalablePtr vals, FontScalablePtr best,
- double *dxp, double *dyp,
- double *sdxp, double *sdyp,
+FindBestToScale(FontPathElementPtr fpe, FontEntryPtr entry,
+ FontScalablePtr vals, FontScalablePtr best,
+ double *dxp, double *dyp,
+ double *sdxp, double *sdyp,
FontPathElementPtr *fpep)
{
FontScalableRec temp;
@@ -425,7 +425,7 @@ FindBestToScale(FontPathElementPtr fpe, FontEntryPtr entry,
((score == best_score) &&
((dy_amount < best_dy_amount) ||
((dy_amount == best_dy_amount) &&
- (dx_amount < best_dx_amount)))))
+ (dx_amount < best_dx_amount)))))
{
best_fpe = FontFileBitmapSources.fpe[source];
best_scaled = scaled;
@@ -525,8 +525,8 @@ doround(double x)
}
static int
-computeProps(FontPropPtr pf, char *wasStringProp,
- FontPropPtr npf, char *isStringProp,
+computeProps(FontPropPtr pf, char *wasStringProp,
+ FontPropPtr npf, char *isStringProp,
unsigned int nprops, double xfactor, double yfactor,
double sXfactor, double sYfactor)
{
@@ -580,13 +580,13 @@ computeProps(FontPropPtr pf, char *wasStringProp,
static int
ComputeScaledProperties(FontInfoPtr sourceFontInfo, /* the font to be scaled */
char *name, /* name of resulting font */
- FontScalablePtr vals,
+ FontScalablePtr vals,
double dx, double dy, /* scale factors in x and y */
double sdx, double sdy, /* directions */
long sWidth, /* 1000-pixel average width */
- FontPropPtr *pProps, /* returns properties;
+ FontPropPtr *pProps, /* returns properties;
preallocated */
- char **pIsStringProp) /* return booleans;
+ char **pIsStringProp) /* return booleans;
preallocated */
{
int n;
@@ -692,8 +692,8 @@ ComputeScaledProperties(FontInfoPtr sourceFontInfo, /* the font to be scaled */
static int
-compute_xform_matrix(FontScalablePtr vals, double dx, double dy,
- double *xform, double *inv_xform,
+compute_xform_matrix(FontScalablePtr vals, double dx, double dy,
+ double *xform, double *inv_xform,
double *xmult, double *ymult)
{
double det;
@@ -752,17 +752,17 @@ compute_xform_matrix(FontScalablePtr vals, double dx, double dy,
* returns a pointer to the new scaled font, or NULL (due to AllocError).
*/
static FontPtr
-ScaleFont(FontPtr opf, /* originating font */
- double widthMult, /* glyphs width scale factor */
- double heightMult, /* glyphs height scale factor */
- double sWidthMult, /* scalable glyphs width scale factor */
- double sHeightMult, /* scalable glyphs height scale factor */
- FontScalablePtr vals,
- double *newWidthMult, /* return: X component of glyphs width
- scale factor */
- double *newHeightMult, /* return: Y component of glyphs height
- scale factor */
- long *sWidth) /* return: average 1000-pixel width */
+ScaleFont(FontPtr opf, /* originating font */
+ double widthMult, /* glyphs width scale factor */
+ double heightMult, /* glyphs height scale factor */
+ double sWidthMult, /* scalable glyphs width scale factor */
+ double sHeightMult, /* scalable glyphs height scale factor */
+ FontScalablePtr vals,
+ double *newWidthMult, /* return: X component of glyphs width
+ scale factor */
+ double *newHeightMult, /* return: Y component of glyphs height
+ scale factor */
+ long *sWidth) /* return: average 1000-pixel width */
{
FontPtr pf;
FontInfoPtr pfi,
@@ -1015,7 +1015,7 @@ ScaleFont(FontPtr opf, /* originating font */
if (pci->metrics.ascent == -pci->metrics.descent)
pci->metrics.ascent++;
}
-
+
pci++;
}
}
@@ -1039,7 +1039,7 @@ ScaleFont(FontPtr opf, /* originating font */
pfi->minbounds.field = pci->metrics.field; \
if (pfi->maxbounds.field < pci->metrics.field) \
pfi->maxbounds.field = pci->metrics.field
-
+
MINMAX(leftSideBearing);
MINMAX(rightSideBearing);
MINMAX(ascent);
@@ -1093,7 +1093,7 @@ ScaleFont(FontPtr opf, /* originating font */
cols = pfi->lastCol - pfi->firstCol + 1;
r = r - pfi->firstRow;
c = c - pfi->firstCol;
- bitmapFont->pDefault =
+ bitmapFont->pDefault =
ACCESSENCODING(bitmapFont->encoding, r * cols + c);
}
}
@@ -1117,7 +1117,7 @@ bail:
}
static void
-ScaleBitmap(FontPtr pFont, CharInfoPtr opci, CharInfoPtr pci,
+ScaleBitmap(FontPtr pFont, CharInfoPtr opci, CharInfoPtr pci,
double *inv_xform, double widthMult, double heightMult)
{
register char *bitmap, /* The bits */
@@ -1394,7 +1394,7 @@ ScaleBitmap(FontPtr pFont, CharInfoPtr opci, CharInfoPtr pci,
{
register int x = xValue >> 16, y = yValue >> 16;
int pixvalue, error;
-
+
pixvalue = ((x >= 0 && x < width && y >= 0 && y < height) ?
char_grayscale[x + y * (width + 1)] : 0) +
thisrow[col] / 16;
@@ -1436,7 +1436,7 @@ ScaleBitmap(FontPtr pFont, CharInfoPtr opci, CharInfoPtr pci,
for (col = 0; col < newWidth; col++)
{
register int x = xValue >> 16, y = yValue >> 16;
-
+
if (x >= 0 && x < width && y >= 0 && y < height)
{
/* Use point-sampling for rescaling. */
@@ -1543,13 +1543,13 @@ bail:
/* ARGSUSED */
int
-BitmapOpenScalable (FontPathElementPtr fpe,
- FontPtr *pFont,
- int flags,
- FontEntryPtr entry,
+BitmapOpenScalable (FontPathElementPtr fpe,
+ FontPtr *pFont,
+ int flags,
+ FontEntryPtr entry,
char *fileName, /* unused */
- FontScalablePtr vals,
- fsBitmapFormat format,
+ FontScalablePtr vals,
+ fsBitmapFormat format,
fsBitmapFormatMask fmask,
FontPtr non_cachable_font) /* We don't do licensing */
{
@@ -1635,11 +1635,11 @@ BitmapOpenScalable (FontPathElementPtr fpe,
}
int
-BitmapGetInfoScalable (FontPathElementPtr fpe,
- FontInfoPtr pFontInfo,
- FontEntryPtr entry,
- FontNamePtr fontName,
- char *fileName,
+BitmapGetInfoScalable (FontPathElementPtr fpe,
+ FontInfoPtr pFontInfo,
+ FontEntryPtr entry,
+ FontNamePtr fontName,
+ char *fileName,
FontScalablePtr vals)
{
FontPtr pfont;
diff --git a/libXfont/src/bitmap/pcfread.c b/libXfont/src/bitmap/pcfread.c
index 32f9856fa..34eeeb734 100644
--- a/libXfont/src/bitmap/pcfread.c
+++ b/libXfont/src/bitmap/pcfread.c
@@ -56,7 +56,7 @@ pcfError(const char* message, ...)
vfprintf(stderr, message, args);
va_end(args);
}
-
+
/* Read PCF font files */
static void pcfUnloadFont ( FontPtr pFont );
@@ -138,7 +138,8 @@ pcfReadTOC(FontFilePtr file, int *countp)
}
tables = malloc(count * sizeof(PCFTableRec));
if (!tables) {
- pcfError("pcfReadTOC(): Couldn't allocate tables (%d*%d)\n", count, sizeof(PCFTableRec));
+ pcfError("pcfReadTOC(): Couldn't allocate tables (%d*%d)\n",
+ count, (int) sizeof(PCFTableRec));
return (PCFTablePtr) NULL;
}
for (i = 0; i < count; i++) {
@@ -197,7 +198,7 @@ pcfGetCompressedMetric(FontFilePtr file, CARD32 format, xCharInfo *metric)
* in the font file
*/
static Bool
-pcfSeekToType(FontFilePtr file, PCFTablePtr tables, int ntables,
+pcfSeekToType(FontFilePtr file, PCFTablePtr tables, int ntables,
CARD32 type, CARD32 *formatp, CARD32 *sizep)
{
int i;
@@ -228,14 +229,14 @@ pcfHasType (PCFTablePtr tables, int ntables, CARD32 type)
}
/*
- * pcfGetProperties
+ * pcfGetProperties
*
* Reads the font properties from the font file, filling in the FontInfo rec
* supplied. Used by by both ReadFont and ReadFontInfo routines.
*/
static Bool
-pcfGetProperties(FontInfoPtr pFontInfo, FontFilePtr file,
+pcfGetProperties(FontInfoPtr pFontInfo, FontFilePtr file,
PCFTablePtr tables, int ntables)
{
FontPropPtr props = 0;
@@ -262,22 +263,24 @@ pcfGetProperties(FontInfoPtr pFontInfo, FontFilePtr file,
if (IS_EOF(file)) goto Bail;
props = malloc(nprops * sizeof(FontPropRec));
if (!props) {
- pcfError("pcfGetProperties(): Couldn't allocate props (%d*%d)\n", nprops, sizeof(FontPropRec));
+ pcfError("pcfGetProperties(): Couldn't allocate props (%d*%d)\n",
+ nprops, (int) sizeof(FontPropRec));
goto Bail;
}
isStringProp = malloc(nprops * sizeof(char));
if (!isStringProp) {
- pcfError("pcfGetProperties(): Couldn't allocate isStringProp (%d*%d)\n", nprops, sizeof(char));
+ pcfError("pcfGetProperties(): Couldn't allocate isStringProp (%d*%d)\n",
+ nprops, (int) sizeof(char));
goto Bail;
}
for (i = 0; i < nprops; i++) {
props[i].name = pcfGetINT32(file, format);
isStringProp[i] = pcfGetINT8(file, format);
props[i].value = pcfGetINT32(file, format);
- if (props[i].name < 0
+ if (props[i].name < 0
|| (isStringProp[i] != 0 && isStringProp[i] != 1)
|| (isStringProp[i] && props[i].value < 0)) {
- pcfError("pcfGetProperties(): invalid file format %d %d %d\n",
+ pcfError("pcfGetProperties(): invalid file format %ld %d %ld\n",
props[i].name, isStringProp[i], props[i].value);
goto Bail;
}
@@ -334,7 +337,7 @@ Bail:
*/
static Bool
-pcfGetAccel(FontInfoPtr pFontInfo, FontFilePtr file,
+pcfGetAccel(FontInfoPtr pFontInfo, FontFilePtr file,
PCFTablePtr tables, int ntables, CARD32 type)
{
CARD32 format;
@@ -345,7 +348,7 @@ pcfGetAccel(FontInfoPtr pFontInfo, FontFilePtr file,
goto Bail;
format = pcfGetLSB32(file);
if (!PCF_FORMAT_MATCH(format, PCF_DEFAULT_FORMAT) &&
- !PCF_FORMAT_MATCH(format, PCF_ACCEL_W_INKBOUNDS))
+ !PCF_FORMAT_MATCH(format, PCF_ACCEL_W_INKBOUNDS))
{
goto Bail;
}
@@ -382,7 +385,7 @@ Bail:
}
int
-pcfReadFont(FontPtr pFont, FontFilePtr file,
+pcfReadFont(FontPtr pFont, FontFilePtr file,
int bit, int byte, int glyph, int scan)
{
CARD32 format;
@@ -407,6 +410,8 @@ pcfReadFont(FontPtr pFont, FontFilePtr file,
pFont->info.nprops = 0;
pFont->info.props = 0;
+ pFont->info.isStringProp=0;
+
if (!(tables = pcfReadTOC(file, &ntables)))
goto Bail;
@@ -443,7 +448,8 @@ pcfReadFont(FontPtr pFont, FontFilePtr file,
}
metrics = malloc(nmetrics * sizeof(CharInfoRec));
if (!metrics) {
- pcfError("pcfReadFont(): Couldn't allocate metrics (%d*%d)\n", nmetrics, sizeof(CharInfoRec));
+ pcfError("pcfReadFont(): Couldn't allocate metrics (%d*%d)\n",
+ nmetrics, (int) sizeof(CharInfoRec));
goto Bail;
}
for (i = 0; i < nmetrics; i++)
@@ -454,7 +460,7 @@ pcfReadFont(FontPtr pFont, FontFilePtr file,
if (!pcfGetCompressedMetric(file, format, &(metrics + i)->metrics))
goto Bail;
}
-
+
/* bitmaps */
if (!pcfSeekToType(file, tables, ntables, PCF_BITMAPS, &format, &size))
@@ -469,7 +475,8 @@ pcfReadFont(FontPtr pFont, FontFilePtr file,
/* nmetrics is already ok, so nbitmap also is */
offsets = malloc(nbitmaps * sizeof(CARD32));
if (!offsets) {
- pcfError("pcfReadFont(): Couldn't allocate offsets (%d*%d)\n", nbitmaps, sizeof(CARD32));
+ pcfError("pcfReadFont(): Couldn't allocate offsets (%d*%d)\n",
+ nbitmaps, (int) sizeof(CARD32));
goto Bail;
}
for (i = 0; i < nbitmaps; i++) {
@@ -482,7 +489,7 @@ pcfReadFont(FontPtr pFont, FontFilePtr file,
if (IS_EOF(file)) goto Bail;
if (bitmapSizes[i] < 0) goto Bail;
}
-
+
sizebitmaps = bitmapSizes[PCF_GLYPH_PAD_INDEX(format)];
/* guard against completely empty font */
bitmaps = malloc(sizebitmaps ? sizebitmaps : 1);
@@ -558,10 +565,11 @@ pcfReadFont(FontPtr pFont, FontFilePtr file,
goto Bail;
/* nmetrics already checked */
ink_metrics = malloc(nink_metrics * sizeof(xCharInfo));
- if (!ink_metrics) {
- pcfError("pcfReadFont(): Couldn't allocate ink_metrics (%d*%d)\n", nink_metrics, sizeof(xCharInfo));
+ if (!ink_metrics) {
+ pcfError("pcfReadFont(): Couldn't allocate ink_metrics (%d*%d)\n",
+ nink_metrics, (int) sizeof(xCharInfo));
goto Bail;
- }
+ }
for (i = 0; i < nink_metrics; i++)
if (PCF_FORMAT_MATCH(format, PCF_DEFAULT_FORMAT)) {
if (!pcfGetMetric(file, format, ink_metrics + i))
@@ -595,10 +603,11 @@ pcfReadFont(FontPtr pFont, FontFilePtr file,
encoding = calloc(NUM_SEGMENTS(nencoding), sizeof(CharInfoPtr*));
if (!encoding) {
- pcfError("pcfReadFont(): Couldn't allocate encoding (%d*%d)\n", nencoding, sizeof(CharInfoPtr));
+ pcfError("pcfReadFont(): Couldn't allocate encoding (%d*%d)\n",
+ nencoding, (int) sizeof(CharInfoPtr));
goto Bail;
}
-
+
pFont->info.allExist = TRUE;
for (i = 0; i < nencoding; i++) {
encodingOffset = pcfGetINT16(file, format);
@@ -624,7 +633,8 @@ pcfReadFont(FontPtr pFont, FontFilePtr file,
bitmapFont = malloc(sizeof *bitmapFont);
if (!bitmapFont) {
- pcfError("pcfReadFont(): Couldn't allocate bitmapFont (%d)\n", sizeof *bitmapFont);
+ pcfError("pcfReadFont(): Couldn't allocate bitmapFont (%d)\n",
+ (int) sizeof *bitmapFont);
goto Bail;
}
diff --git a/libXfont/src/bitmap/pcfwrite.c b/libXfont/src/bitmap/pcfwrite.c
index 3ac07b359..0874c4bd4 100644
--- a/libXfont/src/bitmap/pcfwrite.c
+++ b/libXfont/src/bitmap/pcfwrite.c
@@ -236,7 +236,8 @@ pcfWriteFont(FontPtr pFont, FontFilePtr file)
}
offsetProps = malloc(pFont->info.nprops * sizeof(FontPropRec));
if (!offsetProps) {
- pcfError("pcfWriteFont(): Couldn't allocate offsetProps (%d*%d)", pFont->info.nprops, sizeof(FontPropRec));
+ pcfError("pcfWriteFont(): Couldn't allocate offsetProps (%d*%d)",
+ pFont->info.nprops, (int) sizeof(FontPropRec));
return AllocError;
}
prop_string_size = 0;
@@ -430,8 +431,8 @@ pcfWriteFont(FontPtr pFont, FontFilePtr file)
pcfPutINT16(file, format, pFont->info.defaultCh);
for (i = 0; i < nencodings; i++) {
if (ACCESSENCODING(bitmapFont->encoding,i))
- pcfPutINT16(file, format,
- ACCESSENCODING(bitmapFont->encoding, i) -
+ pcfPutINT16(file, format,
+ ACCESSENCODING(bitmapFont->encoding, i) -
bitmapFont->metrics);
else
pcfPutINT16(file, format, 0xFFFF);
diff --git a/libXfont/src/bitmap/snfread.c b/libXfont/src/bitmap/snfread.c
index d003cc5a5..da362c81a 100644
--- a/libXfont/src/bitmap/snfread.c
+++ b/libXfont/src/bitmap/snfread.c
@@ -60,7 +60,7 @@ from The Open Group.
#include <stdarg.h>
-static void
+static void _X_ATTRIBUTE_PRINTF(1, 2)
snfError(const char* message, ...)
{
va_list args;
@@ -71,7 +71,7 @@ snfError(const char* message, ...)
vfprintf(stderr, message, args);
va_end(args);
}
-
+
static void snfUnloadFont(FontPtr pFont);
static int
@@ -211,7 +211,7 @@ SnfGetFormat (int *bit, int *byte, int *glyph, int *scan)
}
int
-snfReadFont(FontPtr pFont, FontFilePtr file,
+snfReadFont(FontPtr pFont, FontFilePtr file,
int bit, int byte, int glyph, int scan)
{
snfFontInfoRec fi;
@@ -239,7 +239,7 @@ snfReadFont(FontPtr pFont, FontFilePtr file,
/*
* we'll allocate one chunk of memory and split it among the various parts
* of the font:
- *
+ *
* BitmapFontRec CharInfoRec's Glyphs Encoding DIX Properties Ink CharInfoRec's
*
* If the glyphpad is not the same as the font file, then the glyphs
@@ -253,7 +253,7 @@ snfReadFont(FontPtr pFont, FontFilePtr file,
metrics_off = bytestoalloc;
bytestoalloc += num_chars * sizeof(CharInfoRec); /* metrics */
encoding_off = bytestoalloc;
- bytestoalloc += NUM_SEGMENTS(num_chars) * sizeof(CharInfoPtr**);
+ bytestoalloc += NUM_SEGMENTS(num_chars) * sizeof(CharInfoPtr**);
/* encoding */
props_off = bytestoalloc;
bytestoalloc += fi.nProps * sizeof(FontPropRec); /* props */
@@ -299,7 +299,7 @@ snfReadFont(FontPtr pFont, FontFilePtr file,
*/
ret = Successful;
- memset(bitmapFont->encoding, 0,
+ memset(bitmapFont->encoding, 0,
NUM_SEGMENTS(num_chars)*sizeof(CharInfoPtr*));
for (i = 0; ret == Successful && i < num_chars; i++) {
ret = snfReadCharInfo(file, &bitmapFont->metrics[i], bitmaps);
@@ -454,12 +454,14 @@ snfReadFontInfo(FontInfoPtr pFontInfo, FontFilePtr file)
pFontInfo->props = malloc(fi.nProps * sizeof(FontPropRec));
if (!pFontInfo->props) {
- snfError("snfReadFontInfo(): Couldn't allocate props (%d*%d)\n", fi.nProps, sizeof(FontPropRec));
+ snfError("snfReadFontInfo(): Couldn't allocate props (%d*%d)\n",
+ fi.nProps, (int) sizeof(FontPropRec));
return AllocError;
}
pFontInfo->isStringProp = malloc(fi.nProps * sizeof(char));
if (!pFontInfo->isStringProp) {
- snfError("snfReadFontInfo(): Couldn't allocate isStringProp (%d*%d)\n", fi.nProps, sizeof(char));
+ snfError("snfReadFontInfo(): Couldn't allocate isStringProp (%d*%d)\n",
+ fi.nProps, (int) sizeof(char));
free(pFontInfo->props);
return AllocError;
}
diff --git a/libXfont/src/builtins/Makefile.in b/libXfont/src/builtins/Makefile.in
index 9cbdadd59..53c718f6b 100644
--- a/libXfont/src/builtins/Makefile.in
+++ b/libXfont/src/builtins/Makefile.in
@@ -95,6 +95,7 @@ AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
+BASE_CFLAGS = @BASE_CFLAGS@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
diff --git a/libXfont/src/builtins/builtin.h b/libXfont/src/builtins/builtin.h
index 418bfe984..75dff8d85 100644
--- a/libXfont/src/builtins/builtin.h
+++ b/libXfont/src/builtins/builtin.h
@@ -16,7 +16,7 @@
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL SuSE
* BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
- * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
+ * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
* Author: Keith Packard, SuSE, Inc.
@@ -36,7 +36,7 @@ typedef struct _BuiltinFile {
} BuiltinFileRec, *BuiltinFilePtr;
typedef struct _BuiltinDir {
- char *file_name;
+ const char *file_name;
char *font_name;
} BuiltinDirRec, *BuiltinDirPtr;
diff --git a/libXfont/src/fc/Makefile.in b/libXfont/src/fc/Makefile.in
index faf33b715..779f06f11 100644
--- a/libXfont/src/fc/Makefile.in
+++ b/libXfont/src/fc/Makefile.in
@@ -95,6 +95,7 @@ AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
+BASE_CFLAGS = @BASE_CFLAGS@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
diff --git a/libXfont/src/fc/fsio.c b/libXfont/src/fc/fsio.c
index 63d3b4f3c..03a689f6e 100644
--- a/libXfont/src/fc/fsio.c
+++ b/libXfont/src/fc/fsio.c
@@ -72,7 +72,7 @@ _fs_resize (FSBufPtr buf, long size);
static void
_fs_downsize (FSBufPtr buf, long size);
-
+
int
_fs_poll_connect (XtransConnInfo trans_conn, int timeout)
{
@@ -149,7 +149,7 @@ _fs_fill (FSFpePtr conn)
long avail;
long bytes_read;
Bool waited = FALSE;
-
+
if (_fs_flush (conn) < 0)
return FSIO_ERROR;
/*
@@ -199,7 +199,7 @@ int
_fs_start_read (FSFpePtr conn, long size, char **buf)
{
int ret;
-
+
conn->inNeed = size;
if (fs_inqueued(conn) < size)
{
@@ -245,7 +245,7 @@ _fs_flush (FSFpePtr conn)
{
long bytes_written;
long remain;
-
+
/* XXX - hack. The right fix is to remember that the font server
has gone away when we first discovered it. */
if (conn->fs_fd < 0)
@@ -295,7 +295,7 @@ _fs_resize (FSBufPtr buf, long size)
{
if (buf->remove != buf->insert)
{
- memmove (buf->buf,
+ memmove (buf->buf,
buf->buf + buf->remove,
buf->insert - buf->remove);
}
@@ -345,7 +345,7 @@ _fs_io_init (FSFpePtr conn)
if (!conn->outBuf.buf)
return FALSE;
conn->outBuf.size = FS_BUF_INC;
-
+
conn->inBuf.insert = conn->inBuf.remove = 0;
conn->inBuf.buf = malloc (FS_BUF_INC);
if (!conn->inBuf.buf)
@@ -355,7 +355,7 @@ _fs_io_init (FSFpePtr conn)
return FALSE;
}
conn->inBuf.size = FS_BUF_INC;
-
+
return TRUE;
}
@@ -369,7 +369,7 @@ _fs_io_fini (FSFpePtr conn)
}
static int
-_fs_do_write(FSFpePtr conn, char *data, long len, long size)
+_fs_do_write(FSFpePtr conn, const char *data, long len, long size)
{
if (size == 0) {
#ifdef DEBUG
@@ -380,8 +380,8 @@ _fs_do_write(FSFpePtr conn, char *data, long len, long size)
if (conn->fs_fd == -1)
return FSIO_ERROR;
-
- while (conn->outBuf.insert + size > conn->outBuf.size)
+
+ while (conn->outBuf.insert + size > conn->outBuf.size)
{
if (_fs_flush (conn) < 0)
return FSIO_ERROR;
@@ -403,16 +403,16 @@ _fs_do_write(FSFpePtr conn, char *data, long len, long size)
* Write the indicated bytes
*/
int
-_fs_write (FSFpePtr conn, char *data, long len)
+_fs_write (FSFpePtr conn, const char *data, long len)
{
return _fs_do_write (conn, data, len, len);
}
-
+
/*
* Write the indicated bytes adding any appropriate pad
*/
int
-_fs_write_pad(FSFpePtr conn, char *data, long len)
+_fs_write_pad(FSFpePtr conn, const char *data, long len)
{
return _fs_do_write (conn, data, len, len + padlength[len & 3]);
}
diff --git a/libXfont/src/fc/fsio.h b/libXfont/src/fc/fsio.h
index bd0c621e8..2bb8e0b73 100644
--- a/libXfont/src/fc/fsio.h
+++ b/libXfont/src/fc/fsio.h
@@ -110,9 +110,9 @@ typedef struct _fs_fpe_data {
CARD32 brokenWriteTime; /* time to retry broken write */
CARD32 blockedConnectTime; /* time to abort blocked connect */
CARD32 brokenConnectionTime; /* time to retry broken connection */
-
+
FSBlockDataPtr blockedRequests;
-
+
struct _XtransConnInfo *trans_conn; /* transport connection object */
} FSFpeRec;
@@ -129,8 +129,8 @@ typedef struct _fs_fpe_data {
#define FSIO_ERROR -1
extern Bool _fs_reopen_server ( FSFpePtr conn );
-extern int _fs_write ( FSFpePtr conn, char *data, long size );
-extern int _fs_write_pad ( FSFpePtr conn, char *data, long len );
+extern int _fs_write ( FSFpePtr conn, const char *data, long size );
+extern int _fs_write_pad ( FSFpePtr conn, const char *data, long len );
extern int _fs_wait_for_readable ( FSFpePtr conn, int ms );
extern long _fs_pad_length (long len);
diff --git a/libXfont/src/fontfile/Makefile.in b/libXfont/src/fontfile/Makefile.in
index 5fbb70f9e..710b374de 100644
--- a/libXfont/src/fontfile/Makefile.in
+++ b/libXfont/src/fontfile/Makefile.in
@@ -105,6 +105,7 @@ AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
+BASE_CFLAGS = @BASE_CFLAGS@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
diff --git a/libXfont/src/fontfile/decompress.c b/libXfont/src/fontfile/decompress.c
index c8171dd4a..20971dfb9 100644
--- a/libXfont/src/fontfile/decompress.c
+++ b/libXfont/src/fontfile/decompress.c
@@ -44,7 +44,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.
*/
-/*
+/*
* decompress - cat a compressed file
*/
@@ -93,11 +93,11 @@ static char_type magic_header[] = { "\037\235" }; /* 1F 9D */
/*
* the next two codes should not be changed lightly, as they must not
* lie within the contiguous general code space.
- */
+ */
#define FIRST 257 /* first free entry */
#define CLEAR 256 /* table clear output code */
-#define STACK_SIZE 8192
+#define STACK_SIZE 65300
typedef struct _compressedFILE {
BufFilePtr file;
@@ -124,14 +124,6 @@ typedef struct _compressedFILE {
} CompressedFile;
-static int hsize_table[] = {
- 5003, /* 12 bits - 80% occupancy */
- 9001, /* 13 bits - 91% occupancy */
- 18013, /* 14 bits - 91% occupancy */
- 35023, /* 15 bits - 94% occupancy */
- 69001 /* 16 bits - 95% occupancy */
-};
-
static int BufCompressedClose ( BufFilePtr f, int doClose );
static int BufCompressedFill ( BufFilePtr f );
static code_int getcode ( CompressedFile *file );
@@ -142,7 +134,6 @@ BufFilePushCompressed (BufFilePtr f)
{
int code;
int maxbits;
- int hsize;
CompressedFile *file;
int extra;
@@ -153,13 +144,12 @@ BufFilePushCompressed (BufFilePtr f)
}
code = BufFileGet (f);
if (code == BUFFILEEOF) return 0;
-
+
maxbits = code & BIT_MASK;
- if (maxbits > BITS || maxbits < 12)
+ if (maxbits > BITS || maxbits <= INIT_BITS)
return 0;
- hsize = hsize_table[maxbits - 12];
extra = (1 << maxbits) * sizeof (char_type) +
- hsize * sizeof (unsigned short);
+ (1 << maxbits) * sizeof (unsigned short);
file = malloc (sizeof (CompressedFile) + extra);
if (!file)
return 0;
@@ -178,14 +168,12 @@ BufFilePushCompressed (BufFilePtr f)
file->tab_suffix[code] = (char_type) code;
}
file->free_ent = ((file->block_compress) ? FIRST : 256 );
+ file->oldcode = -1;
file->clear_flg = 0;
file->offset = 0;
file->size = 0;
file->stackp = file->de_stack;
bzero(file->buf, BITS);
- file->finchar = file->oldcode = getcode (file);
- if (file->oldcode != -1)
- *file->stackp++ = file->finchar;
return BufFileCreate ((char *) file,
BufCompressedFill,
0,
@@ -230,51 +218,56 @@ BufCompressedFill (BufFilePtr f)
if (buf == bufend)
break;
- if (oldcode == -1)
- break;
-
code = getcode (file);
if (code == -1)
break;
-
+
if ( (code == CLEAR) && file->block_compress ) {
for ( code = 255; code >= 0; code-- )
file->tab_prefix[code] = 0;
file->clear_flg = 1;
- file->free_ent = FIRST - 1;
- if ( (code = getcode (file)) == -1 ) /* O, untimely death! */
- break;
+ file->free_ent = FIRST;
+ oldcode = -1;
+ continue;
}
incode = code;
/*
* Special case for KwKwK string.
*/
if ( code >= file->free_ent ) {
+ if ( code > file->free_ent || oldcode == -1 ) {
+ /* Bad stream. */
+ return BUFFILEEOF;
+ }
*stackp++ = finchar;
code = oldcode;
}
-
+ /*
+ * The above condition ensures that code < free_ent.
+ * The construction of tab_prefixof in turn guarantees that
+ * each iteration decreases code and therefore stack usage is
+ * bound by 1 << BITS - 256.
+ */
+
/*
* Generate output characters in reverse order
*/
while ( code >= 256 )
{
- if (stackp - de_stack >= STACK_SIZE - 1)
- return BUFFILEEOF;
*stackp++ = file->tab_suffix[code];
code = file->tab_prefix[code];
}
finchar = file->tab_suffix[code];
*stackp++ = finchar;
-
+
/*
* Generate the new entry.
*/
- if ( (code=file->free_ent) < file->maxmaxcode ) {
+ if ( (code=file->free_ent) < file->maxmaxcode && oldcode != -1) {
file->tab_prefix[code] = (unsigned short)oldcode;
file->tab_suffix[code] = finchar;
file->free_ent = code+1;
- }
+ }
/*
* Remember previous code.
*/
@@ -382,7 +375,7 @@ static int
BufCompressedSkip (BufFilePtr f, int bytes)
{
int c;
- while (bytes--)
+ while (bytes--)
{
c = BufFileGet(f);
if (c == BUFFILEEOF)
@@ -397,7 +390,7 @@ main (int argc, char *argv[])
{
BufFilePtr inputraw, input, output;
int c;
-
+
inputraw = BufFileOpenRead (0);
input = BufFilePushCompressed (inputraw);
output = BufFileOpenWrite (1);
diff --git a/libXfont/src/fontfile/fontdir.c b/libXfont/src/fontfile/fontdir.c
index e052bb371..97b2ba3b1 100644
--- a/libXfont/src/fontfile/fontdir.c
+++ b/libXfont/src/fontfile/fontdir.c
@@ -43,7 +43,7 @@ in this Software without prior written authorization from The Open Group.
Bool
FontFileInitTable (FontTablePtr table, int size)
{
- if (size < 0 || (size > INT32_MAX/sizeof(FontEntryRec)))
+ if (size < 0 || (size > INT32_MAX/sizeof(FontEntryRec)))
return FALSE;
if (size)
{
@@ -102,12 +102,12 @@ FontFileFreeTable (FontTablePtr table)
}
FontDirectoryPtr
-FontFileMakeDir(char *dirName, int size)
+FontFileMakeDir(const char *dirName, int size)
{
FontDirectoryPtr dir;
int dirlen;
int needslash = 0;
- char *attrib;
+ const char *attrib;
int attriblen;
#if !defined(WIN32)
@@ -279,7 +279,7 @@ FontFileSortDir(FontDirectoryPtr dir)
#define isDigit(c) (XK_0 <= (c) && (c) <= XK_9)
static int
-SetupWildMatch(FontTablePtr table, FontNamePtr pat,
+SetupWildMatch(FontTablePtr table, FontNamePtr pat,
int *leftp, int *rightp, int *privatep)
{
int nDashes;
@@ -438,7 +438,7 @@ FontFileSaveString (char *s)
}
FontEntryPtr
-FontFileFindNameInScalableDir(FontTablePtr table, FontNamePtr pat,
+FontFileFindNameInScalableDir(FontTablePtr table, FontNamePtr pat,
FontScalablePtr vals)
{
int i,
@@ -491,7 +491,7 @@ FontFileFindNameInDir(FontTablePtr table, FontNamePtr pat)
}
int
-FontFileFindNamesInScalableDir(FontTablePtr table, FontNamePtr pat, int max,
+FontFileFindNamesInScalableDir(FontTablePtr table, FontNamePtr pat, int max,
FontNamesPtr names, FontScalablePtr vals,
int alias_behavior, int *newmax)
{
@@ -578,7 +578,7 @@ FontFileFindNamesInScalableDir(FontTablePtr table, FontNamePtr pat, int max,
}
int
-FontFileFindNamesInDir(FontTablePtr table, FontNamePtr pat,
+FontFileFindNamesInDir(FontTablePtr table, FontNamePtr pat,
int max, FontNamesPtr names)
{
return FontFileFindNamesInScalableDir(table, pat, max, names,
@@ -767,7 +767,7 @@ FontFileAddFontFile (FontDirectoryPtr dir, char *fontName, char *fileName)
extra->defaults.y = 75;
}
}
- else
+ else
{
extra->defaults.x = vals.x;
extra->defaults.y = vals.y;
diff --git a/libXfont/src/stubs/Makefile.in b/libXfont/src/stubs/Makefile.in
index 0079d1095..1ad327af9 100644
--- a/libXfont/src/stubs/Makefile.in
+++ b/libXfont/src/stubs/Makefile.in
@@ -98,6 +98,7 @@ AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
+BASE_CFLAGS = @BASE_CFLAGS@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
@@ -257,7 +258,7 @@ libstubs_la_SOURCES = \
servclient.c \
setfntauth.c \
stfntcfnt.c \
- stubs.h
+ stubs.h
all: all-am
diff --git a/libXfont/src/util/Makefile.in b/libXfont/src/util/Makefile.in
index 5b0d85e40..802d9fb27 100644
--- a/libXfont/src/util/Makefile.in
+++ b/libXfont/src/util/Makefile.in
@@ -97,6 +97,7 @@ AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
+BASE_CFLAGS = @BASE_CFLAGS@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
diff --git a/libXfont/src/util/atom.c b/libXfont/src/util/atom.c
index f15e3d8de..c47cb5c80 100644
--- a/libXfont/src/util/atom.c
+++ b/libXfont/src/util/atom.c
@@ -54,7 +54,7 @@ static int reverseMapSize;
static Atom lastAtom;
static int
-Hash(char *string, int len)
+Hash(const char *string, int len)
{
int h;
@@ -146,8 +146,8 @@ NameEqual (const char *a, const char *b, int l)
#pragma weak MakeAtom
#endif
-weak Atom
-MakeAtom(char *string, unsigned len, int makeit)
+weak Atom
+MakeAtom(const char *string, unsigned len, int makeit)
{
AtomListPtr a;
int hash;
@@ -223,7 +223,7 @@ MakeAtom(char *string, unsigned len, int makeit)
#pragma weak ValidAtom
#endif
-weak int
+weak int
ValidAtom(Atom atom)
{
return (atom != None) && (atom <= lastAtom);
diff --git a/libXfont/src/util/fontxlfd.c b/libXfont/src/util/fontxlfd.c
index 81240376f..974128ee3 100644
--- a/libXfont/src/util/fontxlfd.c
+++ b/libXfont/src/util/fontxlfd.c
@@ -70,7 +70,7 @@ GetInt(char *ptr, int *val)
#ifndef NO_LOCALE
static struct lconv *locale = 0;
#endif
-static char *radix = ".", *plus = "+", *minus = "-";
+static const char *radix = ".", *plus = "+", *minus = "-";
static char *
readreal(char *ptr, double *result)
@@ -116,7 +116,6 @@ readreal(char *ptr, double *result)
static char *
xlfd_double_to_text(double value, char *buffer, int space_required)
{
- char formatbuf[40];
register char *p1;
int ndigits, exponent;
@@ -132,14 +131,12 @@ xlfd_double_to_text(double value, char *buffer, int space_required)
minus = locale->negative_sign;
}
#endif
- /* Compute a format to use to render the number */
- sprintf(formatbuf, "%%.%dle", XLFD_NDIGITS);
if (space_required)
*buffer++ = ' ';
/* Render the number using printf's idea of formatting */
- sprintf(buffer, formatbuf, value);
+ sprintf(buffer, "%.*le", XLFD_NDIGITS, value);
/* Find and read the exponent value */
for (p1 = buffer + strlen(buffer);
@@ -156,16 +153,14 @@ xlfd_double_to_text(double value, char *buffer, int space_required)
if (exponent >= XLFD_NDIGITS || ndigits - exponent > XLFD_NDIGITS + 1)
{
/* Scientific */
- sprintf(formatbuf, "%%.%dle", ndigits - 1);
- sprintf(buffer, formatbuf, value);
+ sprintf(buffer, "%.*le", ndigits - 1, value);
}
else
{
/* Fixed */
ndigits -= exponent + 1;
if (ndigits < 0) ndigits = 0;
- sprintf(formatbuf, "%%.%dlf", ndigits);
- sprintf(buffer, formatbuf, value);
+ sprintf(buffer, "%.*lf", ndigits, value);
if (exponent < 0)
{
p1 = buffer;
@@ -265,10 +260,9 @@ xlfd_round_double(double x)
* If not IEEE 754: Let printf() do it for you.
*/
- char formatbuf[40], buffer[40];
+ char buffer[40];
- sprintf(formatbuf, "%%.%dlg", XLFD_NDIGITS);
- sprintf(buffer, formatbuf, x);
+ sprintf(buffer, "%.*lg", XLFD_NDIGITS, x);
return atof(buffer);
}
}