freetype-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [Devel] bitmap rendering


From: Graham Asher
Subject: RE: [Devel] bitmap rendering
Date: Mon, 19 Feb 2001 20:16:23 -0000

Achim,

You need to tell your blitting routine the width of the bitmap in bytes, as 
well as in pixels, so it knows how many bytes to skip when going from one 
from to the next. This is called the 'stride' or 'pitch' and is given by 
'pitch' in the FT_Bitmap structure.

The pitch is not necessarily the minimum number of bytes that would hold 
the pixels in a row. Sometimes rows are padded to be an exact multiple of 2 
or 4 bytes.

This would explain the distortion of some characters and not others; where 
your blitting routine's idea of the pitch happens to be right, there is no 
distortion.

Also, the following code is wrong - but I guess you know that, because it 
will not even compile:

<<<<<<
char szString[20];
strcpy(szString, "a");
error = FT_Load_Char(face, szString, FT_LOAD_RENDER);
>>>>>>

FT_Load_Char takes not a char* but an integer character code as its second 
argument, so this is better:

error = FT_Load_Char(face, 'a', FT_LOAD_RENDER);

And don't get me started about Hungarian notation ;-) (yeah, I know, it's a 
matter of taste).

Best regards

Graham Asher




reply via email to

[Prev in Thread] Current Thread [Next in Thread]