I have been working with glyph, I know to make some font bold you have to load bold version of that Font. But What i want to achieve is make regular font bolded using free type. I have achieved the italic style using FT_TRANSFORM now i want to make it bold too. Any ideas? Is it Possible? I have read FreeType API reference guide but could not found the luck! Regards
Asked
Active
Viewed 2,465 times
3 Answers
2
To emulate boldness you can print the same glyph twice with one px offset. I don't think though that you will get perfect results but at least something.

c-smile
- 26,734
- 7
- 59
- 86
-
can you please guide me how to do that? – Ali Kazmi Aug 28 '15 at 05:52
-
2What exactly you need a guide for? How to render glyphs using FreeType or what? – c-smile Aug 28 '15 at 05:54
-
Render glyphs using free type to get bold characters – Ali Kazmi Aug 28 '15 at 05:57
1
I know this is a really old question.
SFML code shows how to do this: https://github.com/SFML/SFML/blob/master/src/SFML/Graphics/Font.cpp#L558
Important bit seems to be the FT_Outline_Embolden and FT_Bitmap_Embolden functions.

Daid Braam
- 173
- 4
0
I wrote this before. Here I added a line for second print to make letters bold like @c-smile mentioned. I don't recommend tricks like this. If there is an standard way, that's better.
void DrawFTGlyph(FT_Bitmap* pBitmap, int x, int y)
{
int i, j, p, q;
int xMax = x + pBitmap->width;
int yMax = y + pBitmap->rows;
D3DXCOLOR color = D3DCOLOR_RGBA(255, 255, 255, 1);
for (i = x, p = 0; i < xMax; i++, p++)
{
for (j = y, q = 0; j < yMax; j++, q++)
{
if (i < 0 || j < 0 ||
i >= texture.Size().Width() ||
j >= texture.Size().Height())
{
continue;
}
BYTE intensity = pBitmap->buffer[q * pBitmap->pitch + p];
D3DXCOLOR pixel(color.r * intensity, color.g * intensity, color.b * intensity, color.a * intensity);
texture.SetPixel(i, j, pixel);
texture.SetPixel(i + 2, j + 2, pixel); // Second print
}
}
}

MahanGM
- 2,352
- 5
- 32
- 45