Hi, Greg. I checked out CVS, but as I see pcf loader is not changed too much. Let look at pcf_readbitmaps() function:
Spec says
>>>
int32 glyph_count; /* byte ordering depends on format, should be the
same as the metrics count */
<<<
But pcf_readbitmaps() assumes that glyph_count is LSB:
num_glyphs = readLSB32(file);
----
I modified font_pcf.c as follows:
/******************************************************/
if ((offset = pcf_get_offset(PCF_BITMAPS)) == -1)
return -1;
printf("PCF OFFSET %ld\n", offset);
FSEEK(file, offset, SEEK_SET);
format = readLSB32(file);
printf("PCF FORMAT %ld\n", format);
endian = (format & PCF_BIT_MASK)? PCF_LSB_FIRST: PCF_MSB_FIRST;
printf("PCF ENDIAN %d\n", endian);
num_glyphs = readLSB32(file);
printf("PCF GLYPH %ld\n", num_glyphs);
return -1; /* Avoid segfault on koi8 font */
/******************************************************/
Then I modified mtest.c demo as follows:
/******************************************************/
case WM_CREATE:
/* This will work */
GdCreateFont(&scrdev, "lubI24.pcf", 0, NULL);
/* This will segfault */
GdCreateFont(&scrdev, "koi5x8.pcf", 0, NULL);
break;
/******************************************************/
I got:
/* lubI24.pcf */
PCF OFFSET 2028
PCF FORMAT 2
PCF ENDIAN 1
PCF GLYPH 229 /* Ok */
/* koi5x8.pcf */
PCF OFFSET 2132
PCF FORMAT 14
PCF ENDIAN 0
PCF GLYPH -16777216 /* pcf loader will malloc() this number of
bytes and segfault later */
--
koi5x8.pcf
Description: Binary data
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
