Chart test failures on mac: text size differences

Khaled Hosny khaledhosny at eglug.org
Sat Feb 25 21:23:51 UTC 2017


On Sat, Feb 25, 2017 at 12:04:10PM +0000, Tamas Zolnai wrote:
> Hi Khaled,
> 
> On Friday, February 24, 2017 19:40 GMT, Khaled Hosny <khaledhosny at eglug.org> wrote:
> 
> > On Fri, Feb 24, 2017 at 05:41:25PM +0000, Tamas Zolnai wrote:
> > > Hi Khaled,
> > >
> > > I see you're working on text rendering, so I thought that my findings
> > > might be usefull for you. I had a look at chart test failures on Mac
> > > and found that it is because of text size differences. (I checked your
> > > latest change [1], but the differences are still there.)
> > > Both text width and height is different (comparing Windows and Mac).
> > > Interestingly when I changed the font to a bundled, monospace font
> 
> > > (e.g. Liberation Mono, DejaVu Sans Mono), width differences
> > > disappeared and only height differences remained. So there are at
> > > least two kind of issues here. One which is about the proportional
> 
> > > fonts character width and one related to the text height.
> > > I added a minimal test case to the source [2] with which it's easier
> > > to debug the second issue (for the first issue the test case's font
> > > need to be changed to a bundled, proportional font).
> >
> > We need to first who Chart is calculating the text width and depth,
> > namely which function(s) it uses from vcl, to be able to debug it and
> > see where are these differences coming from.
> 
> I debugged it earlier. It was a bit hard to follow the trace from
> chart code to text rendering, but as I see the height differences
> coming somwhere from these methods (I debugged only the height
> difference):
> ImpEditEngine::CalcTextHeight()
> SvxFont::GetPhysTxtSize()
> OutputDevice::GetTextHeight()

I tried to debug this, attached the diff I used to print some debug info
(and disable other chart2dump tests) as well as (cleaned) log files from
running “make CppunitTest_chart2_dump” on both Linux and Mac. There are
two main issues from the logs; we use different UI fonts and even when
using the same fonts they are at different sizes. This commit [1]
introduced an env var that should help with using different fonts, but I
didn’t try using it here. But I have no idea why the fonts are requested
at different sizes, finding the root of this difference might help.

> However I think it would be better to debug this problem with a unit
> test in vcl module which tests directly the text rendering. I would
> suggest that if you are working making text rendering consitent. The
> vcldemo does something similar, but it's just doing the rendering and
> does not compare the text size to expected values. That code can be
> reused to write some unit tests about text rendering.

If someone knows how to write text layout unit tests for VCL (i.e. by
showing some example) I might try adding some, otherwise I don’t think
OutputDevice provides much of useful API for doing layout tests that
would be helpful at VCL level.

> Actually I'm a bit suprised that there is no a unit test for this (I
> did not find any in vcl module). I heard some expectations from other
> LO developers that text rendering is consistent now on different
> systems but I can't see how it can be expected if there isn't any test
> about it. It's hard to imagine that somebody can test it manually on
> all the three main platforms.

It is supposed to be consistent and only fairly recently (in 3.5 cycle),
of course this have only been verified manually and sporadically because
that is currently the only practical way AFAIK (see above).

Regards,
Khaled

1. https://gerrit.libreoffice.org/gitweb?p=core.git;a=commitdiff;h=55916dfc59f05537c4e6fece77aef3cc1dbef34c


More information about the LibreOffice mailing list