How to write OOXML attribute 'vert' of <bodyPr> element to ODF?

Regina Henschel rb.henschel at t-online.de
Fri Jun 17 17:58:46 UTC 2022


Hi Mark,

Mark Hung schrieb am 17.06.2022 um 17:17:
> Hi Regina,
> 
> Regina Henschel <rb.henschel at t-online.de 
> <mailto:rb.henschel at t-online.de>> 於 2022年6月16日 週四 晚上8:49寫道:
> 
>     Hi all,
> 
>     Currently the "vert" attribute of <bodyPr> element is connected to
>     TextPreRotateAngle property. vert="vert" produces
>     TextPreRotateAngle=-90
>     and vert="vert270" produces TextPreRotateAngle=-270. When converting it
>     to ODF it produces draw:text-rotate-angle="-90" and
>     draw:text-rotate-angle="-270".
> 
>     That approach does not work, because the ODF attribute
>     draw:text-rotate-angle produces a rotation of the text area rectangle,
>     same as the 'rot' attribute of element <bodyPr> in OOXML. Try with
>     attached file the export to ODF and reload to see the problem.
> 
>     For using draw:text-rotate-angle attribute it would be necessary to
>     change the values of the draw:text-areas attribute in addition. But
>     this
>     requires introducing additional equations and it conflicts with the
>     definitions of the predefined shapes of the presets.
> 
>     My idea is to introduce a new loext:text-direction attribute of the
>     <draw:enhanced-geometry> element, which can carry each of the values of
>     the OOXML attribute 'vert'. "Each" needs to be discussed, perhaps
>     better
>     to exclude values eaVert and mongolianVert, which in fact are writing
>     modes TB_RL and TB_LR. Possible values would be ("eaVert"), "horz",
>     ("mongolianVert"), "vert", "vert270", "wordArtVert" and
>     "wordArtVertRtl".
> 
> 
> It's not clear to me why you think eaVert, and mongolianVert should be 
> excluded here.
> Maybe you can explain further.

vert="eaVert" in a shape describes the same as WritingMode2::RL_TB and 
WritingMode::RL_TB. vert="mongolianVert" in a shape describes the same 
as WringingMode::TB_LR. Setting the writing mode is already used for 
"eaVert" in 
https://opengrok.libreoffice.org/xref/core/oox/source/shape/WpsContext.cxx?r=adf7d6ef#70
So it might be better to use that too in 
https://opengrok.libreoffice.org/xref/core/oox/source/drawingml/textbodypropertiescontext.cxx?r=486a11ad#117

AFAIK, we can currently not use WritingMode2 in these places. But 
because WritingMode is deprecated, it might be more seminal to improve 
the implementation to use WritingMode2. And then be able to use "TB_LR" 
for "mongolianVert". We are already able to render "TB_LR" in Writer 
text frames, but not for text in custom shapes.

Both "eaVert" and "mongolianVert" are not pure geometrical, but consider 
east asian scripts, so that such characters are excluded from the rotation.

> 
> It seems to me that:
> - horz, vert, vert270 are effectively horizontal (LR_TB or RL_TB) with 
> different rotation angles.

Yes. That makes it possible to render "vert" and "vert270" by 
incorporating the "TextPreRotateAngle" into aTextBoxMatrix in
https://opengrok.libreoffice.org/xref/core/svx/source/sdr/contact/viewcontactofsdrobjcustomshape.cxx?r=b739bdab#160

The same matrix gets later the "TextRotateAngle" incorporated, which 
describes the rotation of the text area rectangle. And only for that one 
a corresponding attribute is available in ODF.

> CJK text ( along its upright axis ) is perpendicular to the run direction.
> 
> - eaVert, wordArtVertRtl : TB_RL. CJK text is parallel to the run direction.
> 
> - mongolianVert, wordArtVert: TB_LR. CJK text is parallel to the run 
> direction.

CJK characters are not rotated for eaVert and mongolianVert.

> 
> Both wordArtVertRtl and wordArtVert don't apply rotation to Latin 
> scripts - which I think is something missing in LibreOffice.

wordArtVertRTL and wordArtVert are currently not implemented in LO, but 
the rendering in PowerPoint is so, that the CJK characters are not rotated.


> We don't have the attribute to keep the state. We always render Latin 
> script text in vertical writing as same as in horizontal writing, only 
> rotate the whole run.

Not always. We can render WritingMode::TB_RL (=eaVert) in custom shapes, 
both with and without attached text frame. For import from pptx, I think 
the error is in 
https://opengrok.libreoffice.org/xref/core/oox/source/drawingml/textbodypropertiescontext.cxx?r=486a11ad#116. 
But I have not yet tested it, because first I want a clear separation of 
"TextPreRotateAngle" (attribute 'vert' in OOXML) and "TextRotateAngle" 
(attribute 'rot' in OOXML).

Kind regards
Regina


More information about the LibreOffice mailing list