diff options
author | Alan Coopersmith <alan.coopersmith@oracle.com> | 2022-09-10 10:18:20 -0700 |
---|---|---|
committer | Alan Coopersmith <alan.coopersmith@oracle.com> | 2022-09-10 10:18:20 -0700 |
commit | 4d54d9ad3a46815792c094fbea82351ed61c66d7 (patch) | |
tree | 38fc9ef7a94958d0ef53e3fe732ed9c885df37ce /chars.c | |
parent | 230df18221211dbbe064c561fa9bcc7ac87c0872 (diff) |
Convert sources to standard X.Org code style
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Diffstat (limited to 'chars.c')
-rw-r--r-- | chars.c | 126 |
1 files changed, 61 insertions, 65 deletions
@@ -67,16 +67,15 @@ in this Software without prior written authorization from The Open Group. :(nBytes) == 8 ? ((((bits) + 63) >> 3) & ~7) /* pad to 8 bytes */\ : 0) - static void EmitBitmap(FILE *outFile, - FSXFontInfoHeader *fontHeader, - FSXCharInfo *charInfo, - unsigned int encoding, - int bpr, - unsigned char *data) + FSXFontInfoHeader *fontHeader, + FSXCharInfo *charInfo, + unsigned int encoding, + int bpr, + unsigned char *data) { - char *glyphName; + char *glyphName; unsigned int row; /*- @@ -98,65 +97,62 @@ EmitBitmap(FILE *outFile, fprintf(outFile, "STARTCHAR "); glyphName = XKeysymToString((KeySym) encoding); if (glyphName) - fputs(glyphName, outFile); + fputs(glyphName, outFile); else - fprintf(outFile, (fontHeader->char_range.min_char.low > 0 ? - "C%06o" : "C%03o"), encoding); + fprintf(outFile, (fontHeader->char_range.min_char.low > 0 ? + "C%06o" : "C%03o"), encoding); fputc('\n', outFile); fprintf(outFile, "ENCODING %u\n", encoding); fprintf(outFile, "SWIDTH %ld 0\n", - (((long) charInfo->width) * 72000L) / - (pointSize * yResolution)); + (((long) charInfo->width) * 72000L) / (pointSize * yResolution)); fprintf(outFile, "DWIDTH %d 0\n", charInfo->width); fprintf(outFile, "BBX %d %d %d %d\n", - charInfo->right - charInfo->left, - charInfo->ascent + charInfo->descent, - charInfo->left, - -charInfo->descent); + charInfo->right - charInfo->left, + charInfo->ascent + charInfo->descent, + charInfo->left, + -charInfo->descent); if (charInfo->attributes) - fprintf(outFile, "ATTRIBUTES %04x\n", charInfo->attributes); + fprintf(outFile, "ATTRIBUTES %04x\n", charInfo->attributes); /* * emit the bitmap */ fprintf(outFile, "BITMAP\n"); for (row = 0; row < (charInfo->ascent + charInfo->descent); row++) { - unsigned byte; - unsigned bit; - - static unsigned maskTab[] = - { - (1 << 7), (1 << 6), (1 << 5), (1 << 4), - (1 << 3), (1 << 2), (1 << 1), (1 << 0), - }; - - byte = 0; - for (bit = 0; bit < (charInfo->right - charInfo->left); bit++) { - byte |= maskTab[bit & 7] & data[bit >> 3]; - if ((bit & 7) == 7) { - fprintf(outFile, "%02x", byte); - byte = 0; - } - } - if ((bit & 7) != 0) - fprintf(outFile, "%02x", byte); - fputc('\n', outFile); - data += bpr; + unsigned byte; + unsigned bit; + + static unsigned maskTab[] = { + (1 << 7), (1 << 6), (1 << 5), (1 << 4), + (1 << 3), (1 << 2), (1 << 1), (1 << 0), + }; + + byte = 0; + for (bit = 0; bit < (charInfo->right - charInfo->left); bit++) { + byte |= maskTab[bit & 7] & data[bit >> 3]; + if ((bit & 7) == 7) { + fprintf(outFile, "%02x", byte); + byte = 0; + } + } + if ((bit & 7) != 0) + fprintf(outFile, "%02x", byte); + fputc('\n', outFile); + data += bpr; } fprintf(outFile, "ENDCHAR\n"); } - Bool EmitCharacters(FILE *outFile, - FSServer *fontServer, - FSXFontInfoHeader *fontHeader, - Font fontID) + FSServer *fontServer, + FSXFontInfoHeader *fontHeader, + Font fontID) { FSXCharInfo *extents; FSXCharInfo *charInfo; unsigned int encoding; - FSOffset *offsets; + FSOffset *offsets; unsigned char *glyph; unsigned char *glyphs; unsigned int nChars; @@ -170,26 +166,25 @@ EmitCharacters(FILE *outFile, nChars = 0; - format = BYTE_ORDER | BIT_ORDER | SCANLINE_UNIT | - SCANLINE_PAD | EXTENTS; + format = BYTE_ORDER | BIT_ORDER | SCANLINE_UNIT | SCANLINE_PAD | EXTENTS; 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); + &extents); (void) FSQueryXBitmaps16(fontServer, fontID, format, True, (FSChar2b *) 0, - 0, &offsets, &glyphs); + 0, &offsets, &glyphs); charInfo = extents; /* calculate the actual number of chars */ - for (chHigh = 0; chHigh <= (lastCharHigh-firstCharHigh); chHigh++) { - for (chLow = 0; chLow <= (lastCharLow-firstCharLow); chLow++) { - if ((charInfo->width != 0) || (charInfo->left != charInfo->right)) - nChars++; - charInfo++; - } + 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); @@ -200,18 +195,19 @@ EmitCharacters(FILE *outFile, charInfo = extents; glyph = glyphs; 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 = glyphs + - offsets[encoding-((firstCharHigh << 8)+firstCharLow) + 1].position; - charInfo++; - } + 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 = glyphs + + offsets[encoding - ((firstCharHigh << 8) + firstCharLow) + + 1].position; + charInfo++; + } } FSFree((char *) extents); FSFree((char *) glyphs); |