[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [ft-devel] porting: Where should i start debugging
From: |
duhuanpeng |
Subject: |
Re: [ft-devel] porting: Where should i start debugging |
Date: |
Sat, 3 Mar 2018 23:51:17 +0800 |
Dear all,
I can show the fonts on my pc now, thanks to Werner very much.
I read this page again:
https://www.freetype.org/freetype2/docs/glyphs/glyphs-7.html#section-2
And my code is here:
void dump_ft_bitmap( FT_Bitmap* bitmap)
{
unsigned int i, j;
unsigned q;
unsigned rows = bitmap->rows;
unsigned width = bitmap->width;
int pitch = bitmap->pitch;
unsigned char ch;
q = 0;
for(i=0; i<rows; i++) {
for (j=0; j<width; j+=pitch) {
ch = bitmap->buffer[q];
dump_byte(ch);
q++;
}
printf("\r\n");
}
}
slot->bitmap->pixel_mode:(1)
slot->bitmap->pitch:(4)
O O
OOOOOOOOOOOOOOO
OO OO OO
OO OO OO
OO OO OO
OO OO OOO
OO OO OOOO
OO OO OO OO
OO OO OO OOO
OO OO OO O
OOOOO OO
OO OO OO
OO
OO
OO
slot->bitmap->pixel_mode:(1)
slot->bitmap->pitch:(4)
O O
O O OO
O OO OO
OO OO OO
OO OO O
OO OO OO
O O O
O O
OOOOOOOOOOOOOOO
O O
OOO O
OO OO
OO OO
OO OO
OO OOO
O O
slot->bitmap->pixel_mode:(1)
slot->bitmap->pitch:(4)
Now I am going to run this code on my target board.
Thank you all again.
Regards,
duhuanpeng
-----Original Message-----
From: duhuanpeng [mailto:address@hidden
Sent: Saturday, March 03, 2018 8:31 PM
To: 'Werner LEMBERG'
Cc: 'address@hidden'; 'address@hidden'; address@hidden
Subject: RE: [ft-devel] porting: Where should i start debugging
Dear Werner,
First, thank you very much for your replying.
>* Your `dump_bitmap' version only produces crap for bitmap fonts (the
> original function in the sample code doesn't work either, BTW – I've
> just added a comment to `example1.c'). Reason is that you don't
> check the buffer format of `slot->bitmap->pixel_mode', which is
> FT_PIXEL_MODE_MONO in this case (meaning 8 pixels per byte).
Ah, I have change my code to below, take a look at
https://paste.ubuntu.com/p/9MxcP5czZt/
line 77, 97
The output still *not* correct:
*--*^M
| OOOOO |^M
| O OOOOOO O |^M
| O O OO O|^M
| O OOO O |^M
|OOO O O |^M
| OOOO OO OO|^M
| OO OO O|^M
| OOO OO O|^M
| |^M
|O O O|^M
| OO OO |^M
| |^M
|O O OO O|^M
| O |^M
|OO O OO OO|^M
| |^M
*--*^M
See more (https://paste.ubuntu.com/p/NyXKB3CHd9/)
What is the FT_PIXEL_MODE_MONO bitmap format?
The output above is
Byte[0] Byte[1] (bit order 7-0)
Byte[3] byte[4]
Byte[5] byte[6]
...(more)...
Byte[30] Byte[31]
>* `FT_Load_Char' doesn't work for `gbst16.pcf' as expected. Reason is
> that this font is not encoded in Unicode (it is rather using GB2312
> encoding), thus FreeType can't set up a cmap. In this case,
> `FT_Load_Char' behaves like `FT_Load_Glyph', this is, it handles the
> input character codes as glyph indices.
> You have to manually convert input character codes to glyph indices
> (for example, using `iconv'), then using `FT_Load_Glyph'.
My input character is below, it is a interger. I guess at least, I guess it
will Show some character?
for(ch=97; ch<65535; ch++) {
...
}
By the way, my git repo is here, I am trying to make freetype compiled by keil:
https://gitee.com/m32/freetype2
Keil is quite popular IDE for MCU, hope you can give me some suggestion.
Regards,
duhuanpeng