nanogui: Ответ: [nanogui] Re: fonts


Previous by date: 13 Jun 2008 08:06:18 -0000 Re: Graphics Plane Support, Aveek Adhya
Next by date: 13 Jun 2008 08:06:18 -0000 Re: Win32 API for font, ed.hsieh
Previous in thread:
Next in thread: 13 Jun 2008 08:06:18 -0000 Ответ: [nanogui] Re: fonts, "Dmitry Baryshev"

Subject: Ответ: [nanogui] Re: fonts
From: "Dmitry Baryshev" ####@####.####
Date: 13 Jun 2008 08:06:18 -0000
Message-Id: <39840bc80806130106k1ac2e33bk753db1ec2071c254@mail.gmail.com>

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 */

--

[Content type application/octet-stream not shown. Download]

Previous by date: 13 Jun 2008 08:06:18 -0000 Re: Graphics Plane Support, Aveek Adhya
Next by date: 13 Jun 2008 08:06:18 -0000 Re: Win32 API for font, ed.hsieh
Previous in thread:
Next in thread: 13 Jun 2008 08:06:18 -0000 Ответ: [nanogui] Re: fonts, "Dmitry Baryshev"


Powered by ezmlm-browse 0.20.