[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Freetype] FT_Render_Glyph doesn't work well
From: |
CHEN LIANG |
Subject: |
Re: [Freetype] FT_Render_Glyph doesn't work well |
Date: |
Sat, 17 May 2003 11:25:15 +0800 |
Hello,CHEN LIANG
There is a clerical errors in my code ,"char* pBitmap" should be "char*
pBitmap=0". But I do have the correct code in my program.It is just a mistake
during copy.
======= 2003-05-17 11:15:00 You wrote=======
>Hello,everybody
> I use the FT_Render_Glyph function to render a char from the windows font
> "arial",but I find there is only outline in the rendered bitmap .The inner
> part is not filled.Why ?I even tried the FT_Load_Char with FT_LOAD_RENDER
> option.But it still didn't work.
> Thank you for answering my quetion.
> The following is my test code
>////////////////////////////////////////////////////////////////////////////////
> if(error=FT_Init_FreeType(&library))
> return 1;
> if(error=FT_New_Face(library,"arial.ttf",0,&face)){
> return 2;
> }
> if(error=FT_Set_Pixel_Sizes(face,0,256))
> return 3;
> FT_Select_Charmap(face,FT_ENCODING_ADOBE_STANDARD);
>
> char c='a';
> if(error=FT_Load_Char(face,c,FT_LOAD_DEFAULT))
> return 4;
>
> char* pBitmap;
> if(pBitmap==NULL){
> if(error=FT_Render_Glyph(face->glyph,FT_RENDER_MODE_NORMAL))
> return 5;
> FT_Bitmap* pbitmap=&(face->glyph->bitmap);
> bitmap_rows=pbitmap->rows;
> bitmap_cols=pbitmap->width;
> pBitmap=new char[bitmap_rows*bitmap_cols];
> for(int i=0;i<bitmap_rows;i++)
> for(int j=0;j<bitmap_cols;j++){
>
> pBitmap[i*bitmap_cols+j]=pbitmap->buffer[i*bitmap_cols+j];
> if(pBitmap[i*bitmap_cols+j]>0) printf("1");
> else printf("0");
> }
> printf("\n");
> }
>
>/////////////////////////////////////////////////////////////////////
>
>
>
> Sincerely Liang CHEN
>
>
>
>
>_______________________________________________
>Freetype mailing list
>address@hidden
>http://www.freetype.org/mailman/listinfo/freetype
>
>.
= = = = = = = = = = = = = = = = = = = =
Sincerely Liang CHEN