-
-
Notifications
You must be signed in to change notification settings - Fork 36
Justified Output of Chinese Characters not Aligned Properly #204
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
This looks ugly. I can't promise a quick solution, but I'll have a look. |
Hi,
Cool, thanks for the response.
Please find the data.xml and layout.xml as attached, in case it help.
Regards,
Adam Cheung
…On Wed, Nov 28, 2018 at 4:52 PM Patrick Gundlach ***@***.***> wrote:
This looks ugly. I can't promise a quick solution, but I'll have a look.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#204 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AHT24-g-L-Wmobt-57IQ1kvNKn6JVDtWks5uzk67gaJpZM4Y21G4>
.
|
There was no attachment in your mail (filtered by github probably), but I think I can start debugging without these files. I'd come back to you if I need help. |
Sorry for the late reply. Do you have a test document? I got good results with my texts. BTW: do you (by chance) have line breaks in the text and not used |
Hi, Thanks for your update. I also wonder if that is the case, and checked not quite likely. Please find the test document as attached. |
seems I cannot upload zip of the working folder. Please see the data.xml and layout.xml as attached. |
Thank you. I can now reproduce the problem with my setup. I'll have a look. |
This is a smaller test file for the problem. <Layout xmlns="urn:speedata.de:2009/publisher/en" xmlns:sd="urn:speedata:2009/publisher/functions/en">
<Options ignoreeol="yes"/>
<Trace grid="yes"/>
<SetGrid nx="19" height="12pt"/>
<Pagetype name="x" test="true()">
<Margin left="1cm" right="2cm" top="1cm" bottom="1cm"/>
<PositioningArea name="2c">
<PositioningFrame width="9" height="15" row="10" column="1"/>
<PositioningFrame width="9" height="15" row="10" column="11"/>
</PositioningArea>
</Pagetype>
<LoadFontfile name="R" filename="Arial Unicode.ttf"/>
<DefineFontfamily name="text" fontsize="10" leading="12">
<Regular fontface="R"/>
</DefineFontfamily>
<Record element="data">
<ProcessNode select="para"/>
</Record>
<Record element="para">
<Output area="2c" allocate="auto">
<Text>
<Paragraph textformat="text">
<Value select="."/>
</Paragraph>
</Text>
</Output>
</Record>
</Layout> And the data: <data>
<para>本人謹代表揚科集團有限公司(「本公司」)董事會(「董事會」)欣然提呈本公司截至2018年3月31日止年度(「2018財政年度」)的年報,包括本公司及其附屬公司(統稱「本集團」)經審核綜合財務報表。</para>
<para>2018財政年度對本集團而言是頗具挑戰的一年。本集團於2018財政年度錄得本公司股東應佔綜合虧損凈額約11.2百萬港元。虧損狀況乃由於本集團於2018財政年度不利的投標結果及本集團現有大型資訊科技項目實施階段較過往年度確認的收入大幅減少(原因為該等項目的實施階段已進入其收尾階段及大致上於2018財政年度完工)之合併結果。</para>
</data> |
I don’t think this is really a bug. The Chinese text is missing spaces, so it can’t be justified. You can add zero-width spaces after each character to make justification work, like so: <Paragraph textformat="text">
<Loop select="string-length(string(.))" variable="i">
<Value select="substring(string(.),$i,1)"/>
<HSpace width="0"/>
</Loop>
</Paragraph> You could also add zero-width spaces to your source data <data>
<para>本​人​謹​代​表​揚​科​集​團​有​限​公​司​(​「​本​公​司​」​)​董​事​會​(​「​董​事​會​」​)​欣​然​提​呈​本​公​司​截​至​2018年​3月​31日​止​年​度​(​「​2018財​政​年​度​」​)​的​年​報​,​包​括​本​公​司​及​其​附​屬​公​司​(​統​稱​「​本​集​團​」​)​經​審​核​綜​合​財​務​報​表​。</para>
<para>2018財​政​年​度​對​本​集​團​而​言​是​頗​具​挑​戰​的​一​年​。​本​集​團​於​2018財​政​年​度​錄​得​本​公​司​股​東​應​佔​綜​合​虧​損​凈​額​約​11.2百​萬​港​元​。​虧​損​狀​況​乃​由​於​本​集​團​於​2018財​政​年​度​不​利​的​投​標​結​果​及​本​集​團​現​有​大​型​資​訊​科​技​項​目​實​施​階​段​較​過​往​年​度​確​認​的​收​入​大​幅​減​少​(​原​因​為​該​等​項​目​的​實​施​階​段​已​進​入​其​收​尾​階​段​及​大​致​上​於​2018財​政​年​度​完​工​)​之​合​併​結​果​。​</para>
</data> and use <Paragraph textformat="text" allowbreak="​">
<Value select="."/>
</Paragraph> |
Hi pgundlach and iclukas, Cool, I tried the smaller test file and the suggestion. It works very nice. Thanks so much. Although not immediate worked in my file, I will start working on it. Thanks again. Adam |
I think this stll needs some attention. In my testcase above when you set Also I think the rules of line breaking in Chinese must be fixed. There are no rules whatsovever, and this is not good. |
I agree so. Thought I can put empty spaces to the content. We don't have them in Chinese content naturally. Also, somehow, we feel like Chinese characters are fixed width, and shouldn't it be easier to do the alignment? anyway, thanks for the ongoing feedback. |
The next version will focus on non-western scripts. |
Trying to Chinese text to 2-column with "justified" text alignment. The text is not aligned properly.
While English text is aligned properly for same Layout.xml.
The text was updated successfully, but these errors were encountered: