You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-users@xmlgraphics.apache.org by jh...@gmail.com on 2021/05/30 01:18:28 UTC

mixed Chinese/English and text-align="justify"

Hi there, just wondering if anybody has any experience/tips in getting full
justification to work automagically for mixed Chinese/English paragraphs?
Most Chinese glyphs are fixed width, so that's easy, but even in a
monospaced font (eg NSimSun), the English glyphs are narrower.

I've attached below the FO I've been playing with.

thanks .. Jason

   <fo:block text-align="justify">
<fo:inline font-family="NSimSun">世衛組織於2020年12月31日將輝瑞的COVID-19疫苗(BNT162b2
)納入緊急使用列表。2021年2月15日,世衛組織將阿斯利康/牛津的COVID-19疫苗的兩種版本納入了緊急使用列表,這兩種疫苗由印度血清研究所和
SKBio公司生產。2021年3月12日,世衛組織將由楊森(強生公司)開發的COVID-19疫苗Ad26.COV2.S納入了緊急使用列表。世衛組織在今年
6月前會繼續將其他疫苗產品納入緊急使用列表。    </fo:inline>
</fo:block>

Re: mixed Chinese/English text overwritten

Posted by jh...@gmail.com.
 W3C WD "Requirements for Chinese Text Layout" of 1 November 2020 at
https://www.w3.org/TR/clreq/  appears to be a comprehensive guide

See
https://www.w3.org/TR/clreq/#mixed_text_composition_in_horizontal_writing_mode
  "there is tracking or spacing between an adjacent Han character and a
Western character of up to one quarter of a Han character width, except at
the line start or end."

https://www.w3.org/TR/clreq/#handling_western_text_in_chinese_text_using_proportional_western_fonts
 includes:  Justified text alignment is an important feature of Chinese
composition. It is harder to align text as expected when a line contains
Western characters. Typically, spacing or tracking is applied equally
across the line, but such adjustments are only applied between Han
characters or between Han and Western letters. The spacing is not equally
distributed between characters in Western words and/or European numerals.

Then there is stuff about Grid Alignment, together with the note: Grid
alignment is adopted more often in Traditional Chinese typesetting, whereas
use in Simplified Chinese is rare.


On Mon, Jun 7, 2021 at 11:41 AM <jh...@gmail.com> wrote:

> There's also an issue with letter-spacing between Chinese and English,
> which causes the following English letter to "overwrite" the last Chinese
> glyph.  Maybe its the same underlying problem as the "full justification"
> one in my quoted email below?
>
> My test fo is below.  Is there a fop dev who would be interested in fixing
> these issues on a fee for service basis?
>
> thanks .. Jason
>
>
>
>    <fo:block font-size="12.0pt" line-height="107%"
> space-after="0.11in">
> <inline xmlns="http://www.w3.org/1999/XSL/Format"
> font-size="12.0pt" letter-spacing="0.02in">
> <inline font-family="PMingLiU">有針對</inline>
> </inline>
> <inline xmlns="http://www.w3.org/1999/XSL/Format"
> font-size="12.0pt" letter-spacing="0.02in">
> <inline font-family="Times New Roman">spacing 31</inline>
> </inline>
> </fo:block>
> <fo:block font-size="12.0pt" line-height="107%"
> space-after="0.11in">
> <inline xmlns="http://www.w3.org/1999/XSL/Format"
> font-size="12.0pt" letter-spacing="1mm">
> <inline font-family="Times New Roman">spacing 61</inline>
> </inline>
> <inline xmlns="http://www.w3.org/1999/XSL/Format"
> font-size="12.0pt" letter-spacing="1mm">
> <inline font-family="PMingLiU">有針對</inline>
> </inline>
> </fo:block>
> <fo:block font-size="12.0pt" line-height="107%"
> space-after="0.11in">
> <inline xmlns="http://www.w3.org/1999/XSL/Format"
> font-size="12.0pt" letter-spacing="0.06in">
> <inline font-family="PMingLiU">有針對</inline>
> </inline>
> <inline xmlns="http://www.w3.org/1999/XSL/Format"
> font-size="12.0pt" letter-spacing="2mm">
> <inline font-family="Times New Roman">spacing 91</inline>
> </inline>
> </fo:block>
>
>
>
> On Sun, May 30, 2021 at 11:18 AM <jh...@gmail.com> wrote:
>
>> Hi there, just wondering if anybody has any experience/tips in getting
>> full justification to work automagically for mixed Chinese/English
>> paragraphs?  Most Chinese glyphs are fixed width, so that's easy, but even
>> in a monospaced font (eg NSimSun), the English glyphs are narrower.
>>
>> I've attached below the FO I've been playing with.
>>
>> thanks .. Jason
>>
>>    <fo:block text-align="justify">
>> <fo:inline font-family="NSimSun">世衛組織於2020年12月31日將輝瑞的COVID-19疫苗(BNT162b2
>> )納入緊急使用列表。2021年2月15日,世衛組織將阿斯利康/牛津的COVID-19疫苗的兩種版本納入了緊急使用列表,這兩種疫苗由印度血清研究所和
>> SKBio公司生產。2021年3月12日,世衛組織將由楊森(強生公司)開發的COVID-19疫苗Ad26.COV2.S
>> 納入了緊急使用列表。世衛組織在今年6月前會繼續將其他疫苗產品納入緊急使用列表。    </fo:inline>
>> </fo:block>
>>
>

