Lines Matching +defs:file +defs:offsets
69 #define IS_EOF(file) ((file)->eof == BUFFILEEOF)
74 pcfGetLSB32(FontFilePtr file)
78 c = FontFileGetc(file);
79 c |= FontFileGetc(file) << 8;
80 c |= FontFileGetc(file) << 16;
81 c |= FontFileGetc(file) << 24;
87 pcfGetINT32(FontFilePtr file, CARD32 format)
92 c = FontFileGetc(file) << 24;
93 c |= FontFileGetc(file) << 16;
94 c |= FontFileGetc(file) << 8;
95 c |= FontFileGetc(file);
97 c = FontFileGetc(file);
98 c |= FontFileGetc(file) << 8;
99 c |= FontFileGetc(file) << 16;
100 c |= FontFileGetc(file) << 24;
107 pcfGetINT16(FontFilePtr file, CARD32 format)
112 c = FontFileGetc(file) << 8;
113 c |= FontFileGetc(file);
115 c = FontFileGetc(file);
116 c |= FontFileGetc(file) << 8;
122 #define pcfGetINT8(file, format) (position++, FontFileGetc(file))
125 pcfReadTOC(FontFilePtr file, int *countp)
133 version = pcfGetLSB32(file);
136 count = pcfGetLSB32(file);
137 if (IS_EOF(file)) return (PCFTablePtr) NULL;
139 pcfError("pcfReadTOC(): invalid file format\n");
149 tables[i].type = pcfGetLSB32(file);
150 tables[i].format = pcfGetLSB32(file);
151 tables[i].size = pcfGetLSB32(file);
152 tables[i].offset = pcfGetLSB32(file);
153 if (IS_EOF(file)) goto Bail;
172 pcfGetMetric(FontFilePtr file, CARD32 format, xCharInfo *metric)
174 metric->leftSideBearing = pcfGetINT16(file, format);
175 metric->rightSideBearing = pcfGetINT16(file, format);
176 metric->characterWidth = pcfGetINT16(file, format);
177 metric->ascent = pcfGetINT16(file, format);
178 metric->descent = pcfGetINT16(file, format);
179 metric->attributes = pcfGetINT16(file, format);
180 if (IS_EOF(file)) return FALSE;
186 pcfGetCompressedMetric(FontFilePtr file, CARD32 format, xCharInfo *metric)
188 metric->leftSideBearing = pcfGetINT8(file, format) - 0x80;
189 metric->rightSideBearing = pcfGetINT8(file, format) - 0x80;
190 metric->characterWidth = pcfGetINT8(file, format) - 0x80;
191 metric->ascent = pcfGetINT8(file, format) - 0x80;
192 metric->descent = pcfGetINT8(file, format) - 0x80;
194 if (IS_EOF(file)) return FALSE;
200 * Position the file to the beginning of the specified table
201 * in the font file
204 pcfSeekToType(FontFilePtr file, PCFTablePtr tables, int ntables,
213 if (!FontFileSkip(file, tables[i].offset - position))
237 * Reads the font properties from the font file, filling in the FontInfo rec
242 pcfGetProperties(FontInfoPtr pFontInfo, FontFilePtr file,
256 if (!pcfSeekToType(file, tables, ntables, PCF_PROPERTIES, &format, &size))
258 format = pcfGetLSB32(file);
261 nprops = pcfGetINT32(file, format);
266 if (IS_EOF(file)) goto Bail;
280 props[i].name = pcfGetINT32(file, format);
281 isStringProp[i] = pcfGetINT8(file, format);
282 props[i].value = pcfGetINT32(file, format);
286 pcfError("pcfGetProperties(): invalid file format %ld %d %ld\n",
290 if (IS_EOF(file)) goto Bail;
300 (void)FontFileSkip(file, i);
303 if (IS_EOF(file)) goto Bail;
304 string_size = pcfGetINT32(file, format);
306 if (IS_EOF(file)) goto Bail;
312 FontFileRead(file, strings, string_size);
313 if (IS_EOF(file)) goto Bail;
346 * Fill in the accelerator information from the font file; used
351 pcfGetAccel(FontInfoPtr pFontInfo, FontFilePtr file,
357 if (!pcfSeekToType(file, tables, ntables, type, &format, &size) ||
358 IS_EOF(file))
360 format = pcfGetLSB32(file);
366 pFontInfo->noOverlap = pcfGetINT8(file, format);
367 pFontInfo->constantMetrics = pcfGetINT8(file, format);
368 pFontInfo->terminalFont = pcfGetINT8(file, format);
369 pFontInfo->constantWidth = pcfGetINT8(file, format);
370 pFontInfo->inkInside = pcfGetINT8(file, format);
371 pFontInfo->inkMetrics = pcfGetINT8(file, format);
372 pFontInfo->drawDirection = pcfGetINT8(file, format);
375 /* natural alignment */ pcfGetINT8(file, format);
376 pFontInfo->fontAscent = pcfGetINT32(file, format);
377 pFontInfo->fontDescent = pcfGetINT32(file, format);
378 pFontInfo->maxOverlap = pcfGetINT32(file, format);
379 if (IS_EOF(file)) goto Bail;
380 if (!pcfGetMetric(file, format, &pFontInfo->minbounds))
382 if (!pcfGetMetric(file, format, &pFontInfo->maxbounds))
385 if (!pcfGetMetric(file, format, &pFontInfo->ink_minbounds))
387 if (!pcfGetMetric(file, format, &pFontInfo->ink_maxbounds))
399 pcfReadFont(FontPtr pFont, FontFilePtr file,
419 CARD32 *offsets = 0;
426 if (!(tables = pcfReadTOC(file, &ntables)))
431 if (!pcfGetProperties(&pFont->info, file, tables, ntables))
434 /* Use the old accelerators if no BDF accelerators are in the file */
438 if (!pcfGetAccel (&pFont->info, file, tables, ntables, PCF_ACCELERATORS))
443 if (!pcfSeekToType(file, tables, ntables, PCF_METRICS, &format, &size)) {
446 format = pcfGetLSB32(file);
452 nmetrics = pcfGetINT32(file, format);
454 nmetrics = pcfGetINT16(file, format);
455 if (IS_EOF(file)) goto Bail;
457 pcfError("pcfReadFont(): invalid file format\n");
468 if (!pcfGetMetric(file, format, &(metrics + i)->metrics))
471 if (!pcfGetCompressedMetric(file, format, &(metrics + i)->metrics))
477 if (!pcfSeekToType(file, tables, ntables, PCF_BITMAPS, &format, &size))
479 format = pcfGetLSB32(file);
483 nbitmaps = pcfGetINT32(file, format);
484 if (nbitmaps != nmetrics || IS_EOF(file))
487 offsets = mallocarray(nbitmaps, sizeof(CARD32));
488 if (!offsets) {
489 pcfError("pcfReadFont(): Couldn't allocate offsets (%d*%d)\n",
494 offsets[i] = pcfGetINT32(file, format);
495 if (IS_EOF(file)) goto Bail;
499 bitmapSizes[i] = pcfGetINT32(file, format);
500 if (IS_EOF(file)) goto Bail;
510 FontFileRead(file, bitmaps, sizebitmaps);
511 if (IS_EOF(file)) goto Bail;
543 old = offsets[i];
545 offsets[i] = new;
555 metrics[i].bits = bitmaps + offsets[i];
557 free(offsets);
558 offsets = NULL;
563 if (pcfSeekToType(file, tables, ntables, PCF_INK_METRICS, &format, &size)) {
564 format = pcfGetLSB32(file);
570 nink_metrics = pcfGetINT32(file, format);
572 nink_metrics = pcfGetINT16(file, format);
573 if (IS_EOF(file)) goto Bail;
585 if (!pcfGetMetric(file, format, ink_metrics + i))
588 if (!pcfGetCompressedMetric(file, format, ink_metrics + i))
595 if (!pcfSeekToType(file, tables, ntables, PCF_BDF_ENCODINGS, &format, &size))
597 format = pcfGetLSB32(file);
601 pFont->info.firstCol = pcfGetINT16(file, format);
602 pFont->info.lastCol = pcfGetINT16(file, format);
603 pFont->info.firstRow = pcfGetINT16(file, format);
604 pFont->info.lastRow = pcfGetINT16(file, format);
605 pFont->info.defaultCh = pcfGetINT16(file, format);
606 if (IS_EOF(file)) goto Bail;
623 encodingOffset = pcfGetINT16(file, format);
624 if (IS_EOF(file)) goto Bail;
641 if (!pcfGetAccel (&pFont->info, file, tables, ntables, PCF_BDF_ACCELERATORS))
701 free(offsets);
706 pcfReadFontInfo(FontInfoPtr pFontInfo, FontFilePtr file)
719 if (!(tables = pcfReadTOC(file, &ntables)))
724 if (!pcfGetProperties(pFontInfo, file, tables, ntables))
727 /* Use the old accelerators if no BDF accelerators are in the file */
731 if (!pcfGetAccel (pFontInfo, file, tables, ntables, PCF_ACCELERATORS))
736 if (!pcfSeekToType(file, tables, ntables, PCF_BDF_ENCODINGS, &format, &size))
738 format = pcfGetLSB32(file);
742 pFontInfo->firstCol = pcfGetINT16(file, format);
743 pFontInfo->lastCol = pcfGetINT16(file, format);
744 pFontInfo->firstRow = pcfGetINT16(file, format);
745 pFontInfo->lastRow = pcfGetINT16(file, format);
746 pFontInfo->defaultCh = pcfGetINT16(file, format);
747 if (IS_EOF(file)) goto Bail;
757 if (pcfGetINT16(file, format) == 0xFFFF)
759 if (IS_EOF(file)) goto Bail;
761 if (IS_EOF(file)) goto Bail;
766 if (!pcfGetAccel (pFontInfo, file, tables, ntables, PCF_BDF_ACCELERATORS))