Resolves: fdo#47432 Improve the "faux bold" in cairo canvas
The "faux bold" make the bold font in Asian ugly & unacceptable, Adjust & improve the "faux bold" to make the bold font better. Change-Id: I2e02156ffc30629476b80134ffb0b50e793f7ead
This commit is contained in:
committed by
Caolán McNamara
parent
9ffc1f4e03
commit
b6aa58c4d8
@@ -609,14 +609,15 @@ namespace cairocanvas
|
|||||||
if (rSysFontData.bFakeBold)
|
if (rSysFontData.bFakeBold)
|
||||||
{
|
{
|
||||||
double bold_dx = 0.5 * sqrt( 0.7 * aFont.GetHeight() );
|
double bold_dx = 0.5 * sqrt( 0.7 * aFont.GetHeight() );
|
||||||
int total_steps = 2 * ((int) (bold_dx + 0.5));
|
int total_steps = 1 * ((int) (bold_dx + 0.5));
|
||||||
|
|
||||||
// loop to draw the text for every half pixel of displacement
|
// loop to draw the text for every half pixel of displacement
|
||||||
for (int nSteps = 0; nSteps < total_steps; nSteps++)
|
for (int nSteps = 0; nSteps < total_steps; nSteps++)
|
||||||
{
|
{
|
||||||
for(int nGlyphIdx = 0; nGlyphIdx < (int) cairo_glyphs.size(); nGlyphIdx++)
|
for(int nGlyphIdx = 0; nGlyphIdx < (int) cairo_glyphs.size(); nGlyphIdx++)
|
||||||
{
|
{
|
||||||
cairo_glyphs[nGlyphIdx].x += bold_dx * nSteps / total_steps;
|
cairo_glyphs[nGlyphIdx].x += (bold_dx * nSteps / total_steps) / 4;
|
||||||
|
cairo_glyphs[nGlyphIdx].y -= (bold_dx * nSteps / total_steps) / 4;
|
||||||
}
|
}
|
||||||
cairo_show_glyphs(pSCairo.get(), &cairo_glyphs[0], cairo_glyphs.size());
|
cairo_show_glyphs(pSCairo.get(), &cairo_glyphs[0], cairo_glyphs.size());
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user