Date: prev next · Thread: first prev next last
2017 Archives by date, by thread · List index


Hi Khaled,

On Sunday, February 26, 2017 23:30 GMT, Khaled Hosny <khaledhosny@eglug.org> wrote:

On Sat, Feb 25, 2017 at 09:58:58PM +0000, Tamas Zolnai wrote:
Hi Khaled,

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.

Is vcldemo code not good enough as example? (vcl/workben/vcldemo.cxx)
Check the drawText() or drawComplex() method. As I see this method
uses only vcl objects (OutputDevice, vcl::Font).
OutputDevice::GetTextBoundRect() can be used to get the text width and
height. Or did I miss something?

I don’t think text width or height are that interesting, but they are
probably a good approximation, so I repurposed one of the existing VCL
tests to test this[1]. I tried testing also the text bounding rectangle
but it showed a 1 pixel difference on Mac, this should be fixed in [2].

Feel free to add more test cases that you think are worth having.

1. 
https://gerrit.libreoffice.org/gitweb?p=core.git;a=commitdiff;h=eb7b03b052ffe8c2c577b2349987653db6c53f76
2. 
https://gerrit.libreoffice.org/gitweb?p=core.git;a=commitdiff;h=af871d02914c9fc6a08079f67b4af71a198e166a

Regards,
Khaled

P.S. The bounding rectangle is the ink extents of the text, i.e. the
smallest rectangle that fits around the text without leaving any white
space around it, which is not the same as text width and height. This
should’t normally have any effect on text layout, as it should depend
only on logical extents (the width and height). We still use platform
APIs to determine each glyph bounding rectangle which is a potential
source of differences here. We probably should try to use HarfBuzz here
as well.

Hmm, I see. It seems the problem causing chart test failures is not on VCL level. This small 
difference not seems to be the one we looking for and also the log files (what you attached 
earlier) show that the text height is different not the bounding rectangle. Well, I'm not familiar 
with this text layouting stuff, so I don't know what other levels it has. Anyway it's good that now 
we have a test for VCL level.

Thanks,
Tamás





Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.