[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Freetype] Problems with pcf format using freetype in win32 env
From: |
Kalon |
Subject: |
Re: [Freetype] Problems with pcf format using freetype in win32 env |
Date: |
Thu, 11 Nov 2004 15:19:30 -0700 |
User-agent: |
Opera M2/7.54 (Win32, build 3865) |
I now try to use this "unifont.pcf.gz" file with freetype2 and it
does not work correctly. The file opens just fine but FT_Load_Char
seems to return erronious data in the face structure. I wondered if
maybe it was the gzipped format so I tried again with the
"unifont.pcf" file but had the same trouble (file loads correctly
but FT_Load_Char does not return correct face data). (Detailed
information below.)
My suggestion is to try your font with the ftview demo program. If
that fails please send an URL where I can download the font for
further investigation (even better would be a font reduced in size
which you can send me directly).
I tested my font with ftview and it seems to work properly displaying all
the glyphs in the file. So the problem must be in my code that I use to
render and such. I am following the tutorial quite closely so I'm not
sure what isn't working correctly. Here is a sample of my code. (Error
checking is left out. I do check for returned errors.)
#include <ft2build.h>
#include FT_FREETYPE_H
int main(int argc, char* argv[]){
FT_Library library; /* handle to library */
FT_Face face; /* handle to face object */
int error;
size_t n, num_chars;
wchar_t * text = L"Testing";
num_chars = wcslen(text);
error = FT_Init_FreeType( &library );
error = FT_New_Face( library,
"..\\..\\font\\unifont.pcf.gz",
0,
&face );
error = FT_Set_Pixel_Sizes(face, 0, 16);
FT_GlyphSlot slot = face->glyph; /* a small shortcut */
for (n = 0; n < num_chars; n++ )
{
error = FT_Load_Char( face, text[n], FT_LOAD_RENDER | FT_LOAD_MONOCHROME
);
if ( error )
continue; /* ignore errors */
// pen_x += slot->advance.x >> 6;
}
return 0;
}
I run it in debugging mode and look at the slot->bitmap.buffer and it
doesn't match the characters that I am trying to load.
Thanks for your help.
Kalon