Testing ImplLayoutRuns and ImplLayoutArgs

Chris Sherlock chris.sherlock79 at gmail.com
Wed Sep 1 21:09:35 UTC 2021


Hi all, 

I was hoping someone who has an understanding of text layout might be able to help me. I have written a unit test for ImplLayoutRuns, but I would like to confirm my approach and understanding is correct. 

The patch on gerrit can be found here:

https://gerrit.libreoffice.org/c/core/+/121204 <https://gerrit.libreoffice.org/c/core/+/121204>

In testImplLayoutRuns_AddPos() I add 7 positions. I assume these are glyph positions. 

What I think I’m doing is to setup a run of 3 non-RTL glyphs, then add a fourth RTL marker glyph, which makes a run of three characters with the RTL maker. I then create a non-RTL glyph position. etc.

The code being:

ImplLayoutRuns aRuns;
aRuns.AddPos(1, false);
aRuns.AddPos(2, false);
aRuns.AddPos(3, false);
aRuns.AddPos(4, true); // add RTL marker glyph
aRuns.AddPos(5, false);
aRuns.AddPos(6, true); // add RTL marker glyph
aRuns.AddPos(7, false);


I believe this creates a run of four LTR glyphs, then a run of 2 RTL glyphs, then a run of two LTR glyphs, and final run of 2 RTL glyphs. 

Can I clarify this is correct? And does each run explicitly include the RTL marker as the first glyph position? The test seems to show this. 

Chris
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/libreoffice/attachments/20210902/d53d4c98/attachment.htm>


More information about the LibreOffice mailing list