From 6f1b843c87395c617f48793607797face574a188 Mon Sep 17 00:00:00 2001 From: Kaleb Keithley Date: Fri, 14 Nov 2003 16:48:57 +0000 Subject: XFree86 4.3.0.1 --- chars.c | 61 +++++++++++++++++++++++++++++++++++-------------------------- fstobdf.c | 34 +++++++++++++++------------------- fstobdf.man | 5 ++++- header.c | 50 ++++++++++++++++++++++++++------------------------ props.c | 23 +++++++++++------------ 5 files changed, 91 insertions(+), 82 deletions(-) diff --git a/chars.c b/chars.c index a0b0d26..5c7cf81 100644 --- a/chars.c +++ b/chars.c @@ -43,15 +43,21 @@ in this Software without prior written authorization from The Open Group. * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF * THIS SOFTWARE. */ +/* $XFree86: xc/programs/fstobdf/chars.c,v 3.8 2001/12/14 20:00:45 dawes Exp $ */ + +/* Morten Storgaard Nielsen: chars.c,v 3.2-1 2000/01/30 14:11:19 kat Exp */ #include #include -#include "FSlib.h" +#include "fstobdf.h" extern long yResolution; /* intended vertical resoultion for font */ extern long pointSize; /* font height in points */ #define BIT_ORDER BitmapFormatBitOrderMSB +#ifdef BYTE_ORDER +#undef BYTE_ORDER +#endif #define BYTE_ORDER BitmapFormatByteOrderMSB #define SCANLINE_UNIT BitmapFormatScanlineUnit8 #define SCANLINE_PAD BitmapFormatScanlinePad8 @@ -68,13 +74,12 @@ extern long pointSize; /* font height in points */ static void -EmitBitmap(outFile, fontHeader, charInfo, encoding, bpr, data) - FILE *outFile; - FSXFontInfoHeader *fontHeader; - FSXCharInfo *charInfo; - unsigned int encoding; - int bpr; - unsigned char *data; +EmitBitmap(FILE *outFile, + FSXFontInfoHeader *fontHeader, + FSXCharInfo *charInfo, + unsigned int encoding, + int bpr, + unsigned char *data) { char *glyphName; unsigned int row; @@ -114,7 +119,7 @@ EmitBitmap(outFile, fontHeader, charInfo, encoding, bpr, data) charInfo->left, -charInfo->descent); if (charInfo->attributes) - fprintf(outFile, "ATTRIBUTES 0x%04x\n", charInfo->attributes); + fprintf(outFile, "ATTRIBUTES %04x\n", charInfo->attributes); /* * emit the bitmap @@ -148,11 +153,10 @@ EmitBitmap(outFile, fontHeader, charInfo, encoding, bpr, data) Bool -EmitCharacters(outFile, fontServer, fontHeader, fontID) - FILE *outFile; - FSServer *fontServer; - FSXFontInfoHeader *fontHeader; - Font fontID; +EmitCharacters(FILE *outFile, + FSServer *fontServer, + FSXFontInfoHeader *fontHeader, + Font fontID) { FSXCharInfo *extents; FSXCharInfo *charInfo; @@ -161,19 +165,22 @@ EmitCharacters(outFile, fontServer, fontHeader, fontID) unsigned char *glyph; unsigned char *glyphs; unsigned int nChars; - int firstChar; - int lastChar; - int ch; + int firstCharLow; + int firstCharHigh; + int lastCharLow; + int lastCharHigh; + int chLow; + int chHigh; FSBitmapFormat format; nChars = 0; format = BYTE_ORDER | BIT_ORDER | SCANLINE_UNIT | SCANLINE_PAD | EXTENTS; - firstChar = (fontHeader->char_range.min_char.high << 8) - + fontHeader->char_range.min_char.low; - lastChar = (fontHeader->char_range.max_char.high << 8) - + fontHeader->char_range.max_char.low; + firstCharLow = fontHeader->char_range.min_char.low; + firstCharHigh = fontHeader->char_range.min_char.high; + lastCharLow = fontHeader->char_range.max_char.low; + lastCharHigh = fontHeader->char_range.max_char.high; (void) FSQueryXExtents16(fontServer, fontID, True, (FSChar2b *) 0, 0, &extents); @@ -182,10 +189,12 @@ EmitCharacters(outFile, fontServer, fontHeader, fontID) charInfo = extents; /* calculate the actual number of chars */ - for (ch = 0; ch <= (lastChar - firstChar); ch++) { + for (chHigh = 0; chHigh <= (lastCharHigh-firstCharHigh); chHigh++) { + for (chLow = 0; chLow <= (lastCharLow-firstCharLow); chLow++) { if ((charInfo->width != 0) || (charInfo->left != charInfo->right)) nChars++; charInfo++; + } } fprintf(outFile, "CHARS %u\n", nChars); @@ -194,19 +203,19 @@ EmitCharacters(outFile, fontServer, fontHeader, fontID) * actually emit the characters */ charInfo = extents; - encoding = firstChar; glyph = glyphs; - for (ch = 0; ch <= (lastChar - firstChar); ch++) { + for (chHigh = firstCharHigh; chHigh <= lastCharHigh; chHigh++) { + for (chLow = firstCharLow; chLow <= lastCharLow; chLow++) { int bpr; bpr = GLWIDTHBYTESPADDED((charInfo->right - charInfo->left), SCANLINE_PAD_BYTES); + encoding=(chHigh << 8)+chLow; if ((charInfo->width != 0) || (charInfo->right != charInfo->left)) EmitBitmap(outFile, fontHeader, charInfo, encoding, bpr, glyph); glyph += (charInfo->descent + charInfo->ascent) * bpr; - charInfo++; - encoding++; + } } FSFree((char *) extents); FSFree((char *) glyphs); diff --git a/fstobdf.c b/fstobdf.c index 48d560a..bc300fa 100644 --- a/fstobdf.c +++ b/fstobdf.c @@ -43,27 +43,29 @@ in this Software without prior written authorization from The Open Group. * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF * THIS SOFTWARE. */ +/* $XFree86: xc/programs/fstobdf/fstobdf.c,v 1.6 2001/12/14 20:00:46 dawes Exp $ */ #include -#include "FSlib.h" - -extern Bool EmitHeader(); -extern Bool EmitProperties(); -extern Bool EmitCharacters(); -extern Bool EmitTrailer(); - +#include +#include +#include "fstobdf.h" static void -usage(progName) - char *progName; +usage(char *progName) { fprintf(stderr, "Usage: %s [-s ] -fn \n", progName); exit(0); } -main(argc, argv) - int argc; - char **argv; +static void +Fail(char *progName) +{ + fprintf(stderr, "%s: unable to dump font\n", progName); + exit(1); +} + +int +main(int argc, char *argv[]) { FSServer *fontServer; Font fontID, @@ -126,11 +128,5 @@ main(argc, argv) FSFree((char *) propOffsets); FSFree((char *) propData); -} - -Fail(progName) - char *progName; -{ - fprintf(stderr, "%s: unable to dump font\n", progName); - exit(1); + exit (0); } diff --git a/fstobdf.man b/fstobdf.man index 06129fb..8e40bf2 100644 --- a/fstobdf.man +++ b/fstobdf.man @@ -23,7 +23,10 @@ .\" not be used in advertising or otherwise to promote the sale, use or .\" other dealings in this Software without prior written authorization .\" from The Open Group. -.TH FSTOBDF 1 "Release 6.4" "X Version 11" +.\" +.\" $XFree86: xc/programs/fstobdf/fstobdf.man,v 1.7 2001/12/14 20:00:46 dawes Exp $ +.\" +.TH FSTOBDF 1 __xorgversion__ .SH NAME fstobdf \- generate BDF font from X font server .SH SYNOPSIS diff --git a/header.c b/header.c index 2d99839..291ba01 100644 --- a/header.c +++ b/header.c @@ -43,12 +43,16 @@ in this Software without prior written authorization from The Open Group. * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF * THIS SOFTWARE. */ +/* $XFree86: xc/programs/fstobdf/header.c,v 3.7 2001/12/14 20:00:46 dawes Exp $ */ #include -#include "FSlib.h" +#include +#include +#include +#include "fstobdf.h" -long pointSize; -long yResolution; +unsigned long pointSize; +unsigned long yResolution; static char *warning[] = { @@ -63,12 +67,11 @@ static char *warning[] = }; static char * -FindStringProperty(propName, propLength, propInfo, propOffsets, propData) - char *propName; - int *propLength; - FSPropInfo *propInfo; - FSPropOffset *propOffsets; - unsigned char *propData; +FindStringProperty(char *propName, + int *propLength, + FSPropInfo *propInfo, + FSPropOffset *propOffsets, + unsigned char *propData) { FSPropOffset *propOffset; int length; @@ -90,7 +93,7 @@ FindStringProperty(propName, propLength, propInfo, propOffsets, propData) #endif if ((propOffset->name.length == length) && - !strncmp(propData + propOffset->name.position, propName, length)) { + !strncmp((char*)propData + propOffset->name.position, propName, length)) { *propLength = propOffset->value.length; return (char *)(propData + propOffset->value.position); } @@ -101,12 +104,11 @@ FindStringProperty(propName, propLength, propInfo, propOffsets, propData) } static int -FindNumberProperty(propName, propValue, propInfo, propOffsets, propData) - char *propName; - int *propValue; - FSPropInfo *propInfo; - FSPropOffset *propOffsets; - unsigned char *propData; +FindNumberProperty(char *propName, + unsigned long *propValue, + FSPropInfo *propInfo, + FSPropOffset *propOffsets, + unsigned char *propData) { FSPropOffset *propOffset; int i; @@ -118,7 +120,7 @@ FindNumberProperty(propName, propValue, propInfo, propOffsets, propData) if ((propOffset->type == PropTypeSigned) || (propOffset->type == PropTypeUnsigned)) { if ((propOffset->name.length == length) && - !strncmp(propData + propOffset->name.position, propName, length)) { + !strncmp((char*)propData + propOffset->name.position, propName, length)) { *propValue = propOffset->value.position; return (propOffset->type); } @@ -132,12 +134,11 @@ FindNumberProperty(propName, propValue, propInfo, propOffsets, propData) * FONTBOUNDINGBOX lines */ Bool -EmitHeader(outFile, fontHeader, propInfo, propOffsets, propData) - FILE *outFile; - FSXFontInfoHeader *fontHeader; - FSPropInfo *propInfo; - FSPropOffset *propOffsets; - unsigned char *propData; +EmitHeader(FILE *outFile, + FSXFontInfoHeader *fontHeader, + FSPropInfo *propInfo, + FSPropOffset *propOffsets, + unsigned char *propData) { int len; int type; @@ -196,7 +197,8 @@ EmitHeader(outFile, fontHeader, propInfo, propOffsets, propData) pointSize = ((fontHeader->font_ascent + fontHeader->font_descent) * 72) / yResolution; - fprintf(outFile, "SIZE %d %d %d\n", pointSize, xResolution, yResolution); + fprintf(outFile, "SIZE %lu %lu %lu\n", pointSize, xResolution, + yResolution); /* * FONTBOUNDINGBOX width height xoff yoff diff --git a/props.c b/props.c index eaeb47f..d3dc92a 100644 --- a/props.c +++ b/props.c @@ -43,14 +43,14 @@ in this Software without prior written authorization from The Open Group. * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF * THIS SOFTWARE. */ +/* $XFree86: xc/programs/fstobdf/props.c,v 1.6 2001/12/14 20:00:46 dawes Exp $ */ #include -#include "FSlib.h" +#include +#include "fstobdf.h" static char * -AddQuotes(string, length) - unsigned char *string; - int length; +AddQuotes(unsigned char *string, int length) { static unsigned char new[256] = "\""; unsigned char *cp; @@ -68,12 +68,11 @@ AddQuotes(string, length) } Bool -EmitProperties(outFile, fontHeader, propInfo, propOffsets, propData) - FILE *outFile; - FSXFontInfoHeader *fontHeader; - FSPropInfo *propInfo; - FSPropOffset *propOffsets; - unsigned char *propData; +EmitProperties(FILE *outFile, + FSXFontInfoHeader *fontHeader, + FSPropInfo *propInfo, + FSPropOffset *propOffsets, + unsigned char *propData) { int nProperties; FSPropOffset *property; @@ -87,10 +86,10 @@ EmitProperties(outFile, fontHeader, propInfo, propOffsets, propData) nProperties = propInfo->num_offsets; for (property = &propOffsets[0]; nProperties--; property++) { - unsigned char *name; + char *name; int length; - name = propData + property->name.position; + name = (char *)propData + property->name.position; length = property->name.length; if ((length == 12) && (!strncmp(name, "DEFAULT_CHAR", 12))) -- cgit v1.2.3