mixed Chinese/English text overwritten

Posted by jh...@gmail.com.
There's also an issue with letter-spacing between Chinese and English,
which causes the following English letter to "overwrite" the last Chinese
glyph.  Maybe its the same underlying problem as the "full justification"
one in my quoted email below?

My test fo is below.  Is there a fop dev who would be interested in fixing
these issues on a fee for service basis?

thanks .. Jason



   <fo:block font-size="12.0pt" line-height="107%"
space-after="0.11in">
<inline xmlns="http://www.w3.org/1999/XSL/Format"
font-size="12.0pt" letter-spacing="0.02in">
<inline font-family="PMingLiU">有針對</inline>
</inline>
<inline xmlns="http://www.w3.org/1999/XSL/Format"
font-size="12.0pt" letter-spacing="0.02in">
<inline font-family="Times New Roman">spacing 31</inline>
</inline>
</fo:block>
<fo:block font-size="12.0pt" line-height="107%"
space-after="0.11in">
<inline xmlns="http://www.w3.org/1999/XSL/Format"
font-size="12.0pt" letter-spacing="1mm">
<inline font-family="Times New Roman">spacing 61</inline>
</inline>
<inline xmlns="http://www.w3.org/1999/XSL/Format"
font-size="12.0pt" letter-spacing="1mm">
<inline font-family="PMingLiU">有針對</inline>
</inline>
</fo:block>
<fo:block font-size="12.0pt" line-height="107%"
space-after="0.11in">
<inline xmlns="http://www.w3.org/1999/XSL/Format"
font-size="12.0pt" letter-spacing="0.06in">
<inline font-family="PMingLiU">有針對</inline>
</inline>
<inline xmlns="http://www.w3.org/1999/XSL/Format"
font-size="12.0pt" letter-spacing="2mm">
<inline font-family="Times New Roman">spacing 91</inline>
</inline>
</fo:block>



On Sun, May 30, 2021 at 11:18 AM <jh...@gmail.com> wrote:

> Hi there, just wondering if anybody has any experience/tips in getting
> full justification to work automagically for mixed Chinese/English
> paragraphs?  Most Chinese glyphs are fixed width, so that's easy, but even
> in a monospaced font (eg NSimSun), the English glyphs are narrower.
>
> I've attached below the FO I've been playing with.
>
> thanks .. Jason
>
>    <fo:block text-align="justify">
> <fo:inline font-family="NSimSun">世衛組織於2020年12月31日將輝瑞的COVID-19疫苗(BNT162b2
> )納入緊急使用列表。2021年2月15日,世衛組織將阿斯利康/牛津的COVID-19疫苗的兩種版本納入了緊急使用列表,這兩種疫苗由印度血清研究所和
> SKBio公司生產。2021年3月12日,世衛組織將由楊森(強生公司)開發的COVID-19疫苗Ad26.COV2.S
> 納入了緊急使用列表。世衛組織在今年6月前會繼續將其他疫苗產品納入緊急使用列表。    </fo:inline>
> </fo:block>
>