summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlex Liu <winddss@gmail.com>2012-10-26 15:18:35 +0100
committerJan Holesovsky <kendy@suse.cz>2012-11-09 13:50:40 +0100
commit0897c61304c582e611dd3ced09ce1a7dc0b7cfc3 (patch)
tree08da12af69b1fca5f7256bd7c2dd8292e134695c
parent8e59df8cab52b58e9727e124fa7d2b5122615e58 (diff)
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 Signed-off-by: Jan Holesovsky <kendy@suse.cz>
-rw-r--r--canvas/source/cairo/cairo_textlayout.cxx5
1 files changed, 3 insertions, 2 deletions
diff --git a/canvas/source/cairo/cairo_textlayout.cxx b/canvas/source/cairo/cairo_textlayout.cxx
index adea863a6837..d6de60a3cf1b 100644
--- a/canvas/source/cairo/cairo_textlayout.cxx
+++ b/canvas/source/cairo/cairo_textlayout.cxx
@@ -618,14 +618,15 @@ namespace cairocanvas
if (rSysFontData.bFakeBold)
{
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
for (int nSteps = 0; nSteps < total_steps; nSteps++)
{
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());
}