summaryrefslogtreecommitdiff
path: root/bitmap.c
diff options
context:
space:
mode:
authorAlan Coopersmith <alan.coopersmith@oracle.com>2022-09-16 13:17:52 -0700
committerAlan Coopersmith <alan.coopersmith@oracle.com>2022-09-16 13:17:52 -0700
commit1b66daf529d60196422ba71e77bb95ce74277447 (patch)
treedd3e25a3c7101885fe2ff9a55b277bc6374e99a8 /bitmap.c
parent65861022b037b0262529c1e1eedecd0e00afb02d (diff)
Adopt X.Org standard coding style (via x-indent-all.sh)
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Diffstat (limited to 'bitmap.c')
-rw-r--r--bitmap.c151
1 files changed, 78 insertions, 73 deletions
diff --git a/bitmap.c b/bitmap.c
index 7aaeba8..4b2bf3c 100644
--- a/bitmap.c
+++ b/bitmap.c
@@ -37,11 +37,11 @@ in this Software without prior written authorization from The Open Group.
int
bitmapGetGlyphs(FontPtr pFont, unsigned long count, unsigned char *chars,
- FontEncoding charEncoding,
- unsigned long *glyphCount, /* RETURN */
- CharInfoPtr *glyphs) /* RETURN */
+ FontEncoding charEncoding,
+ unsigned long *glyphCount, /* RETURN */
+ CharInfoPtr * glyphs) /* RETURN */
{
- BitmapFontPtr bitmapFont;
+ BitmapFontPtr bitmapFont;
unsigned int firstCol;
register unsigned int numCols;
unsigned int firstRow;
@@ -63,65 +63,67 @@ bitmapGetGlyphs(FontPtr pFont, unsigned long count, unsigned char *chars,
case Linear8Bit:
case TwoD8Bit:
- if (pFont->info.firstRow > 0) {
+ if (pFont->info.firstRow > 0) {
if (pDefault)
while (count--)
*glyphs++ = pDefault;
- break;
+ break;
}
- if (pFont->info.allExist && pDefault) {
- while (count--) {
- c = (*chars++) - firstCol;
- if (c < numCols)
- *glyphs++ = ACCESSENCODING(encoding,c);
- else
- *glyphs++ = pDefault;
- }
- } else {
- while (count--) {
- c = (*chars++) - firstCol;
- if (c < numCols && (pci = ACCESSENCODING(encoding,c)))
- *glyphs++ = pci;
- else if (pDefault)
- *glyphs++ = pDefault;
- }
- }
- break;
+ if (pFont->info.allExist && pDefault) {
+ while (count--) {
+ c = (*chars++) - firstCol;
+ if (c < numCols)
+ *glyphs++ = ACCESSENCODING(encoding, c);
+ else
+ *glyphs++ = pDefault;
+ }
+ }
+ else {
+ while (count--) {
+ c = (*chars++) - firstCol;
+ if (c < numCols && (pci = ACCESSENCODING(encoding, c)))
+ *glyphs++ = pci;
+ else if (pDefault)
+ *glyphs++ = pDefault;
+ }
+ }
+ break;
case Linear16Bit:
- if (pFont->info.allExist && pDefault) {
- while (count--) {
- c = *chars++ << 8;
- c = (c | *chars++) - firstCol;
- if (c < numCols)
- *glyphs++ = ACCESSENCODING(encoding,c);
- else
- *glyphs++ = pDefault;
- }
- } else {
- while (count--) {
- c = *chars++ << 8;
- c = (c | *chars++) - firstCol;
- if (c < numCols && (pci = ACCESSENCODING(encoding,c)))
- *glyphs++ = pci;
- else if (pDefault)
- *glyphs++ = pDefault;
- }
- }
- break;
+ if (pFont->info.allExist && pDefault) {
+ while (count--) {
+ c = *chars++ << 8;
+ c = (c | *chars++) - firstCol;
+ if (c < numCols)
+ *glyphs++ = ACCESSENCODING(encoding, c);
+ else
+ *glyphs++ = pDefault;
+ }
+ }
+ else {
+ while (count--) {
+ c = *chars++ << 8;
+ c = (c | *chars++) - firstCol;
+ if (c < numCols && (pci = ACCESSENCODING(encoding, c)))
+ *glyphs++ = pci;
+ else if (pDefault)
+ *glyphs++ = pDefault;
+ }
+ }
+ break;
case TwoD16Bit:
- firstRow = pFont->info.firstRow;
- numRows = pFont->info.lastRow - firstRow + 1;
- while (count--) {
- r = (*chars++) - firstRow;
- c = (*chars++) - firstCol;
- if (r < numRows && c < numCols &&
- (pci = ACCESSENCODING(encoding, r * numCols + c)))
- *glyphs++ = pci;
- else if (pDefault)
- *glyphs++ = pDefault;
- }
- break;
+ firstRow = pFont->info.firstRow;
+ numRows = pFont->info.lastRow - firstRow + 1;
+ while (count--) {
+ r = (*chars++) - firstRow;
+ c = (*chars++) - firstCol;
+ if (r < numRows && c < numCols &&
+ (pci = ACCESSENCODING(encoding, r * numCols + c)))
+ *glyphs++ = pci;
+ else if (pDefault)
+ *glyphs++ = pDefault;
+ }
+ break;
}
*glyphCount = glyphs - glyphsBase;
return Successful;
@@ -131,30 +133,33 @@ static CharInfoRec nonExistantChar;
int
bitmapGetMetrics(FontPtr pFont, unsigned long count, unsigned char *chars,
- FontEncoding charEncoding,
- unsigned long *glyphCount, /* RETURN */
- xCharInfo **glyphs) /* RETURN */
+ FontEncoding charEncoding,
+ unsigned long *glyphCount, /* RETURN */
+ xCharInfo ** glyphs) /* RETURN */
{
- int ret;
- xCharInfo *ink_metrics;
+ int ret;
+ xCharInfo *ink_metrics;
CharInfoPtr metrics;
- BitmapFontPtr bitmapFont;
- CharInfoPtr oldDefault;
- int i;
+ BitmapFontPtr bitmapFont;
+ CharInfoPtr oldDefault;
+ int i;
bitmapFont = (BitmapFontPtr) pFont->fontPrivate;
oldDefault = bitmapFont->pDefault;
bitmapFont->pDefault = &nonExistantChar;
- ret = bitmapGetGlyphs(pFont, count, chars, charEncoding, glyphCount, (CharInfoPtr *) glyphs);
+ ret =
+ bitmapGetGlyphs(pFont, count, chars, charEncoding, glyphCount,
+ (CharInfoPtr *) glyphs);
if (ret == Successful) {
- if (bitmapFont->ink_metrics) {
- metrics = bitmapFont->metrics;
- ink_metrics = bitmapFont->ink_metrics;
- for (i = 0; i < *glyphCount; i++) {
- if (glyphs[i] != (xCharInfo *) & nonExistantChar)
- glyphs[i] = ink_metrics + (((CharInfoPtr) glyphs[i]) - metrics);
- }
- }
+ if (bitmapFont->ink_metrics) {
+ metrics = bitmapFont->metrics;
+ ink_metrics = bitmapFont->ink_metrics;
+ for (i = 0; i < *glyphCount; i++) {
+ if (glyphs[i] != (xCharInfo *) & nonExistantChar)
+ glyphs[i] =
+ ink_metrics + (((CharInfoPtr) glyphs[i]) - metrics);
+ }
+ }
}
bitmapFont->pDefault = oldDefault;
return ret;