freetype
[Top][All Lists]
Advanced

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

Re: [ft] Pitch Smaller Than Bitmap Width + Make Build Errors


From: address@hidden
Subject: Re: [ft] Pitch Smaller Than Bitmap Width + Make Build Errors
Date: Mon, 02 Feb 2009 11:15:39 +0530
User-agent: Thunderbird 2.0.0.19 (Windows/20081209)

Hi,
 
I want to genrate anti-aliasing to 8 bits per pixel (basically just the default
flags and rendering modes, not monochrome). 
Other characters are fine, and several other fonts too.

But I am not getting the results for Unicode range 0-255, except this range it is working fine.
I used font verdanab.ttf, arial.ttf, times.ttf, etc font files but all in vain and generating bad pointer for face->glyph->bitmap.buffer. How should I fetch proper data with this buffer.

My code look like - 

for (i = 0; i < font->num_glyphs; i++)
    {
        /* Get the bitmap */
        err = FT_Load_Glyph (face, i, FT_LOAD_DEFAULT);
        if (err)
        {
            /* Error */
            return -1;
        }
        
        FT_Render_Glyph (face->glyph, FT_RENDER_MODE_NORMAL);
        
        /* Store the various field */
        if ((face->glyph->bitmap.rows * face->glyph->bitmap.pitch) != 0)
        {
            if ((face->glyph->bitmap.rows * face->glyph->bitmap.pitch) > 
                                                        MAX_BITMAP_BUFFER_SIZE)
            {
                printf("\nError.Bitmap size <%d> is more than buffer <%d>\n",
                        (face->glyph->bitmap.rows * face->glyph->bitmap.pitch),
                                                        MAX_BITMAP_BUFFER_SIZE);
                printf("\nPlease Change the MAX_BITMAP_BUFFER_SIZE in    \"hurfbuzz_tool/src/store_bitmap_struct.h\" file to %d",
                                   face->glyph->bitmap.rows * face->glyph->bitmap.pitch);
                printf("\n\nERROR\n\n");   
                return -1;
            }
            /* Data copying into local buffer */
           
            memcpy (hindi_bitmap_array[i].bitmap.buffer, 
                                    face->glyph->bitmap.buffer,
                    (face->glyph->bitmap.rows * face->glyph->bitmap.pitch));

            hindi_bitmap_array[i].bitmap.rows = face->glyph->bitmap.rows;
            hindi_bitmap_array[i].bitmap.width = face->glyph->bitmap.width;
            hindi_bitmap_array[i].bitmap.pitch = face->glyph->bitmap.pitch;
            hindi_bitmap_array[i].bitmap.num_grays =                                 face->glyph->bitmap.num_grays;
            hindi_bitmap_array[i].bitmap.pixel_mode = 
                                            face->glyph->bitmap.pixel_mode;
            hindi_bitmap_array[i].bitmap.palette_mode = 
                                            face->glyph->bitmap.palette_mode;
            //hindi_bitmap_array[i].bitmap.palette = NULL;

            hindi_bitmap_array[i].bitmap_left = face->glyph->bitmap_left;
            hindi_bitmap_array[i].bitmap_top = face->glyph->bitmap_top;
   
        }
    } 


Plzz. help me, I asked the same question earlier also... But not recieved any Help yet.
Please let me know if there is someth wrong with the code. Size of  MAX_BITMAP_BUFFER_SIZE is 400.
Regards
Govind 

reply via email to

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