freetype-devel
[Top][All Lists]
Advanced

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

[Devel] pitch = ( width + 7 ) >> 3;


From: Wenlin Institute
Subject: [Devel] pitch = ( width + 7 ) >> 3;
Date: Thu, 25 Oct 2001 14:34:09 -0700

Dear Freetypers,

When Freetype allocates monochrome bitmaps, it uses the minimum necessary size. For example, if bitmap.width == 24 then bitmap.pitch == 3. However, some operating systems expect bitmaps to have even numbers of bytes per row. (If bitmap.width == 24 then bitmap.pitch == 4.) To use bitmaps produced by FT_Render_Glyph() as arguments to the MS-Windows function CreateBitmap(), it seems necessary to change this line in ftrend1.c:

    pitch = ( width + 7 ) >> 3;

to something like this:

    pitch = ( ( width + 15 ) >> 4 ) << 1;

Could this be made an option, maybe by supporting a new mode ft_render_mode_mono_even_pitch in addition to ft_render_mode_normal and ft_render_mode_mono, for the second parameter of FT_Render_Glyph()?

By the way, how did "pitch" come to mean "bytes per row"? (Just curious.)

Anyway, Freetype is awesome!

Tom Bishop
--

Wenlin Institute, Inc.        Software for Learning Chinese
E-mail: address@hidden     Web: http://www.wenlin.com
Telephone: 1-877-4-WENLIN (1-877-493-6546)



reply via email to

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