summaryrefslogtreecommitdiff
path: root/header.c
diff options
context:
space:
mode:
authorAlan Coopersmith <alan.coopersmith@oracle.com>2022-09-10 10:18:20 -0700
committerAlan Coopersmith <alan.coopersmith@oracle.com>2022-09-10 10:18:20 -0700
commit4d54d9ad3a46815792c094fbea82351ed61c66d7 (patch)
tree38fc9ef7a94958d0ef53e3fe732ed9c885df37ce /header.c
parent230df18221211dbbe064c561fa9bcc7ac87c0872 (diff)
Convert sources to standard X.Org code style
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Diffstat (limited to 'header.c')
-rw-r--r--header.c128
1 files changed, 64 insertions, 64 deletions
diff --git a/header.c b/header.c
index 01729a5..32262f3 100644
--- a/header.c
+++ b/header.c
@@ -49,11 +49,10 @@ in this Software without prior written authorization from The Open Group.
#include <string.h>
#include "fstobdf.h"
-unsigned long pointSize;
-unsigned long yResolution;
+unsigned long pointSize;
+unsigned long yResolution;
-static const char *warning[] =
-{
+static const char *warning[] = {
"COMMENT ",
"COMMENT WARNING: This bdf file was generated from a font server using",
"COMMENT fstobdf. The resulting font is subject to the same copyright,",
@@ -66,10 +65,10 @@ static const char *warning[] =
static char *
FindStringProperty(const char *propName,
- unsigned int *propLength,
- FSPropInfo *propInfo,
- FSPropOffset *propOffsets,
- unsigned char *propData)
+ unsigned int *propLength,
+ FSPropInfo *propInfo,
+ FSPropOffset *propOffsets,
+ unsigned char *propData)
{
FSPropOffset *propOffset;
unsigned int length;
@@ -78,24 +77,25 @@ FindStringProperty(const char *propName,
propOffset = &propOffsets[0];
length = (unsigned int) strlen(propName);
for (i = propInfo->num_offsets; i--; propOffset++) {
- if (propOffset->type == PropTypeString) {
+ if (propOffset->type == PropTypeString) {
#ifdef DEBUG
- char pname[256];
+ char pname[256];
- memcpy(pname, propData + propOffset->name.position,
+ memcpy(pname, propData + propOffset->name.position,
propOffset->name.length);
- pname[propOffset->name.length] = '\0';
- fprintf(stderr, "prop name: %s (len %d)\n",
- pname, propOffset->name.length);
+ pname[propOffset->name.length] = '\0';
+ fprintf(stderr, "prop name: %s (len %d)\n",
+ pname, propOffset->name.length);
#endif
- if ((propOffset->name.length == length) &&
- !strncmp((char*)propData + propOffset->name.position, propName, length)) {
- *propLength = propOffset->value.length;
- return (char *)(propData + propOffset->value.position);
- }
- }
+ if ((propOffset->name.length == length) &&
+ !strncmp((char *) propData + propOffset->name.position,
+ propName, length)) {
+ *propLength = propOffset->value.length;
+ return (char *) (propData + propOffset->value.position);
+ }
+ }
}
*propLength = 0;
return (NULL);
@@ -103,10 +103,10 @@ FindStringProperty(const char *propName,
static int
FindNumberProperty(const char *propName,
- unsigned long *propValue,
- FSPropInfo *propInfo,
- FSPropOffset *propOffsets,
- unsigned char *propData)
+ unsigned long *propValue,
+ FSPropInfo *propInfo,
+ FSPropOffset *propOffsets,
+ unsigned char *propData)
{
FSPropOffset *propOffset;
unsigned int i;
@@ -115,14 +115,15 @@ FindNumberProperty(const char *propName,
propOffset = &propOffsets[0];
length = (unsigned int) strlen(propName);
for (i = propInfo->num_offsets; i--; propOffset++) {
- if ((propOffset->type == PropTypeSigned) ||
- (propOffset->type == PropTypeUnsigned)) {
- if ((propOffset->name.length == length) &&
- !strncmp((char*)propData + propOffset->name.position, propName, length)) {
- *propValue = propOffset->value.position;
- return (propOffset->type);
- }
- }
+ if ((propOffset->type == PropTypeSigned) ||
+ (propOffset->type == PropTypeUnsigned)) {
+ if ((propOffset->name.length == length) &&
+ !strncmp((char *) propData + propOffset->name.position,
+ propName, length)) {
+ *propValue = propOffset->value.position;
+ return (propOffset->type);
+ }
+ }
}
return (-1);
}
@@ -133,14 +134,14 @@ FindNumberProperty(const char *propName,
*/
Bool
EmitHeader(FILE *outFile,
- FSXFontInfoHeader *fontHeader,
- FSPropInfo *propInfo,
- FSPropOffset *propOffsets,
- unsigned char *propData)
+ FSXFontInfoHeader *fontHeader,
+ FSPropInfo *propInfo,
+ FSPropOffset *propOffsets,
+ unsigned char *propData)
{
unsigned int len;
- int type;
- char *cp;
+ int type;
+ char *cp;
const char **cpp;
unsigned long xResolution;
@@ -149,27 +150,27 @@ EmitHeader(FILE *outFile,
/*
* find COPYRIGHT message and print it first, followed by warning
*/
- cp = FindStringProperty("COPYRIGHT", &len, propInfo, propOffsets,
- propData);
+ cp = FindStringProperty("COPYRIGHT", &len, propInfo, propOffsets, propData);
if (cp) {
- fprintf(outFile, "COMMENT \nCOMMENT ");
- fwrite(cp, 1, len, outFile);
- fputc('\n', outFile);
+ fprintf(outFile, "COMMENT \nCOMMENT ");
+ fwrite(cp, 1, len, outFile);
+ fputc('\n', outFile);
}
for (cpp = warning; *cpp; cpp++)
- fprintf(outFile, "%s\n", *cpp);
+ fprintf(outFile, "%s\n", *cpp);
/*
* FONT name
*/
cp = FindStringProperty("FONT", &len, propInfo, propOffsets, propData);
if (cp) {
- fprintf(outFile, "FONT ");
- fwrite(cp, 1, len, outFile);
- fputc('\n', outFile);
- } else {
- fprintf(stderr, "unable to find FONT property\n");
- return (False);
+ fprintf(outFile, "FONT ");
+ fwrite(cp, 1, len, outFile);
+ fputc('\n', outFile);
+ }
+ else {
+ fprintf(stderr, "unable to find FONT property\n");
+ return (False);
}
/*
@@ -178,34 +179,33 @@ EmitHeader(FILE *outFile,
* Get XLFD values if possible, else fake it
*/
type = FindNumberProperty("RESOLUTION_X", &xResolution, propInfo,
- propOffsets, propData);
+ propOffsets, propData);
if ((type != PropTypeUnsigned) && (type != PropTypeSigned))
- xResolution = 72;
+ xResolution = 72;
type = FindNumberProperty("RESOLUTION_Y", &yResolution, propInfo,
- propOffsets, propData);
+ propOffsets, propData);
if ((type != PropTypeUnsigned) && (type != PropTypeSigned))
- yResolution = 72;
+ yResolution = 72;
type = FindNumberProperty("POINT_SIZE", &pointSize, propInfo,
- propOffsets, propData);
+ propOffsets, propData);
if ((type == PropTypeUnsigned) || (type == PropTypeSigned))
- pointSize = (pointSize + 5) / 10;
+ pointSize = (pointSize + 5) / 10;
else
- pointSize = ((fontHeader->font_ascent + fontHeader->font_descent)
- * 72) / yResolution;
+ pointSize = ((fontHeader->font_ascent + fontHeader->font_descent)
+ * 72) / yResolution;
- fprintf(outFile, "SIZE %lu %lu %lu\n", pointSize, xResolution,
- yResolution);
+ fprintf(outFile, "SIZE %lu %lu %lu\n", pointSize, xResolution, yResolution);
/*
* FONTBOUNDINGBOX width height xoff yoff
*
*/
fprintf(outFile, "FONTBOUNDINGBOX %d %d %d %d\n",
- fontHeader->max_bounds.right - fontHeader->min_bounds.left,
- fontHeader->max_bounds.ascent + fontHeader->max_bounds.descent,
- fontHeader->min_bounds.left,
- -fontHeader->max_bounds.descent);
+ fontHeader->max_bounds.right - fontHeader->min_bounds.left,
+ fontHeader->max_bounds.ascent + fontHeader->max_bounds.descent,
+ fontHeader->min_bounds.left,
+ -fontHeader->max_bounds.descent);
return (True);
}