Re: Fwd: Drawing vertical text glyphs

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Lubos,

Luboš Luňák <l.lunak@xxxxxxxxxxxxx> 於 2021年4月29日 週四 上午1:19寫道:
On Wednesday 28 of April 2021, Mark Hung wrote:
> Anyway, if you need someone to verify text layout results with vertical
> writing or
> , don't hesitate to ask.
>
> I can definitely help. I can also verify patches on Windows.
> There is also a telegram group of TDF members from the CJK area if you
> prefer.

 The Skia VCL backend code for text drawing is
SkiaSalGraphicsImpl::drawGenericLayout(). For non-vertical glyphs, the code
is easy, just iterate over all glyphs and pass them to Skia with their
positions, possibly rotated. That approach doesn't work well for vertical
glyphs, for the tdf#103785 document I get [1], with the glyphs being
positioned too high. If I apply the attached patch that moves all vertical
glyphs down based on the glyph height, then I get [2], which appears to be at
least roughly acceptable, although it doesn't look to be completely correct.

 And I don't know how to make it correct. First of all, I don't know how to
visually identify what is correct. At [3] I've uploaded screenshots of the
document rendered by LO/Cairo, LO/GDI and Word2013. They are all different,
both in X and Y positioning. Cairo draws them slightly to the left of the
latin alphabet characters, GDI is roughly centered, Word draws them to the
right. Vertically they also differ, I made sure to include cursor in all the
screenshots and e.g. with the first glyph (中) the cursor doesn't touch the
glyph with Word, it touches it with GDI and it overlaps the glyph with Cairo
(the image may need zooming to see it clearly). Which of those are correct?


To be honest, I can only verify from the point of view of a user who can read Chinese.

The cursor which overlaps the position doesn't seem right. It's not a big problem
as long as it does not strike through the glyph in the middle. But the inconsistence among
platforms might be a problem. 
I would have tested fullwidth punctuations.
It went wrong in vertical writing before.
 
 Second, I would need to express the correct positioning in the code. Do you
know how to do that? I copied the glyph-size change in the attached patch
from Cairo, it also moves in X direction by the font descent, but I'd prefer
not to do random modifications without understanding them.


I tried to make a patch to highlight the relative positions, and find out something that I added 
to fix the issue - of course it can not complete fix the problem, but it may make more sense.

https://gerrit.libreoffice.org/c/core/+/114887
( the image of the test of the patch is also attached. )

Vertical positioning there is more correct to me. It also doesn't overlap with the cursor. It introduce
horizontal offset issue unfortunately.

Hope that helps.

 
[1] https://people.collabora.com/~llunak/skia/skia_current.png
[2] https://people.collabora.com/~llunak/skia/skia_vert1.png
[3] https://people.collabora.com/~llunak/skia/

--
 Luboš Luňák
 l.lunak@xxxxxxxxxxxxx


--
Mark Hung

Attachment: my-vertical-writing-tests.png
Description: PNG image

_______________________________________________
LibreOffice mailing list
LibreOffice@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/libreoffice

[Index of Archives]     [LARTC]     [Bugtraq]     [Yosemite Forum]     [Photo]

  Powered by Linux