canvas/source/cairo/cairo_textlayout.cxx |   30 +++++-------------------------
 1 file changed, 5 insertions(+), 25 deletions(-)

New commits:
commit 827a7070d44524f805bad715b6bfbe0948bfbae5
Author: Jan Holesovsky <ke...@suse.cz>
Date:   Fri Nov 9 11:38:11 2012 +0100

    bnc#681110: Fix squashed glyphs with Cairo canvas.
    
    I suppose it is the same misconception as in fdo#55931 - I am convinced that
    the font metrics should not be used here.
    
    Looks to me as if in the past, the font width computation was broken 
somewhere
    deep inside OOo, and everyone instead of fixing the root cause was just
    working that around by using the FontMetric; and then one day the root cause
    was fixed, and all the workarounds broke ;-) - but that is just a theory.
    
    Change-Id: I741bf8f4eaea4f7d8bc698dc9a8124109dfb8c20

diff --git a/canvas/source/cairo/cairo_textlayout.cxx 
b/canvas/source/cairo/cairo_textlayout.cxx
index d6de60a..f425436 100644
--- a/canvas/source/cairo/cairo_textlayout.cxx
+++ b/canvas/source/cairo/cairo_textlayout.cxx
@@ -554,32 +554,13 @@ namespace cairocanvas
             // Font rotation and scaling
             cairo_matrix_t m;
             Font aFont = rOutDev.GetFont();
-            FontMetric aMetric( rOutDev.GetFontMetric(aFont) );
-            long nWidth = 0;
-
-            // width calculation is deep magic and platform/font dependant.
-            // width == 0 means no scaling, and usually width == height means 
the same.
-            // Other values mean horizontal scaling (narrow or stretching)
-            // see issue #101566
-
-            //proper scale calculation across platforms
-            if (aFont.GetWidth() == 0)
-            {
-                nWidth = aFont.GetHeight();
-            }
-            else
-            {
-                // any scaling needs to be relative to the platform-dependent 
definition
-                // of height of the font
-                nWidth = aFont.GetWidth() * aFont.GetHeight() / 
aMetric.GetHeight();
-            }
 
             cairo_matrix_init_identity(&m);
 
             if (aSysLayoutData.orientation)
                 cairo_matrix_rotate(&m, (3600 - aSysLayoutData.orientation) * 
M_PI / 1800.0);
 
-            cairo_matrix_scale(&m, nWidth, aFont.GetHeight());
+            cairo_matrix_scale(&m, aFont.GetWidth(), aFont.GetHeight());
 
             //faux italics
             if (rSysFontData.bFakeItalic)
@@ -592,11 +573,9 @@ namespace cairocanvas
 #else
 # define TEMP_TRACE_FONT ::rtl::OUStringToOString( aFont.GetName(), 
RTL_TEXTENCODING_UTF8 ).getStr()
 #endif
-            OSL_TRACE("\r\n:cairocanvas::TextLayout::draw(S,O,p,v,r): 
Size:(%d,%d), W:%d->%d, Pos (%d,%d), G(%d,%d,%d) %s%s%s%s || Name:%s - %s",
+            OSL_TRACE("\r\n:cairocanvas::TextLayout::draw(S,O,p,v,r): 
Size:(%d,%d), Pos (%d,%d), G(%d,%d,%d) %s%s%s%s || Name:%s - %s",
                       aFont.GetWidth(),
                       aFont.GetHeight(),
-                      aMetric.GetWidth(),
-                      nWidth,
                       (int) rOutpos.X(),
                       (int) rOutpos.Y(),
                       cairo_glyphs.size() > 0 ? cairo_glyphs[0].index : -1,
commit 0897c61304c582e611dd3ced09ce1a7dc0b7cfc3
Author: Flex Liu <wind...@gmail.com>
Date:   Fri Oct 26 15:18:35 2012 +0100

    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 <ke...@suse.cz>

diff --git a/canvas/source/cairo/cairo_textlayout.cxx 
b/canvas/source/cairo/cairo_textlayout.cxx
index adea863..d6de60a 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());
                 }
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to