Im having trouble creating "cleartype" quality fonts. I've read the docs and need to know how the freetype buffer is packed so I can extract the red,green and blues.
The index of the non-cleartype gray buffer from the example on the "freetype" website is:
row*slot->bitmap.width + col
The buffer is packed differently the flag "FT_LOAD_TARGET_LCD" is set. It states in the documentation that the width of the buffer is multiplied by three. How do index that buffer?
int width = face->glyph->metrics.width >> 6; int height =face->glyph->metrics.height >> 6; int x = 0;
int y = 0;
for (int xpos = x, col = 0; xpos < (x+width); xpos++, col++ ) for (int ypos = y, row = 0; ypos < (y+height); ypos++, row++ ) { int index = row*slot->bitmap.width + col;
int red = (int)slot->bitmap.buffer[index]; int green = (int)slot->bitmap.buffer[index]; int blue = (int)slot->bitmap.buffer[index]; printf("%d,%d,%d\n",red,green,blue);
}