Hi all, Does anyone have a simple setup of fonts to write a small Japanese document (possibly with furagana) ? I am using MacOS and I have several Japanese fonts on the system. I have some old examples which do not typeset correctly now, maybe because they use the old module simplefonts and commands such as \setcjkmainfont and friends. Many thanks in advance: Otared
Am 26.02.24 um 21:08 schrieb Otared Kavian:
Does anyone have a simple setup of fonts to write a small Japanese document (possibly with furagana) ? I am using MacOS and I have several Japanese fonts on the system. I have some old examples which do not typeset correctly now, maybe because they use the old module simplefonts and commands such as \setcjkmainfont and friends.
Try to replace the simplefonts calls with something like \definefontfamily[myfonts][rm][SomeFont] \definefontfamily[myfonts][ss][SomeOtherFont] \setupbodyfont[myfonts,rm,12pt] With Latin fonts, it usually works. Hraban
Hi Hraban, Your are right indeed ! I didn’t imagine that it was so easy to set up a document to write in Japanese… Actually I followed the example by Emanuel Han which is essentially what you suggest (although he gave me also the hint to add the furagana). Best regards: Otared
On 26 Feb 2024, at 21:16, Henning Hraban Ramm
wrote: Am 26.02.24 um 21:08 schrieb Otared Kavian:
Does anyone have a simple setup of fonts to write a small Japanese document (possibly with furagana) ? I am using MacOS and I have several Japanese fonts on the system. I have some old examples which do not typeset correctly now, maybe because they use the old module simplefonts and commands such as \setcjkmainfont and friends.
Try to replace the simplefonts calls with something like
\definefontfamily[myfonts][rm][SomeFont] \definefontfamily[myfonts][ss][SomeOtherFont]
\setupbodyfont[myfonts,rm,12pt]
With Latin fonts, it usually works.
Hraban ___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl webpage : https://www.pragma-ade.nl / https://context.aanhet.net (mirror) archive : https://github.com/contextgarden/context wiki : https://wiki.contextgarden.net ___________________________________________________________________________________
Otared Kavian e-mail: otared@gmail.com Phone: +33 6 88 26 70 95
Dear Otared, I am using Korean as main language. I used use typescript file, but recently I use \definefontfamily. Since using Japanese font is similar to use Korean font, I show my example of using Noto fonts. It was made by the help of expert of this list long time ago. You may change "Noto Serif CJK KR” to Japanese font. I also use "\setscript[hangul]” when I use Korean as mainlanaguage. I hope that you may enhance the following code. Best regards, Dalyoung %%% Noto Fonts \definefontfamily[notoFont][rm][Noto Serif CJK KR] [ it={style:regular,features:{*,slanted}}, sl={style:regular,features:{*,slanted}}, bi={style:bold,features:{*,slanted}},force=yes] \definefontfamily[notoFont][ss][Noto Sans CJK KR] [ it={style:regular,features:{*,slanted}}, sl={style:regular,features:{*,slanted}}, bi={style:bold,features:{*,slanted}},force=yes] \definefontfamily[notoFont][tt][Noto Sans Mono CJK KR] [ it={style:regular,features:{*,slanted}}, sl={style:regular,features:{*,slanted}}, bi={style:bold,features:{*,slanted}},force=yes] \definefontfamily[notoFont][math][Tex Gyre Termes Math] %\definefontfamily[notoFonts][math][Tex Gyre Pagella Math] %\definefontfamily[notoCJK][math][Tex Gyre Aventor]
2024. 2. 27. 오전 6:49, Otared Kavian
작성: Hi Hraban,
Your are right indeed ! I didn’t imagine that it was so easy to set up a document to write in Japanese… Actually I followed the example by Emanuel Han which is essentially what you suggest (although he gave me also the hint to add the furagana).
Best regards: Otared
On 26 Feb 2024, at 21:16, Henning Hraban Ramm
mailto:texml@fiee.net> wrote: Am 26.02.24 um 21:08 schrieb Otared Kavian:
Does anyone have a simple setup of fonts to write a small Japanese document (possibly with furagana) ? I am using MacOS and I have several Japanese fonts on the system. I have some old examples which do not typeset correctly now, maybe because they use the old module simplefonts and commands such as \setcjkmainfont and friends.
Try to replace the simplefonts calls with something like
\definefontfamily[myfonts][rm][SomeFont] \definefontfamily[myfonts][ss][SomeOtherFont]
\setupbodyfont[myfonts,rm,12pt]
With Latin fonts, it usually works.
Hraban ___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl mailto:ntg-context@ntg.nl / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl webpage : https://www.pragma-ade.nl https://www.pragma-ade.nl/ / https://context.aanhet.net https://context.aanhet.net/ (mirror) archive : https://github.com/contextgarden/context https://github.com/contextgarden/context wiki : https://wiki.contextgarden.net https://wiki.contextgarden.net/ ___________________________________________________________________________________
Otared Kavian e-mail: otared@gmail.com mailto:otared@gmail.com Phone: +33 6 88 26 70 95
___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl webpage : https://www.pragma-ade.nl / https://context.aanhet.net (mirror) archive : https://github.com/contextgarden/context wiki : https://wiki.contextgarden.net ___________________________________________________________________________________
Dear Dalyoung, Thank you very much for your insight. I downloaded the Noto Serif JP fonts and set up a fontfamily as you indicated, by adding \setscript[nihongo] which solves a problem I had with line breakings. And everything works smoothly! So, for the mail archive, here is what I have and what works fine: %%% Noto Fonts \definefontfamily[JapaneseFont][rm][Noto Serif JP] [ it={style:regular,features:{*,slanted}}, sl={style:regular,features:{*,slanted}}, bi={style:bold,features:{*,slanted}},force=yes] \definefontfamily[JapaneseFont][ss][Noto Serif JP] [ it={style:regular,features:{*,slanted}}, sl={style:regular,features:{*,slanted}}, bi={style:bold,features:{*,slanted}},force=yes] \definefontfamily[JapaneseFont][tt][Noto Serif JP] [ it={style:regular,features:{*,slanted}}, sl={style:regular,features:{*,slanted}}, bi={style:bold,features:{*,slanted}},force=yes] \definefontfamily[JapaneseFont][math][Tex Gyre Termes Math] %\definefontfamily[JapaneseFont][math][Tex Gyre Pagella Math] %\definefontfamily[JapaneseFont][math][Tex Gyre Aventor] %%%% \setupbodyfont[JapaneseFont,12pt] \setupruby[location=top,voffset=-2ex] \setupwhitespace[big] \setscript[nihongo] \starttext \ruby{早}{はや}く。 いきましょう。 \stoptext Best regards: Otared
On 27 Feb 2024, at 13:55, Jeong Dal via ntg-context
wrote: Dear Otared,
I am using Korean as main language. I used use typescript file, but recently I use \definefontfamily. Since using Japanese font is similar to use Korean font, I show my example of using Noto fonts. It was made by the help of expert of this list long time ago.
You may change "Noto Serif CJK KR” to Japanese font.
I also use "\setscript[hangul]” when I use Korean as mainlanaguage.
I hope that you may enhance the following code.
Best regards,
Dalyoung
%%% Noto Fonts
\definefontfamily[notoFont][rm][Noto Serif CJK KR] [ it={style:regular,features:{*,slanted}}, sl={style:regular,features:{*,slanted}}, bi={style:bold,features:{*,slanted}},force=yes]
\definefontfamily[notoFont][ss][Noto Sans CJK KR] [ it={style:regular,features:{*,slanted}}, sl={style:regular,features:{*,slanted}}, bi={style:bold,features:{*,slanted}},force=yes]
\definefontfamily[notoFont][tt][Noto Sans Mono CJK KR] [ it={style:regular,features:{*,slanted}}, sl={style:regular,features:{*,slanted}}, bi={style:bold,features:{*,slanted}},force=yes]
\definefontfamily[notoFont][math][Tex Gyre Termes Math] %\definefontfamily[notoFonts][math][Tex Gyre Pagella Math] %\definefontfamily[notoCJK][math][Tex Gyre Aventor]
2024. 2. 27. 오전 6:49, Otared Kavian
mailto:otared@gmail.com> 작성: Hi Hraban,
Your are right indeed ! I didn’t imagine that it was so easy to set up a document to write in Japanese… Actually I followed the example by Emanuel Han which is essentially what you suggest (although he gave me also the hint to add the furagana).
Best regards: Otared
On 26 Feb 2024, at 21:16, Henning Hraban Ramm
mailto:texml@fiee.net> wrote: Am 26.02.24 um 21:08 schrieb Otared Kavian:
Does anyone have a simple setup of fonts to write a small Japanese document (possibly with furagana) ? I am using MacOS and I have several Japanese fonts on the system. I have some old examples which do not typeset correctly now, maybe because they use the old module simplefonts and commands such as \setcjkmainfont and friends.
Try to replace the simplefonts calls with something like
\definefontfamily[myfonts][rm][SomeFont] \definefontfamily[myfonts][ss][SomeOtherFont]
\setupbodyfont[myfonts,rm,12pt]
With Latin fonts, it usually works.
Hraban ___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl mailto:ntg-context@ntg.nl / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl webpage : https://www.pragma-ade.nl https://www.pragma-ade.nl/ / https://context.aanhet.net https://context.aanhet.net/ (mirror) archive : https://github.com/contextgarden/context https://github.com/contextgarden/context wiki : https://wiki.contextgarden.net https://wiki.contextgarden.net/ ___________________________________________________________________________________
Otared Kavian e-mail: otared@gmail.com mailto:otared@gmail.com Phone: +33 6 88 26 70 95
___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl mailto:ntg-context@ntg.nl / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl webpage : https://www.pragma-ade.nl https://www.pragma-ade.nl/ / https://context.aanhet.net https://context.aanhet.net/ (mirror) archive : https://github.com/contextgarden/context https://github.com/contextgarden/context wiki : https://wiki.contextgarden.net https://wiki.contextgarden.net/ ___________________________________________________________________________________
___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl webpage : https://www.pragma-ade.nl / https://context.aanhet.net (mirror) archive : https://github.com/contextgarden/context wiki : https://wiki.contextgarden.net ___________________________________________________________________________________
Otared Kavian e-mail: otared@gmail.com Phone: +33 6 88 26 70 95
Am 28.02.24 um 08:34 schrieb Otared Kavian:
Dear Dalyoung,
Thank you very much for your insight. I downloaded the Noto Serif JP fonts and set up a fontfamily as you indicated, by adding \setscript[nihongo] which solves a problem I had with line breakings. And everything works smoothly!
So, for the mail archive, here is what I have and what works fine:
%%% Noto Fonts
\definefontfamily[JapaneseFont][rm][Noto Serif JP] [ it={style:regular,features:{*,slanted}}, sl={style:regular,features:{*,slanted}}, bi={style:bold,features:{*,slanted}},force=yes]
\definefontfamily[JapaneseFont][ss][Noto Serif JP] [ it={style:regular,features:{*,slanted}}, sl={style:regular,features:{*,slanted}}, bi={style:bold,features:{*,slanted}},force=yes]
\definefontfamily[JapaneseFont][tt][Noto Serif JP] [ it={style:regular,features:{*,slanted}}, sl={style:regular,features:{*,slanted}}, bi={style:bold,features:{*,slanted}},force=yes]
\definefontfamily[JapaneseFont][math][Tex Gyre Termes Math] %\definefontfamily[JapaneseFont][math][Tex Gyre Pagella Math] %\definefontfamily[JapaneseFont][math][Tex Gyre Aventor]
%%%%
\setupbodyfont[JapaneseFont,12pt] \setupruby[location=top,voffset=-2ex] \setupwhitespace[big] \setscript[nihongo]
\starttext \ruby{早}{はや}く。 いきましょう。 \stoptext
Best regards: Otared
Thanks all contributors, I added this to https://wiki.contextgarden.net/Chinese_Japanese_and_Korean I guess you also should set \mainlanguage[ja], I added it, also \mainlanguage[kr] for Korean. I don’t know if the setups for Chinese and Korean are still valid, I just removed \setencoding. Hraban
Hi Hraban ! I also used to write this, if the main language is European : \definefallbackfamily [mainface] [rm] [ipamincho] [range=cjkunifiedideographs] Hope this is useful anymore, JP Le 28/02/2024 à 18:34, Henning Hraban Ramm a écrit :
Am 28.02.24 um 08:34 schrieb Otared Kavian:
Dear Dalyoung,
Thank you very much for your insight. I downloaded the Noto Serif JP fonts and set up a fontfamily as you indicated, by adding \setscript[nihongo] which solves a problem I had with line breakings. And everything works smoothly!
So, for the mail archive, here is what I have and what works fine:
%%% Noto Fonts
\definefontfamily[JapaneseFont][rm][Noto Serif JP] [ it={style:regular,features:{*,slanted}}, sl={style:regular,features:{*,slanted}}, bi={style:bold,features:{*,slanted}},force=yes]
\definefontfamily[JapaneseFont][ss][Noto Serif JP] [ it={style:regular,features:{*,slanted}}, sl={style:regular,features:{*,slanted}}, bi={style:bold,features:{*,slanted}},force=yes]
\definefontfamily[JapaneseFont][tt][Noto Serif JP] [ it={style:regular,features:{*,slanted}}, sl={style:regular,features:{*,slanted}}, bi={style:bold,features:{*,slanted}},force=yes]
\definefontfamily[JapaneseFont][math][Tex Gyre Termes Math] %\definefontfamily[JapaneseFont][math][Tex Gyre Pagella Math] %\definefontfamily[JapaneseFont][math][Tex Gyre Aventor]
%%%%
\setupbodyfont[JapaneseFont,12pt] \setupruby[location=top,voffset=-2ex] \setupwhitespace[big] \setscript[nihongo]
\starttext \ruby{早}{はや}く。 いきましょう。 \stoptext
Best regards: Otared
Thanks all contributors, I added this to https://wiki.contextgarden.net/Chinese_Japanese_and_Korean
I guess you also should set \mainlanguage[ja], I added it, also \mainlanguage[kr] for Korean.
I don’t know if the setups for Chinese and Korean are still valid, I just removed \setencoding.
Hraban ___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl webpage : https://www.pragma-ade.nl / https://context.aanhet.net (mirror) archive : https://github.com/contextgarden/context wiki : https://wiki.contextgarden.net ___________________________________________________________________________________
Thank you all for your suggestions and contributions to the wiki.
I don't intend to nag, but when looking at what ConTeXt is producing, I need to state that the result is still far away from a properly typeset Japanese text.
So the nihongo script which comes with ConTeXt handles line breaks / line wrapping. But the line break rules defined in it need a rework, because they don't follow the standards. The standards are documented here: https://www.w3.org/TR/jlreq/#possibilities_for_linebreaking_between_characte... , and all affected characters are listed here: https://www.w3.org/TR/jlreq/tables/table_en3.pdf
We have different rules, depending what kind of character is surpassing the text width (or is in its last position).
Rule 1:
Before closing brackets, closing quotation marks, iteration marks, the Prolonged sound mark and small Kana, line breaking is prohibited.
’”)〕]}〉》」』】ヽヾゝゞ々ーぁぃぅぇぉァィゥェォっゃゅょッャュョ etc.
The actual programmed behaviour by the nihongo script is that, if in the position which exceeds the line width, these characters jump to the next line and take the previous character with them. If they're in the last position of the line, they stay where they are. This behaviour is correct.
Rule 2:
After opening Brackets and opening quotation marks, line breaking is prohibited (but not before).
‘“(〔[{〈《「『【
The actual programmed behaviour by the nihongo script is that these characters jump to the next line and take the previous character with them. This behaviour is wrong. They should jump to the next line without taking the previous character with them, just like any regular character. The difference to a regular character is that they jump already when still within the line length, and they're in the last position of the line. The correct behaviour can be seen in LibreOffice Writer in action.
Rule 3:
Comma (tōten), full width comma, full stop
、,。
The actual programmed behaviour by the nihongo script is that, if in the position which exceeds the line width, these characters jump to the next line and take the previous character with them. This behaviour is wrong.
They have to be put back to the end of the previous line, but beyond the specified line length. (JIS Z 8125) (Search for "Line adjustment by hanging punctuation" under https://www.w3.org/TR/jlreq/ )
If they're in the last position of the line, they stay where they are. The correct behaviour can be seen in LibreOffice Writer in action.
Rules 4, 5, ...:
Combinations of inseparable characters... (see https://www.w3.org/TR/jlreq/#possibilities_for_linebreaking_between_characte... ) and eventually more, which I didn't test.
It might be useful to define three scripts nihongo_loose, nihongo_strict and nihongo_very_strict which each implement one of the 3 cases described here: https://www.w3.org/TR/jlreq/#addendum_a
According the line gap (Otared uses \setupwhitespace[big], which is exceeding common line gaps), I'd like to quote from https://www.w3.org/TR/jlreq/ :
It is common that the line gap for the kihon-hanmen is set to a value between half-em spacing and the one em spacing of the character frame used for the kihon-hanmen. Half-em spacing can be chosen in cases where the line length is short, but one em spacing or close to it is more appropriate when the line length is longer than 35 characters.
I like the standard line gap which is provided by ConTeXt, which is equivalent to \setupwhitespace[0pt]. Even when using ruby, it works well. I found the best voffset for ruby to be -1.7ex.
The line adjustment provided by ConTeXt by default is not meeting the needs for Japanese (and Chinese) text, which follow a grid pattern. Especially the last line of a paragraph is squeezed, which is "hurting the eye".
When characters need to jump to the next line due to previously discussed line breaking rules, ConTeXt seems to apply "Line adjustment by inter-character spacing expansion", which is a valid method according to https://www.w3.org/TR/jlreq/#line_adjustment , although "Line adjustment by inter-character spacing reduction" is preferred.
The last point which ConTeXt is missing, when talking about Japanese typesetting, is vertical writing.
I know, this is a lot of work. Hopefully we can achieve with joint efforts to make ConTeXt Japanese ready.
If I happen to have made false statements, please accept my apology. I tried to be of help as far as I could. I grew up in Japan and know more or less how typeset text should look like.
Emanuel
On Feb. 28 2024, at 7:44 pm, Jean-Pierre Delange
Hi Hraban !
I also used to write this, if the main language is European : \definefallbackfamily [mainface] [rm] [ipamincho] [range=cjkunifiedideographs]
Hope this is useful anymore, JP Le 28/02/2024 à 18:34, Henning Hraban Ramm a écrit :
Am 28.02.24 um 08:34 schrieb Otared Kavian:
Dear Dalyoung,
Thank you very much for your insight. I downloaded the Noto Serif JP fonts and set up a fontfamily as you indicated, by adding \setscript[nihongo] which solves a problem I had with line breakings. And everything works smoothly!
So, for the mail archive, here is what I have and what works fine:
%%% Noto Fonts
\definefontfamily[JapaneseFont][rm][Noto Serif JP] [ it={style:regular,features:{*,slanted}}, sl={style:regular,features:{*,slanted}}, bi={style:bold,features:{*,slanted}},force=yes]
\definefontfamily[JapaneseFont][ss][Noto Serif JP] [ it={style:regular,features:{*,slanted}}, sl={style:regular,features:{*,slanted}}, bi={style:bold,features:{*,slanted}},force=yes]
\definefontfamily[JapaneseFont][tt][Noto Serif JP] [ it={style:regular,features:{*,slanted}}, sl={style:regular,features:{*,slanted}}, bi={style:bold,features:{*,slanted}},force=yes]
\definefontfamily[JapaneseFont][math][Tex Gyre Termes Math] %\definefontfamily[JapaneseFont][math][Tex Gyre Pagella Math] %\definefontfamily[JapaneseFont][math][Tex Gyre Aventor]
%%%%
\setupbodyfont[JapaneseFont,12pt] \setupruby[location=top,voffset=-2ex] \setupwhitespace[big] \setscript[nihongo]
\starttext \ruby{早}{はや}く。 いきましょう。 \stoptext
Best regards: Otared
Thanks all contributors, I added this to https://wiki.contextgarden.net/Chinese_Japanese_and_Korean
I guess you also should set \mainlanguage[ja], I added it, also \mainlanguage[kr] for Korean.
I don’t know if the setups for Chinese and Korean are still valid, I just removed \setencoding.
Hraban ___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl webpage : https://www.pragma-ade.nl / https://context.aanhet.net (mirror) archive : https://github.com/contextgarden/context wiki : https://wiki.contextgarden.net ___________________________________________________________________________________
___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl webpage : https://www.pragma-ade.nl / https://context.aanhet.net (mirror) archive : https://github.com/contextgarden/context wiki : https://wiki.contextgarden.net ___________________________________________________________________________________
Am 28.02.24 um 20:51 schrieb Emanuel Han via ntg-context:
Thank you all for your suggestions and contributions to the wiki.
I don't intend to nag, but when looking at what ConTeXt is producing, I need to state that the result is still far away from a properly typeset Japanese text.
That’s the result of apparently nobody having an interest in it and the developers not knowing enough about CJK. (Look at Arabic: Without Idris and the funding for OrientalTeX, the support would be just not there.) Often enough people demand features but don’t stay long enough to evolve them until they’re “ready for prime time”. Now it’s your chance to make it better. Don’t give up. Hraban
Emanuel Han via ntg-context schrieb am 28.02.2024 um 20:51:
Thank you all for your suggestions and contributions to the wiki.
I don't intend to nag, but when looking at what ConTeXt is producing, I need to state that the result is still far away from a properly typeset Japanese text.
So the nihongo script which comes with ConTeXt handles *line breaks / line wrapping*. But the line break rules defined in it need a rework, because they don't follow the standards. The standards are documented here: https://www.w3.org/TR/jlreq/#possibilities_for_linebreaking_between_characte... , and all affected characters are listed here: https://www.w3.org/TR/jlreq/tables/table_en3.pdf
We have different rules, depending what kind of character is surpassing the text width (or is in its last position).
Rule 1:
Before closing brackets, closing quotation marks, iteration marks, the Prolonged sound mark and small Kana, line breaking is prohibited.
’”)〕]}〉》」』】ヽヾゝゞ々ーぁぃぅぇぉァィゥェォっゃゅょッャュョ etc.
The actual programmed behaviour by the nihongo script is that, if in the position which exceeds the line width, these characters jump to the next line and take the previous character with them. If they're in the last position of the line, they stay where they are. This behaviour is correct.
Rule 2:
After opening Brackets and opening quotation marks, line breaking is prohibited (but not before).
‘“(〔[{〈《「『【
The actual programmed behaviour by the nihongo script is that these characters jump to the next line and take the previous character with them. This behaviour is wrong. They should jump to the next line without taking the previous character with them, just like any regular character. The difference to a regular character is that they jump already when still within the line length, and they're in the last position of the line. The correct behaviour can be seen in LibreOffice Writer in action.
Can you provide a minimal example because this should be correct and if not it's a bug.
Rule 3: Comma (tōten), full width comma, full stop
、,。
The actual programmed behaviour by the nihongo script is that, if in the position which exceeds the line width, these characters jump to the next line and take the previous character with them. This behaviour is wrong. They have to be put back to the end of the previous line, but beyond the specified line length. (JIS Z 8125) (Search for "Line adjustment by hanging punctuation" under https://www.w3.org/TR/jlreq/ ) If they're in the last position of the line, they stay where they are. The correct behaviour can be seen in LibreOffice Writer in action.
This is handled by the protrusion mechanism and enabled with paragraph alignment.
Rules 4, 5, ...: Combinations of inseparable characters... (see https://www.w3.org/TR/jlreq/#possibilities_for_linebreaking_between_characte... ) and eventually more, which I didn't test.
It might be useful to define three scripts nihongo_loose, nihongo_strict and nihongo_very_strict which each implement one of the 3 cases described here: https://www.w3.org/TR/jlreq/#addendum_a
According the *line gap* (Otared uses \setupwhitespace[big], which is exceeding common line gaps), I'd like to quote from https://www.w3.org/TR/jlreq/ :
/It is common that the line gap for the kihon-hanmen is set to a value between half-em spacing and the one em spacing of the character frame used for the kihon-hanmen. Half-em spacing can be chosen in cases where the line length is short, but one em spacing or close to it is more appropriate when the line length is longer than 35 characters./
I like the standard line gap which is provided by ConTeXt, which is equivalent to \setupwhitespace/[0pt]/. Even when using ruby, it works well. I found the best voffset for ruby to be -1.7ex.
The \setupwhitespace setting controls the distance between paragraphs but you're looking for the \setuplinespace command.
The *line adjustment* provided by ConTeXt by default is not meeting the needs for Japanese (and Chinese) text, which follow a grid pattern. Especially the last line of a paragraph is squeezed, which is "hurting the eye". When characters need to jump to the next line due to previously discussed line breaking rules, ConTeXt seems to apply "Line adjustment by inter-character spacing expansion", which is a valid method according to https://www.w3.org/TR/jlreq/#line_adjustment , although "Line adjustment by inter-character spacing reduction" is preferred.
The last point which ConTeXt is missing, when talking about Japanese typesetting, is vertical writing.
Vertical typesetting is possible but only for small text blocks which fit on a single page. Typesetting text which spans multiple pages isn't supported yet (it was possible ages ago with MkII) because nobody needed it yet. Wolfgang
Hi, In Korea, LaTeX is popular rather than ConTeXt since mathematicians initiated the use of TeX in Korea and they use LaTeX mainly. But right now, there are so many non-math people who developed many things for Korean & LaTeX. Many years ago, Hans and Taco visited the seminar held by KTUG. They discussed with the experts KTUG about to use Korean. From then, there are many progress to use Korean in ConTeXt. Now, I am using ConTeXt to produce textbooks and manuals in Korean with pleasure. Unfortunately, there is a little problem in spacing, for example, “) ,”. It is rare case, so I can correct it manually without problem. In general, ConTeXt typesets Korean nicely. Thanks Hans and ConTeXt team. For Koreans, I use \mainlanguage[kr] \setscript[hangul] The rule of line break are very similar to that of Japanese. I think that “hangul” script handles it and other things. I am just a user of ConTeXt, but if you need any information about Korean to enhance the usage of Korean in ConTeXt, please let me know. Thanks again to Hans, team, and people in this list. Best regards, Dalyoung
2024. 2. 29. 오전 4:51, Emanuel Han via ntg-context
작성: Thank you all for your suggestions and contributions to the wiki.
I don't intend to nag, but when looking at what ConTeXt is producing, I need to state that the result is still far away from a properly typeset Japanese text.
So the nihongo script which comes with ConTeXt handles line breaks / line wrapping. But the line break rules defined in it need a rework, because they don't follow the standards. The standards are documented here: https://www.w3.org/TR/jlreq/#possibilities_for_linebreaking_between_characte... , and all affected characters are listed here: https://www.w3.org/TR/jlreq/tables/table_en3.pdf
We have different rules, depending what kind of character is surpassing the text width (or is in its last position).
Rule 1:
Before closing brackets, closing quotation marks, iteration marks, the Prolonged sound mark and small Kana, line breaking is prohibited.
’”)〕]}〉》」』】ヽヾゝゞ々ーぁぃぅぇぉァィゥェォっゃゅょッャュョ etc.
The actual programmed behaviour by the nihongo script is that, if in the position which exceeds the line width, these characters jump to the next line and take the previous character with them. If they're in the last position of the line, they stay where they are. This behaviour is correct.
Rule 2:
After opening Brackets and opening quotation marks, line breaking is prohibited (but not before).
‘“(〔[{〈《「『【
The actual programmed behaviour by the nihongo script is that these characters jump to the next line and take the previous character with them. This behaviour is wrong. They should jump to the next line without taking the previous character with them, just like any regular character. The difference to a regular character is that they jump already when still within the line length, and they're in the last position of the line. The correct behaviour can be seen in LibreOffice Writer in action.
Rule 3:
Comma (tōten), full width comma, full stop
、,。
The actual programmed behaviour by the nihongo script is that, if in the position which exceeds the line width, these characters jump to the next line and take the previous character with them. This behaviour is wrong. They have to be put back to the end of the previous line, but beyond the specified line length. (JIS Z 8125) (Search for "Line adjustment by hanging punctuation" under https://www.w3.org/TR/jlreq/ ) If they're in the last position of the line, they stay where they are. The correct behaviour can be seen in LibreOffice Writer in action.
Rules 4, 5, ...:
Combinations of inseparable characters... (see https://www.w3.org/TR/jlreq/#possibilities_for_linebreaking_between_characte... ) and eventually more, which I didn't test.
It might be useful to define three scripts nihongo_loose, nihongo_strict and nihongo_very_strict which each implement one of the 3 cases described here: https://www.w3.org/TR/jlreq/#addendum_a
According the line gap (Otared uses \setupwhitespace[big], which is exceeding common line gaps), I'd like to quote from https://www.w3.org/TR/jlreq/ :
It is common that the line gap for the kihon-hanmen is set to a value between half-em spacing and the one em spacing of the character frame used for the kihon-hanmen. Half-em spacing can be chosen in cases where the line length is short, but one em spacing or close to it is more appropriate when the line length is longer than 35 characters.
I like the standard line gap which is provided by ConTeXt, which is equivalent to \setupwhitespace[0pt]. Even when using ruby, it works well. I found the best voffset for ruby to be -1.7ex.
The line adjustment provided by ConTeXt by default is not meeting the needs for Japanese (and Chinese) text, which follow a grid pattern. Especially the last line of a paragraph is squeezed, which is "hurting the eye".
When characters need to jump to the next line due to previously discussed line breaking rules, ConTeXt seems to apply "Line adjustment by inter-character spacing expansion", which is a valid method according to https://www.w3.org/TR/jlreq/#line_adjustment , although "Line adjustment by inter-character spacing reduction" is preferred.
The last point which ConTeXt is missing, when talking about Japanese typesetting, is vertical writing.
I know, this is a lot of work. Hopefully we can achieve with joint efforts to make ConTeXt Japanese ready.
If I happen to have made false statements, please accept my apology. I tried to be of help as far as I could. I grew up in Japan and know more or less how typeset text should look like.
Emanuel
On Feb. 28 2024, at 7:44 pm, Jean-Pierre Delange
wrote: Hi Hraban ! I also used to write this, if the main language is European :
\definefallbackfamily [mainface] [rm] [ipamincho] [range=cjkunifiedideographs]
Hope this is useful anymore,
JP
Le 28/02/2024 à 18:34, Henning Hraban Ramm a écrit :
Am 28.02.24 um 08:34 schrieb Otared Kavian:
Dear Dalyoung,
Thank you very much for your insight. I downloaded the Noto Serif JP fonts and set up a fontfamily as you indicated, by adding \setscript[nihongo] which solves a problem I had with line breakings. And everything works smoothly!
So, for the mail archive, here is what I have and what works fine:
%%% Noto Fonts
\definefontfamily[JapaneseFont][rm][Noto Serif JP] [ it={style:regular,features:{*,slanted}}, sl={style:regular,features:{*,slanted}}, bi={style:bold,features:{*,slanted}},force=yes]
\definefontfamily[JapaneseFont][ss][Noto Serif JP] [ it={style:regular,features:{*,slanted}}, sl={style:regular,features:{*,slanted}}, bi={style:bold,features:{*,slanted}},force=yes]
\definefontfamily[JapaneseFont][tt][Noto Serif JP] [ it={style:regular,features:{*,slanted}}, sl={style:regular,features:{*,slanted}}, bi={style:bold,features:{*,slanted}},force=yes]
\definefontfamily[JapaneseFont][math][Tex Gyre Termes Math] %\definefontfamily[JapaneseFont][math][Tex Gyre Pagella Math] %\definefontfamily[JapaneseFont][math][Tex Gyre Aventor]
%%%%
\setupbodyfont[JapaneseFont,12pt] \setupruby[location=top,voffset=-2ex] \setupwhitespace[big] \setscript[nihongo]
\starttext \ruby{早}{はや}く。 いきましょう。 \stoptext
Best regards: Otared
Thanks all contributors, I added this to https://wiki.contextgarden.net/Chinese_Japanese_and_Korean
I guess you also should set \mainlanguage[ja], I added it, also \mainlanguage[kr] for Korean.
I don’t know if the setups for Chinese and Korean are still valid, I just removed \setencoding.
Hraban ___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl webpage : https://www.pragma-ade.nl / https://context.aanhet.net (mirror) archive : https://github.com/contextgarden/context wiki : https://wiki.contextgarden.net ___________________________________________________________________________________
___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl webpage : https://www.pragma-ade.nl / https://context.aanhet.net (mirror) archive : https://github.com/contextgarden/context wiki : https://wiki.contextgarden.net ___________________________________________________________________________________ ___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl webpage : https://www.pragma-ade.nl / https://context.aanhet.net (mirror) archive : https://github.com/contextgarden/context wiki : https://wiki.contextgarden.net ___________________________________________________________________________________
On Wed, 28 Feb 2024 at 20:53, Emanuel Han via ntg-context < ntg-context@ntg.nl> wrote:
Thank you all for your suggestions and contributions to the wiki.
I don't intend to nag, but when looking at what ConTeXt is producing, I need to state that the result is still far away from a properly typeset Japanese text.
So the nihongo script which comes with ConTeXt handles *line breaks / line wrapping*. But the line break rules defined in it need a rework, because they don't follow the standards. The standards are documented here: https://www.w3.org/TR/jlreq/#possibilities_for_linebreaking_between_characte... , and all affected characters are listed here: https://www.w3.org/TR/jlreq/tables/table_en3.pdf
We have different rules, depending what kind of character is surpassing the text width (or is in its last position).
Rule 1:
Before closing brackets, closing quotation marks, iteration marks, the Prolonged sound mark and small Kana, line breaking is prohibited.
’”)〕]}〉》」』】ヽヾゝゞ々ーぁぃぅぇぉァィゥェォっゃゅょッャュョ etc.
The actual programmed behaviour by the nihongo script is that, if in the position which exceeds the line width, these characters jump to the next line and take the previous character with them. If they're in the last position of the line, they stay where they are. This behaviour is correct.
Rule 2:
After opening Brackets and opening quotation marks, line breaking is prohibited (but not before).
‘“(〔[{〈《「『【
The actual programmed behaviour by the nihongo script is that these characters jump to the next line and take the previous character with them. This behaviour is wrong. They should jump to the next line without taking the previous character with them, just like any regular character. The difference to a regular character is that they jump already when still within the line length, and they're in the last position of the line. The correct behaviour can be seen in LibreOffice Writer in action.
Rule 3:
Comma (tōten), full width comma, full stop
、,。
The actual programmed behaviour by the nihongo script is that, if in the position which exceeds the line width, these characters jump to the next line and take the previous character with them. This behaviour is wrong. They have to be put back to the end of the previous line, but beyond the specified line length. (JIS Z 8125) (Search for "Line adjustment by hanging punctuation" under https://www.w3.org/TR/jlreq/ ) If they're in the last position of the line, they stay where they are. The correct behaviour can be seen in LibreOffice Writer in action.
Rules 4, 5, ...:
Combinations of inseparable characters... (see https://www.w3.org/TR/jlreq/#possibilities_for_linebreaking_between_characte... ) and eventually more, which I didn't test.
It might be useful to define three scripts nihongo_loose, nihongo_strict and nihongo_very_strict which each implement one of the 3 cases described here: https://www.w3.org/TR/jlreq/#addendum_a
According the *line gap* (Otared uses \setupwhitespace[big], which is exceeding common line gaps), I'd like to quote from https://www.w3.org/TR/jlreq/ :
*It is common that the line gap for the kihon-hanmen is set to a value between half-em spacing and the one em spacing of the character frame used for the kihon-hanmen. Half-em spacing can be chosen in cases where the line length is short, but one em spacing or close to it is more appropriate when the line length is longer than 35 characters.*
I like the standard line gap which is provided by ConTeXt, which is equivalent to \setupwhitespace*[0pt]*. Even when using ruby, it works well. I found the best voffset for ruby to be -1.7ex.
The *line adjustment* provided by ConTeXt by default is not meeting the needs for Japanese (and Chinese) text, which follow a grid pattern. Especially the last line of a paragraph is squeezed, which is "hurting the eye".
When characters need to jump to the next line due to previously discussed line breaking rules, ConTeXt seems to apply "Line adjustment by inter-character spacing expansion", which is a valid method according to https://www.w3.org/TR/jlreq/#line_adjustment , although "Line adjustment by inter-character spacing reduction" is preferred.
The last point which ConTeXt is missing, when talking about Japanese typesetting, is vertical writing.
I know, this is a lot of work. Hopefully we can achieve with joint efforts to make ConTeXt Japanese ready.
If I happen to have made false statements, please accept my apology. I tried to be of help as far as I could. I grew up in Japan and know more or less how typeset text should look like.
Emanuel
It would be nice if you can put your notes above into https://wiki.contextgarden.net/Chinese_Japanese_and_Korean or in general improve/maintain that page (e.g. the links about the fonts are broken at the moment) Perhaps with Jeong Dal ? Just to say, a few days ago I have seen https://ken-lunde.medium.com/genuine-han-unification-redux-3912b561ecae (only webp images, so a bit tricky to make a pdf) -- luigi
Dear all, thanks for your contributions.
Sure I'll update the https://wiki.contextgarden.net/Chinese_Japanese_and_Korean hopefully with the help of Jeong Dal and others as soon as things are sorted out.
In attached example, the opening Brackets (I marked them with \color[red]{【} and \color[red]{{}) are taking the previous character with them to the next line. Please remove these to see that the previous character would stay on the previous line. Thanks Wolfgang for checking wether this is a bug.
I was not successful in figuring out how the protrusion mechanism can be set in order to keep full stops and commas on the previous line (protruding the column box). Could you please give me a hint, Wolfgang? Thanks. There's a \color[red]{。} in my example which should not jump to the next line.
My example follows the Kihon-hanmen dimensioning as described in https://www.w3.org/TR/jlreq . What could be the reason that lines which could hold 25 characters are having only 24 characters, for example lines 2, 3 or 13 in column 1? I would expect them to have 25 characters, the same as for example lines 7, 9 or 16 in column 1.
How can I change alignment of the lines so that the highest character boxes align with the top border of the layout boxes for text and header and with the bottom border of the layout box for footer? I hope that when this is achieved for the layout box for text, then this box would hold the expected 45 lines, and not 44 lines as it is doing now. Ruby characters in the first line should protrude the box, what they already do.
I tried to implement the 1em hskip of the header and footer away from the page border. While it works for left aligned headers and footers, it doesn't for the right aligned headers and footers (negative hskip has no effect). How to solve this problem?
Also how to get rid of the first empty page?
I'm happy to get suggestions for improving my example code. This example could then be put to the wiki.
I try to continue to work on making ConTeXt usable for Japanese with the help of you all. Next step might be the realm and position of headings which seem complicated and for which I have no ideas.
Best regards
Emanuel
On März 1 2024, at 8:04 am, luigi scarso
On Wed, 28 Feb 2024 at 20:53, Emanuel Han via ntg-context
wrote: Thank you all for your suggestions and contributions to the wiki.
I don't intend to nag, but when looking at what ConTeXt is producing, I need to state that the result is still far away from a properly typeset Japanese text. So the nihongo script which comes with ConTeXt handles line breaks / line wrapping. But the line break rules defined in it need a rework, because they don't follow the standards. The standards are documented here: https://www.w3.org/TR/jlreq/#possibilities_for_linebreaking_between_characte... , and all affected characters are listed here: https://www.w3.org/TR/jlreq/tables/table_en3.pdf We have different rules, depending what kind of character is surpassing the text width (or is in its last position). Rule 1: Before closing brackets, closing quotation marks, iteration marks, the Prolonged sound mark and small Kana, line breaking is prohibited. ’”)〕]}〉》」』】ヽヾゝゞ々ーぁぃぅぇぉァィゥェォっゃゅょッャュョ etc. The actual programmed behaviour by the nihongo script is that, if in the position which exceeds the line width, these characters jump to the next line and take the previous character with them. If they're in the last position of the line, they stay where they are. This behaviour is correct. Rule 2: After opening Brackets and opening quotation marks, line breaking is prohibited (but not before). ‘“(〔[{〈《「『【 The actual programmed behaviour by the nihongo script is that these characters jump to the next line and take the previous character with them. This behaviour is wrong. They should jump to the next line without taking the previous character with them, just like any regular character. The difference to a regular character is that they jump already when still within the line length, and they're in the last position of the line. The correct behaviour can be seen in LibreOffice Writer in action. Rule 3: Comma (tōten), full width comma, full stop 、,。 The actual programmed behaviour by the nihongo script is that, if in the position which exceeds the line width, these characters jump to the next line and take the previous character with them. This behaviour is wrong. They have to be put back to the end of the previous line, but beyond the specified line length. (JIS Z 8125) (Search for "Line adjustment by hanging punctuation" under https://www.w3.org/TR/jlreq/ ) If they're in the last position of the line, they stay where they are. The correct behaviour can be seen in LibreOffice Writer in action.
Rules 4, 5, ...: Combinations of inseparable characters... (see https://www.w3.org/TR/jlreq/#possibilities_for_linebreaking_between_characte... ) and eventually more, which I didn't test. It might be useful to define three scripts nihongo_loose, nihongo_strict and nihongo_very_strict which each implement one of the 3 cases described here: https://www.w3.org/TR/jlreq/#addendum_a According the line gap (Otared uses \setupwhitespace[big], which is exceeding common line gaps), I'd like to quote from https://www.w3.org/TR/jlreq/ : It is common that the line gap for the kihon-hanmen is set to a value between half-em spacing and the one em spacing of the character frame used for the kihon-hanmen. Half-em spacing can be chosen in cases where the line length is short, but one em spacing or close to it is more appropriate when the line length is longer than 35 characters. I like the standard line gap which is provided by ConTeXt, which is equivalent to \setupwhitespace[0pt]. Even when using ruby, it works well. I found the best voffset for ruby to be -1.7ex. The line adjustment provided by ConTeXt by default is not meeting the needs for Japanese (and Chinese) text, which follow a grid pattern. Especially the last line of a paragraph is squeezed, which is "hurting the eye". When characters need to jump to the next line due to previously discussed line breaking rules, ConTeXt seems to apply "Line adjustment by inter-character spacing expansion", which is a valid method according to https://www.w3.org/TR/jlreq/#line_adjustment , although "Line adjustment by inter-character spacing reduction" is preferred. The last point which ConTeXt is missing, when talking about Japanese typesetting, is vertical writing. I know, this is a lot of work. Hopefully we can achieve with joint efforts to make ConTeXt Japanese ready. If I happen to have made false statements, please accept my apology. I tried to be of help as far as I could. I grew up in Japan and know more or less how typeset text should look like. Emanuel
It would be nice if you can put your notes above into https://wiki.contextgarden.net/Chinese_Japanese_and_Korean
or in general improve/maintain that page
(e.g. the links about the fonts are broken at the moment)
Perhaps with Jeong Dal ?
Just to say, a few days ago I have seen https://ken-lunde.medium.com/genuine-han-unification-redux-3912b561ecae
(only webp images, so a bit tricky to make a pdf)
-- luigi
Emanuel Han via ntg-context schrieb am 01.03.2024 um 13:08:
Dear all, thanks for your contributions.
Sure I'll update the https://wiki.contextgarden.net/Chinese_Japanese_and_Korean hopefully with the help of Jeong Dal and others as soon as things are sorted out.
In attached example, the opening Brackets (I marked them with \color[red]{【} and \color[red]{{}) are taking the previous character with them to the next line. Please remove these to see that the previous character would stay on the previous line. Thanks Wolfgang for checking wether this is a bug.
Can you stick to fonts which are available for all systems (e.g. Noto CJK) because system fonts are a pain when you're on a different system. The missing line break before 【 is caused by a wrong table entry in scrp-cjk.lua and I guess the following change is necessary local japanese_2 = { jamo_initial = korean_break, korean = stretch_break, chinese = stretch_break, hiragana = stretch_break, katakana = stretch_break, half_width_open = nobreak_stretch_break_autoshrink, half_width_close = nobreak_stretch, - full_width_open = nobreak_stretch_break_shrink, + full_width_open = stretch_break, full_width_close = nobreak_stretch, full_width_punct = japanese_before_full_width_punct, -- nobreak_stretch, hyphen = nobreak_stretch, non_starter = nobreak_stretch, other = stretch_break, } but there can be more wrong entries.
I was not successful in figuring out how the protrusion mechanism can be set in order to keep full stops and commas on the previous line (protruding the column box). Could you please give me a hint, Wolfgang? Thanks. There's a \color[red]{。} in my example which should not jump to the next line.
Adding the first and last line to your example document worked for me. \definefontfeature [default] [default] [protrusion=pure] \definefontfamily [...] [...] [...] \setupbodyfont [...] \setupalign [hanging]
My example follows the Kihon-hanmen dimensioning as described in https://www.w3.org/TR/jlreq . What could be the reason that lines which could hold 25 characters are having only 24 characters, for example lines 2, 3 or 13 in column 1? I would expect them to have 25 characters, the same as for example lines 7, 9 or 16 in column 1.
I guess the par builder is responsible for this when it arranges the paragraph but this is just a guess.
How can I change alignment of the lines so that the highest character boxes align with the top border of the layout boxes for text and header and with the bottom border of the layout box for footer? I hope that when this is achieved for the layout box for text, then this box would hold the expected 45 lines, and not 44 lines as it is doing now. Ruby characters in the first line should protrude the box, what they already do. I tried to implement the 1em hskip of the header and footer away from the page border. While it works for left aligned headers and footers, it doesn't for the right aligned headers and footers (negative hskip has no effect). How to solve this problem?
Do you a proper example of the layout? Setting a few values is not enough because TeX doesn't work the way you need for your layout. Things can be improved but in cases like header and footer you have to tell ConTeXt there are no characters with depth.
Also how to get rid of the first empty page?
To load a math font from a typescript you have to use the \definetypeface command, replace the line \definefontfamily [JapaneseFont] [mm] [math] [lucidaot] [default] with \definetypeface [JapaneseFont] [mm] [math] [lucidaot] [default] and the page disappears. Wolfgang
Dear Wolfgang,
thank you for your valuable remarks. I integrated them, see corrected attached example.
Yes, correct layout examples exist. They're all showing vertical writing, but the rules and principles are exactly the same for horizontal writing.
position of the headers and footers: https://www.w3.org/TR/jlreq/#fig1_30
aligning lines to the text box: https://www.w3.org/TR/jlreq/#fig1_3
protrusion of ruby: https://www.w3.org/TR/jlreq/#fig_ad1_6
In my previous mail, I wrote wrong amounts of lines. They should be 46 lines on one page, while the actual example doesn't show the 46th line.
It would be important to identify the reason why only 24 characters are used to create a line when 25 could be used. Then we can develop a method to turn that mechanism off or circumvent it.
Quotation from https://www.w3.org/TR/jlreq:
In principle, when composing a line with ideographic (cl-19) (https://www.w3.org/TR/jlreq/#cl-19), hiragana (cl-15) (https://www.w3.org/TR/jlreq/#cl-15) and katakana (cl-16) (https://www.w3.org/TR/jlreq/#cl-16) characters, no extra spacing appears between their character frame (https://www.w3.org/TR/jlreq/#term.character-frame). This is called solid setting (see Figure 5 (https://www.w3.org/TR/jlreq/#fig1_8)).
I made manual corrections to scrp-cjk.lua, but with no effect to the ConTeXt output of my example. Do I have to recompile ConTeXt first?
Emanuel
On März 1 2024, at 2:59 pm, Wolfgang Schuster
Emanuel Han via ntg-context schrieb am 01.03.2024 um 13:08:
Dear all, thanks for your contributions.
Sure I'll update the https://wiki.contextgarden.net/Chinese_Japanese_and_Korean hopefully with the help of Jeong Dal and others as soon as things are sorted out.
In attached example, the opening Brackets (I marked them with \color[red]{【} and \color[red]{{}) are taking the previous character with them to the next line. Please remove these to see that the previous character would stay on the previous line. Thanks Wolfgang for checking wether this is a bug.
Can you stick to fonts which are available for all systems (e.g. Noto CJK) because system fonts are a pain when you're on a different system.
The missing line break before 【 is caused by a wrong table entry in scrp-cjk.lua and I guess the following change is necessary
local japanese_2 = { jamo_initial = korean_break, korean = stretch_break, chinese = stretch_break, hiragana = stretch_break, katakana = stretch_break, half_width_open = nobreak_stretch_break_autoshrink, half_width_close = nobreak_stretch, - full_width_open = nobreak_stretch_break_shrink, + full_width_open = stretch_break, full_width_close = nobreak_stretch, full_width_punct = japanese_before_full_width_punct, -- nobreak_stretch, hyphen = nobreak_stretch, non_starter = nobreak_stretch, other = stretch_break, }
but there can be more wrong entries.
I was not successful in figuring out how the protrusion mechanism can be set in order to keep full stops and commas on the previous line (protruding the column box). Could you please give me a hint, Wolfgang? Thanks. There's a \color[red]{。} in my example which should not jump to the next line.
Adding the first and last line to your example document worked for me. \definefontfeature [default] [default] [protrusion=pure] \definefontfamily [...] [...] [...] \setupbodyfont [...] \setupalign [hanging]
My example follows the Kihon-hanmen dimensioning as described in https://www.w3.org/TR/jlreq . What could be the reason that lines which could hold 25 characters are having only 24 characters, for example lines 2, 3 or 13 in column 1? I would expect them to have 25 characters, the same as for example lines 7, 9 or 16 in column 1.
I guess the par builder is responsible for this when it arranges the paragraph but this is just a guess.
How can I change alignment of the lines so that the highest character boxes align with the top border of the layout boxes for text and header and with the bottom border of the layout box for footer? I hope that when this is achieved for the layout box for text, then this box would hold the expected 45 lines, and not 44 lines as it is doing now. Ruby characters in the first line should protrude the box, what they already do. I tried to implement the 1em hskip of the header and footer away from the page border. While it works for left aligned headers and footers, it doesn't for the right aligned headers and footers (negative hskip has no effect). How to solve this problem?
Do you a proper example of the layout? Setting a few values is not enough because TeX doesn't work the way you need for your layout. Things can be improved but in cases like header and footer you have to tell ConTeXt there are no characters with depth.
Also how to get rid of the first empty page? To load a math font from a typescript you have to use the \definetypeface command, replace the line
\definefontfamily [JapaneseFont] [mm] [math] [lucidaot] [default] with \definetypeface [JapaneseFont] [mm] [math] [lucidaot] [default] and the page disappears. Wolfgang
Am 01.03.24 um 16:23 schrieb Emanuel Han via ntg-context:
I made manual corrections to scrp-cjk.lua, but with no effect to the ConTeXt output of my example. Do I have to recompile ConTeXt first?
Not compile the engine (luametatex), but re-make the ConTeXt format with context --make and to be on the safe side, regenerate the file database with mtxrun --generate Hraban
Emanuel Han schrieb am 01.03.2024 um 16:23:
Dear Wolfgang,
thank you for your valuable remarks. I integrated them, see corrected attached example.
Yes, correct layout examples exist. They're all showing vertical writing, but the rules and principles are exactly the same for horizontal writing.
* position of the headers and footers: https://www.w3.org/TR/jlreq/#fig1_30
See my attached gongitsune.tex example how you can squeeze text in a very narrow header/footer.
* aligning lines to the text box: https://www.w3.org/TR/jlreq/#fig1_3
You can use the lines key for \setuplayout to let ConTeXt calculate the necessary value for the text height.
* protrusion of ruby: https://www.w3.org/TR/jlreq/#fig_ad1_6
You're getting this for free because ruby text doesn't take up vertical space, in case vertical text is working it would now stick into the margins as expected. \starttext \ruledhbox{a \ruby{x}{y} b} \stoptext
In my previous mail, I wrote wrong amounts of lines. They should be 46 lines on one page, while the actual example doesn't show the 46th line.
It would be important to identify the reason why only 24 characters are used to create a line when 25 could be used. Then we can develop a method to turn that mechanism off or circumvent it. Quotation from https://www.w3.org/TR/jlreq: /In principle, when composing a line with //ideographic (cl-19) https://www.w3.org/TR/jlreq/#cl-19//, //hiragana (cl-15) https://www.w3.org/TR/jlreq/#cl-15// and //katakana (cl-16) https://www.w3.org/TR/jlreq/#cl-16// characters, no extra spacing appears between their //character frame https://www.w3.org/TR/jlreq/#term.character-frame//. This is called solid setting (see //Figure 5 https://www.w3.org/TR/jlreq/#fig1_8//)./
1. ConTeXt has a mechanism to typeset Japanese texts. 2. There are flaws in the output it produces but this nothing which can't be fixed. 3. To fix the problems someone has to be passionate to fix them and we're willing to help here. As you can see in my second example file japanese.tex there is a font feature to create half sized parentheses etc. which isn't supported yet by ConTeXt's mechanism for japanese and in case your willing to improve it this should be taken care of as well. Wolfgang
Hi all,
I added https://wiki.contextgarden.net/Chinese_Japanese_and_Korean#Meeting_the_JIS_X...
with attached working example code and to-do list.
Thanks for any contributions!
The working example code is still a work in progress. Its text layout output meets already some of the requirements (see comments in the code). Among the ones to still be implemented are:
solid setting (no extra spacing between characters) https://www.w3.org/TR/jlreq/#fig1_8 if no requirement for line-adjustment https://www.w3.org/TR/jlreq/#term.line-adjustment
aligning of the lines to the Kihon-hanmen (optimizing the code below in this regard)
positioning and realm of headings https://www.w3.org/TR/jlreq/#fig3_1_9 https://www.w3.org/TR/jlreq/#fig3_1_15 et al, and https://www.w3.org/TR/jlreq/#fig3_1_4
positioning of yokugo-ruby https://www.w3.org/TR/jlreq/#fig2_3_24
inline cutting note (warichu) https://www.w3.org/TR/jlreq/#fig2_4_1
emphasis with sesame dot or bullet
itemization https://www.w3.org/TR/jlreq/#fig2_5_6
indenting of quotation paragraphs https://www.w3.org/TR/jlreq/#fig2_5_7
tab setting https://www.w3.org/TR/jlreq/#fig2_6_1
furiwake https://www.w3.org/TR/jlreq/#fig2_7_2
jidori https://www.w3.org/TR/jlreq/#fig2_7_4
math https://www.w3.org/TR/jlreq/#fig2_7_6 and https://www.w3.org/TR/jlreq/#fig2_7_62
tategaki (writing vertically)
Best regards
Emanuel
On März 2 2024, at 7:00 pm, Wolfgang Schuster
Emanuel Han schrieb am 01.03.2024 um 16:23:
Dear Wolfgang, thank you for your valuable remarks. I integrated them, see corrected attached example. Yes, correct layout examples exist. They're all showing vertical writing, but the rules and principles are exactly the same for horizontal writing. position of the headers and footers: https://www.w3.org/TR/jlreq/#fig1_30
See my attached gongitsune.tex example how you can squeeze text in a very narrow header/footer.
aligning lines to the text box: https://www.w3.org/TR/jlreq/#fig1_3 You can use the lines key for \setuplayout to let ConTeXt calculate the necessary value for the text height. protrusion of ruby: https://www.w3.org/TR/jlreq/#fig_ad1_6 You're getting this for free because ruby text doesn't take up vertical space, in case vertical text is working it would now stick into the margins as expected. \starttext \ruledhbox{a \ruby{x}{y} b} \stoptext
In my previous mail, I wrote wrong amounts of lines. They should be 46 lines on one page, while the actual example doesn't show the 46th line. It would be important to identify the reason why only 24 characters are used to create a line when 25 could be used. Then we can develop a method to turn that mechanism off or circumvent it. Quotation from https://www.w3.org/TR/jlreq: In principle, when composing a line with ideographic (cl-19) (https://www.w3.org/TR/jlreq/#cl-19), hiragana (cl-15) (https://www.w3.org/TR/jlreq/#cl-15) and katakana (cl-16) (https://www.w3.org/TR/jlreq/#cl-16) characters, no extra spacing appears between their character frame (https://www.w3.org/TR/jlreq/#term.character-frame). This is called solid setting (see Figure 5 (https://www.w3.org/TR/jlreq/#fig1_8)).
1. ConTeXt has a mechanism to typeset Japanese texts. 2. There are flaws in the output it produces but this nothing which can't be fixed. 3. To fix the problems someone has to be passionate to fix them and we're willing to help here. As you can see in my second example file japanese.tex there is a font feature to create half sized parentheses etc. which isn't supported yet by ConTeXt's mechanism for japanese and in case your willing to improve it this should be taken care of as well. Wolfgang
Emanuel, Your sample seems to work fine on CTX MKIV 2024.01.24 version , as far as I see the final PDF output. And ConTeXt doesn't complain, even in the log ! Best//JP Le 10/03/2024 à 17:43, Emanuel Han via ntg-context a écrit :
Hi all,
I added https://wiki.contextgarden.net/Chinese_Japanese_and_Korean#Meeting_the_JIS_X... with attached working example code and to-do list.
Thanks for any contributions!
The working example code is still a work in progress. Its text layout output meets already some of the requirements (see comments in the code). Among the ones to still be implemented are:
* solid setting (no extra spacing between characters) https://www.w3.org/TR/jlreq/#fig1_8 if no requirement for line-adjustment https://www.w3.org/TR/jlreq/#term.line-adjustment * aligning of the lines to the Kihon-hanmen (optimizing the code below in this regard) * positioning and realm of headings https://www.w3.org/TR/jlreq/#fig3_1_9 https://www.w3.org/TR/jlreq/#fig3_1_15 et al, and https://www.w3.org/TR/jlreq/#fig3_1_4 * positioning of yokugo-ruby https://www.w3.org/TR/jlreq/#fig2_3_24 * inline cutting note (warichu) https://www.w3.org/TR/jlreq/#fig2_4_1 * emphasis with sesame dot or bullet * itemization https://www.w3.org/TR/jlreq/#fig2_5_6 * indenting of quotation paragraphs https://www.w3.org/TR/jlreq/#fig2_5_7 * tab setting https://www.w3.org/TR/jlreq/#fig2_6_1 * furiwake https://www.w3.org/TR/jlreq/#fig2_7_2 * jidori https://www.w3.org/TR/jlreq/#fig2_7_4 * math https://www.w3.org/TR/jlreq/#fig2_7_6 and https://www.w3.org/TR/jlreq/#fig2_7_62 * tategaki (writing vertically)
Best regards
Emanuel On März 2 2024, at 7:00 pm, Wolfgang Schuster
wrote: Emanuel Han schrieb am 01.03.2024 um 16:23:
Dear Wolfgang,
thank you for your valuable remarks. I integrated them, see corrected attached example.
Yes, correct layout examples exist. They're all showing vertical writing, but the rules and principles are exactly the same for horizontal writing.
* position of the headers and footers: https://www.w3.org/TR/jlreq/#fig1_30
See my attached gongitsune.tex example how you can squeeze text in a very narrow header/footer.
* aligning lines to the text box: https://www.w3.org/TR/jlreq/#fig1_3
You can use the lines key for \setuplayout to let ConTeXt calculate the necessary value for the text height.
* protrusion of ruby: https://www.w3.org/TR/jlreq/#fig_ad1_6
You're getting this for free because ruby text doesn't take up vertical space, in case vertical text is working it would now stick into the margins as expected.
\starttext \ruledhbox{a \ruby{x}{y} b} \stoptext
*
In my previous mail, I wrote wrong amounts of lines. They should be 46 lines on one page, while the actual example doesn't show the 46th line.
It would be important to identify the reason why only 24 characters are used to create a line when 25 could be used. Then we can develop a method to turn that mechanism off or circumvent it. Quotation from https://www.w3.org/TR/jlreq: /In principle, when composing a line with //ideographic (cl-19) https://www.w3.org/TR/jlreq/#cl-19//, //hiragana (cl-15) https://www.w3.org/TR/jlreq/#cl-15// and //katakana (cl-16) https://www.w3.org/TR/jlreq/#cl-16// characters, no extra spacing appears between their //character frame https://www.w3.org/TR/jlreq/#term.character-frame//. This is called solid setting (see //Figure 5 https://www.w3.org/TR/jlreq/#fig1_8//)./
1. ConTeXt has a mechanism to typeset Japanese texts.
2. There are flaws in the output it produces but this nothing which can't be fixed.
3. To fix the problems someone has to be passionate to fix them and we're willing to help here.
As you can see in my second example file japanese.tex there is a font feature to create half sized parentheses etc. which isn't supported yet by ConTeXt's mechanism for japanese and in case your willing to improve it this should be taken care of as well.
Wolfgang
___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki!
maillist :ntg-context@ntg.nl /https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl webpage :https://www.pragma-ade.nl /https://context.aanhet.net (mirror) archive :https://github.com/contextgarden/context wiki :https://wiki.contextgarden.net ___________________________________________________________________________________
Emanuel Han via ntg-context schrieb am 10.03.2024 um 17:43:
Hi all,
I added https://wiki.contextgarden.net/Chinese_Japanese_and_Korean#Meeting_the_JIS_X... with attached working example code and to-do list.
Thanks for any contributions!
The working example code is still a work in progress. Its text layout output meets already some of the requirements (see comments in the code). Among the ones to still be implemented are:
* solid setting (no extra spacing between characters) https://www.w3.org/TR/jlreq/#fig1_8 if no requirement for line-adjustment https://www.w3.org/TR/jlreq/#term.line-adjustment * aligning of the lines to the Kihon-hanmen (optimizing the code below in this regard)
Can you make text files out of the images [1] with the spacing before/after punctuation to have short examples for testing. [1] https://www.w3.org/TR/jlreq/#positioning_of_punctuation_marks
* positioning and realm of headings https://www.w3.org/TR/jlreq/#fig3_1_9 https://www.w3.org/TR/jlreq/#fig3_1_15 et al, and https://www.w3.org/TR/jlreq/#fig3_1_4 * positioning of yokugo-ruby https://www.w3.org/TR/jlreq/#fig2_3_24 * inline cutting note (warichu) https://www.w3.org/TR/jlreq/#fig2_4_1 * emphasis with sesame dot or bullet * itemization https://www.w3.org/TR/jlreq/#fig2_5_6
Circled numbered are easy and achieved by adding additional number conversions.
* indenting of quotation paragraphs https://www.w3.org/TR/jlreq/#fig2_5_7
Use the narrower or blockquote environment for this.
* tab setting https://www.w3.org/TR/jlreq/#fig2_6_1
Just use a table.
* furiwake https://www.w3.org/TR/jlreq/#fig2_7_2 * jidori https://www.w3.org/TR/jlreq/#fig2_7_4 * math https://www.w3.org/TR/jlreq/#fig2_7_6 and https://www.w3.org/TR/jlreq/#fig2_7_62 * tategaki (writing vertically)
Wolfgang
Hi Emmanuel, Thank you so much for the new setup for writing Japanese: I tested with both files, and noticed that with the new version the output looks great. I have a question about the code in the \directlua{} part of your setup: why, for instance, the paperSize = « B5" is defined « by hand » there, instead of being retrieved from the command \setuppapersize[B5] issued by the user? Actually I am using your setup for learning Japanese, and at my beginner’s level I do separate words I am learning with spaces. While with the previous version of your setup the lines were breaking womewhat strangely, but now the spaces between words in the output are as I intended them to be (I should also Thank Wolfgang Schuster for his insight with the \script[nihongo], and indeed Hans for fixing so quickly the slightest bug). It is really a great pleasure to be in this community where help comes from everyone and features are given on demand ! Best regards: Otared
On 10 Mar 2024, at 17:43, Emanuel Han via ntg-context
wrote: Hi all,
I added https://wiki.contextgarden.net/Chinese_Japanese_and_Korean#Meeting_the_JIS_X... with attached working example code and to-do list.
Thanks for any contributions!
The working example code is still a work in progress. Its text layout output meets already some of the requirements (see comments in the code). Among the ones to still be implemented are:
• solid setting (no extra spacing between characters) https://www.w3.org/TR/jlreq/#fig1_8 if no requirement for line-adjustment https://www.w3.org/TR/jlreq/#term.line-adjustment • aligning of the lines to the Kihon-hanmen (optimizing the code below in this regard) • positioning and realm of headings https://www.w3.org/TR/jlreq/#fig3_1_9 https://www.w3.org/TR/jlreq/#fig3_1_15 et al, and https://www.w3.org/TR/jlreq/#fig3_1_4 • positioning of yokugo-ruby https://www.w3.org/TR/jlreq/#fig2_3_24 • inline cutting note (warichu) https://www.w3.org/TR/jlreq/#fig2_4_1 • emphasis with sesame dot or bullet • itemization https://www.w3.org/TR/jlreq/#fig2_5_6 • indenting of quotation paragraphs https://www.w3.org/TR/jlreq/#fig2_5_7 • tab setting https://www.w3.org/TR/jlreq/#fig2_6_1 • furiwake https://www.w3.org/TR/jlreq/#fig2_7_2 • jidori https://www.w3.org/TR/jlreq/#fig2_7_4 • math https://www.w3.org/TR/jlreq/#fig2_7_6 and https://www.w3.org/TR/jlreq/#fig2_7_62 • tategaki (writing vertically) Best regards
Emanuel On März 2 2024, at 7:00 pm, Wolfgang Schuster
wrote: Emanuel Han schrieb am 01.03.2024 um 16:23: Dear Wolfgang,
thank you for your valuable remarks. I integrated them, see corrected attached example.
Yes, correct layout examples exist. They're all showing vertical writing, but the rules and principles are exactly the same for horizontal writing.
• position of the headers and footers: https://www.w3.org/TR/jlreq/#fig1_30
See my attached gongitsune.tex example how you can squeeze text in a very narrow header/footer.
• aligning lines to the text box: https://www.w3.org/TR/jlreq/#fig1_3
You can use the lines key for \setuplayout to let ConTeXt calculate the necessary value for the text height.
• protrusion of ruby: https://www.w3.org/TR/jlreq/#fig_ad1_6
You're getting this for free because ruby text doesn't take up vertical space, in case vertical text is working it would now stick into the margins as expected.
\starttext \ruledhbox{a \ruby{x}{y} b} \stoptext
In my previous mail, I wrote wrong amounts of lines. They should be 46 lines on one page, while the actual example doesn't show the 46th line.
It would be important to identify the reason why only 24 characters are used to create a line when 25 could be used. Then we can develop a method to turn that mechanism off or circumvent it. Quotation from https://www.w3.org/TR/jlreq: In principle, when composing a line with ideographic (cl-19), hiragana (cl-15) and katakana (cl-16) characters, no extra spacing appears between their character frame. This is called solid setting (see Figure 5).
1. ConTeXt has a mechanism to typeset Japanese texts.
2. There are flaws in the output it produces but this nothing which can't be fixed.
3. To fix the problems someone has to be passionate to fix them and we're willing to help here.
As you can see in my second example file japanese.tex there is a font feature to create half sized parentheses etc. which isn't supported yet by ConTeXt's mechanism for japanese and in case your willing to improve it this should be taken care of as well.
Wolfgang
___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl webpage : https://www.pragma-ade.nl / https://context.aanhet.net (mirror) archive : https://github.com/contextgarden/context wiki : https://wiki.contextgarden.net ___________________________________________________________________________________
Otared Kavian e-mail: otared@gmail.com Phone: +33 6 88 26 70 95
Dear Otared,
when you read the lua code in the first \directlua{}, you should realize that the dimensions of almost all layout elements are depending on the value of my lua variable "paperSize".
Thanks to defining the paper size first in lua, I can apply calculations of numeric values.
The value of paperSize is later passed on to \setuppapersize via \setuppapersize[\directlua{tex.print(paperSize)}]
Emanuel
On März 13 2024, at 3:55 pm, Otared Kavian
Hi Emmanuel,
Thank you so much for the new setup for writing Japanese: I tested with both files, and noticed that with the new version the output looks great. I have a question about the code in the \directlua{} part of your setup: why, for instance, the paperSize = « B5" is defined « by hand » there, instead of being retrieved from the command \setuppapersize[B5] issued by the user?
Actually I am using your setup for learning Japanese, and at my beginner’s level I do separate words I am learning with spaces. While with the previous version of your setup the lines were breaking womewhat strangely, but now the spaces between words in the output are as I intended them to be (I should also Thank Wolfgang Schuster for his insight with the \script[nihongo], and indeed Hans for fixing so quickly the slightest bug). It is really a great pleasure to be in this community where help comes from everyone and features are given on demand ! Best regards: Otared
On 10 Mar 2024, at 17:43, Emanuel Han via ntg-context
wrote: Hi all,
I added https://wiki.contextgarden.net/Chinese_Japanese_and_Korean#Meeting_the_JIS_X... with attached working example code and to-do list.
Thanks for any contributions!
The working example code is still a work in progress. Its text layout output meets already some of the requirements (see comments in the code). Among the ones to still be implemented are:
• solid setting (no extra spacing between characters) https://www.w3.org/TR/jlreq/#fig1_8 if no requirement for line-adjustment https://www.w3.org/TR/jlreq/#term.line-adjustment • aligning of the lines to the Kihon-hanmen (optimizing the code below in this regard) • positioning and realm of headings https://www.w3.org/TR/jlreq/#fig3_1_9 https://www.w3.org/TR/jlreq/#fig3_1_15 et al, and https://www.w3.org/TR/jlreq/#fig3_1_4 • positioning of yokugo-ruby https://www.w3.org/TR/jlreq/#fig2_3_24 • inline cutting note (warichu) https://www.w3.org/TR/jlreq/#fig2_4_1 • emphasis with sesame dot or bullet • itemization https://www.w3.org/TR/jlreq/#fig2_5_6 • indenting of quotation paragraphs https://www.w3.org/TR/jlreq/#fig2_5_7 • tab setting https://www.w3.org/TR/jlreq/#fig2_6_1 • furiwake https://www.w3.org/TR/jlreq/#fig2_7_2 • jidori https://www.w3.org/TR/jlreq/#fig2_7_4 • math https://www.w3.org/TR/jlreq/#fig2_7_6 and https://www.w3.org/TR/jlreq/#fig2_7_62 • tategaki (writing vertically) Best regards
Emanuel On März 2 2024, at 7:00 pm, Wolfgang Schuster
wrote: Emanuel Han schrieb am 01.03.2024 um 16:23: Dear Wolfgang,
thank you for your valuable remarks. I integrated them, see corrected attached example.
Yes, correct layout examples exist. They're all showing vertical writing, but the rules and principles are exactly the same for horizontal writing.
• position of the headers and footers: https://www.w3.org/TR/jlreq/#fig1_30
See my attached gongitsune.tex example how you can squeeze text in a very narrow header/footer.
• aligning lines to the text box: https://www.w3.org/TR/jlreq/#fig1_3
You can use the lines key for \setuplayout to let ConTeXt calculate the necessary value for the text height.
• protrusion of ruby: https://www.w3.org/TR/jlreq/#fig_ad1_6
You're getting this for free because ruby text doesn't take up vertical space, in case vertical text is working it would now stick into the margins as expected.
\starttext \ruledhbox{a \ruby{x}{y} b} \stoptext
In my previous mail, I wrote wrong amounts of lines. They should be 46 lines on one page, while the actual example doesn't show the 46th line.
It would be important to identify the reason why only 24 characters are used to create a line when 25 could be used. Then we can develop a method to turn that mechanism off or circumvent it. Quotation from https://www.w3.org/TR/jlreq: In principle, when composing a line with ideographic (cl-19), hiragana (cl-15) and katakana (cl-16) characters, no extra spacing appears between their character frame. This is called solid setting (see Figure 5).
1. ConTeXt has a mechanism to typeset Japanese texts.
2. There are flaws in the output it produces but this nothing which can't be fixed.
3. To fix the problems someone has to be passionate to fix them and we're willing to help here.
As you can see in my second example file japanese.tex there is a font feature to create half sized parentheses etc. which isn't supported yet by ConTeXt's mechanism for japanese and in case your willing to improve it this should be taken care of as well.
Wolfgang
___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl webpage : https://www.pragma-ade.nl / https://context.aanhet.net (mirror) archive : https://github.com/contextgarden/context wiki : https://wiki.contextgarden.net ___________________________________________________________________________________
Otared Kavian e-mail: otared@gmail.com Phone: +33 6 88 26 70 95
___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl webpage : https://www.pragma-ade.nl / https://context.aanhet.net (mirror) archive : https://github.com/contextgarden/context wiki : https://wiki.contextgarden.net ___________________________________________________________________________________
Dear Emmanuel, Thank you for your reply: indeed I understand your approach, which is quite efficient. I am not at all good in coding, so I naively thought there would be a way for your setup to retrieve the information it needs from what the user is doing. Maybe once things are settled, Hans and Wolfgang will have a look in the Japanese part of ConTeXt so that the user can avoid to enter the setup included in the \directlua part. Again thank you for what you are sharing. Best regards: Otared
On 14 Mar 2024, at 08:12, Emanuel Han via ntg-context
wrote: Dear Otared,
when you read the lua code in the first \directlua{}, you should realize that the dimensions of almost all layout elements are depending on the value of my lua variable "paperSize". Thanks to defining the paper size first in lua, I can apply calculations of numeric values.
The value of paperSize is later passed on to \setuppapersize via \setuppapersize[\directlua{tex.print(paperSize)}]
Emanuel On März 13 2024, at 3:55 pm, Otared Kavian
wrote: Hi Emmanuel, Thank you so much for the new setup for writing Japanese: I tested with both files, and noticed that with the new version the output looks great.
I have a question about the code in the \directlua{} part of your setup: why, for instance, the paperSize = « B5" is defined « by hand » there, instead of being retrieved from the command \setuppapersize[B5] issued by the user?
Actually I am using your setup for learning Japanese, and at my beginner’s level I do separate words I am learning with spaces. While with the previous version of your setup the lines were breaking womewhat strangely, but now the spaces between words in the output are as I intended them to be (I should also Thank Wolfgang Schuster for his insight with the \script[nihongo], and indeed Hans for fixing so quickly the slightest bug).
It is really a great pleasure to be in this community where help comes from everyone and features are given on demand !
Best regards: Otared
On 10 Mar 2024, at 17:43, Emanuel Han via ntg-context
wrote: Hi all,
I added https://wiki.contextgarden.net/Chinese_Japanese_and_Korean#Meeting_the_JIS_X... with attached working example code and to-do list.
Thanks for any contributions!
The working example code is still a work in progress. Its text layout output meets already some of the requirements (see comments in the code). Among the ones to still be implemented are:
• solid setting (no extra spacing between characters) https://www.w3.org/TR/jlreq/#fig1_8 if no requirement for line-adjustment https://www.w3.org/TR/jlreq/#term.line-adjustment • aligning of the lines to the Kihon-hanmen (optimizing the code below in this regard) • positioning and realm of headings https://www.w3.org/TR/jlreq/#fig3_1_9 https://www.w3.org/TR/jlreq/#fig3_1_15 et al, and https://www.w3.org/TR/jlreq/#fig3_1_4 • positioning of yokugo-ruby https://www.w3.org/TR/jlreq/#fig2_3_24 • inline cutting note (warichu) https://www.w3.org/TR/jlreq/#fig2_4_1 • emphasis with sesame dot or bullet • itemization https://www.w3.org/TR/jlreq/#fig2_5_6 • indenting of quotation paragraphs https://www.w3.org/TR/jlreq/#fig2_5_7 • tab setting https://www.w3.org/TR/jlreq/#fig2_6_1 • furiwake https://www.w3.org/TR/jlreq/#fig2_7_2 • jidori https://www.w3.org/TR/jlreq/#fig2_7_4 • math https://www.w3.org/TR/jlreq/#fig2_7_6 and https://www.w3.org/TR/jlreq/#fig2_7_62 • tategaki (writing vertically) Best regards
Emanuel On März 2 2024, at 7:00 pm, Wolfgang Schuster
wrote: Emanuel Han schrieb am 01.03.2024 um 16:23: Dear Wolfgang,
thank you for your valuable remarks. I integrated them, see corrected attached example.
Yes, correct layout examples exist. They're all showing vertical writing, but the rules and principles are exactly the same for horizontal writing.
• position of the headers and footers: https://www.w3.org/TR/jlreq/#fig1_30
See my attached gongitsune.tex example how you can squeeze text in a very narrow header/footer.
• aligning lines to the text box: https://www.w3.org/TR/jlreq/#fig1_3
You can use the lines key for \setuplayout to let ConTeXt calculate the necessary value for the text height.
• protrusion of ruby: https://www.w3.org/TR/jlreq/#fig_ad1_6
You're getting this for free because ruby text doesn't take up vertical space, in case vertical text is working it would now stick into the margins as expected.
\starttext \ruledhbox{a \ruby{x}{y} b} \stoptext
In my previous mail, I wrote wrong amounts of lines. They should be 46 lines on one page, while the actual example doesn't show the 46th line.
It would be important to identify the reason why only 24 characters are used to create a line when 25 could be used. Then we can develop a method to turn that mechanism off or circumvent it. Quotation from https://www.w3.org/TR/jlreq: In principle, when composing a line with ideographic (cl-19), hiragana (cl-15) and katakana (cl-16) characters, no extra spacing appears between their character frame. This is called solid setting (see Figure 5).
1. ConTeXt has a mechanism to typeset Japanese texts.
2. There are flaws in the output it produces but this nothing which can't be fixed.
3. To fix the problems someone has to be passionate to fix them and we're willing to help here.
As you can see in my second example file japanese.tex there is a font feature to create half sized parentheses etc. which isn't supported yet by ConTeXt's mechanism for japanese and in case your willing to improve it this should be taken care of as well.
Wolfgang
___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl webpage : https://www.pragma-ade.nl / https://context.aanhet.net (mirror) archive : https://github.com/contextgarden/context wiki : https://wiki.contextgarden.net ___________________________________________________________________________________
Otared Kavian e-mail: otared@gmail.com Phone: +33 6 88 26 70 95
___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl webpage : https://www.pragma-ade.nl / https://context.aanhet.net (mirror) archive : https://github.com/contextgarden/context wiki : https://wiki.contextgarden.net ___________________________________________________________________________________ ___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl webpage : https://www.pragma-ade.nl / https://context.aanhet.net (mirror) archive : https://github.com/contextgarden/context wiki : https://wiki.contextgarden.net ___________________________________________________________________________________
Otared Kavian e-mail: otared@gmail.com Phone: +33 6 88 26 70 95
Otared Kavian schrieb am 14.03.2024 um 14:48:
Dear Emmanuel,
Thank you for your reply: indeed I understand your approach, which is quite efficient. I am not at all good in coding, so I naively thought there would be a way for your setup to retrieve the information it needs from what the user is doing. Maybe once things are settled, Hans and Wolfgang will have a look in the Japanese part of ConTeXt so that the user can avoid to enter the setup included in the \directlua part.
There is no need for these calculations because 1. you can create named layouts (e.g. \definelayout[kinohanmen:a4]) for each paper size, 2. you can put the fontsize etc. settings in a setups block and load the one needed for each paper size and 3. you can put all of them in a module which can be loaded when writing documents in japanese, the paper size can be passed as argument to the module. Wolfgang
[probably off-topic , my apologies ] For a project in my spare time (i.e. no deadlines) I am collecting all kind of info I can find on the net (so free/non free fonts, books , specs, images raster /vectorial..whatever) on the Kaiti (楷体) or “Regular style” https://fonts.google.com/knowledge/type_in_china_japan_and_korea/type_classi... Any help would be greatly appreciated; there are no secrets, so we can use this ml or write to me privately, as you prefer. -- luigi
Hi all,
Does anyone have a simple setup of fonts to write a small Japanese document (possibly with furagana) ? I am using MacOS and I have several Japanese fonts on the system. I have some old examples which do not typeset correctly now, maybe because they use the old module simplefonts and commands such as \setcjkmainfont and friends.
Many thanks in advance: Otare
On 2/26/2024 9:08 PM, Otared Kavian wrote: there are some files "japanese-*" in the test suite; it boils down to a setting up a font and enabling script (because of specific spacing) Hans ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl -----------------------------------------------------------------
Unfortunately vertical typesetting is not supported by ConTeXt. That's a big pity.
If horizontal typesetting is fine, this little working example with furigana might give you some hints. Hiragino Mincho Pro should be installed by Default on MacOS.
\enableregime[utf] % enable unicoded input
\definefontfamily [JapaneseFont] [rm] [hiraginominchopro]
\setupruby[location=top,voffset=-1.6ex, ]
\starttext \JapaneseFont
\ruby{僕}{ぼく}はもう\ruby{寝}{ね}る。
お\ruby{休}{やす}みなさい^_^
\stoptext
On Feb. 26 2024, at 9:08 pm, Otared Kavian
Hi all,
Does anyone have a simple setup of fonts to write a small Japanese document (possibly with furagana) ? I am using MacOS and I have several Japanese fonts on the system. I have some old examples which do not typeset correctly now, maybe because they use the old module simplefonts and commands such as \setcjkmainfont and friends.
Many thanks in advance: Otared ___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl webpage : https://www.pragma-ade.nl / https://context.aanhet.net (mirror) archive : https://github.com/contextgarden/context wiki : https://wiki.contextgarden.net ___________________________________________________________________________________
Hi Emanuel, Thanks for the example. In fact I don’t need vertical typesetting for my Japanese text, so your example works fine for me. Actually I had to change the name of the font to Hiragino Mincho ProN W3 in order to get your example work. Also I think with the recent versions of ConTeXt there is no need to add \enableregime[utf] because ConTeXt is working with Unicode any way. I added also a line to define a math font, since I have read here on the mailing list that a math font should be set… Maybe someone among the experts can tell us if I am right, or if one has to set other fonts as well. So your example which works fine for me is now: % begin simple-japanese.tex \definefontfamily [JapaneseFont] [rm] [Hiragino Mincho ProN W3] \definefontfamily [JapaneseFont] [ss] [Hiragino Mincho ProN W3] \definefontfamily [JapaneseFont] [mm] [math] [lucidaot] [default] \setupbodyfont[JapaneseFont,14pt] \setupruby[location=top,voffset=-1.6ex] \setupwhitespace[big] \starttext \ruby{僕}{ぼく}はもう\ruby{寝}{ね}る。 お\ruby{休}{やす}みなさい^_^ \stoptext %end simple-japanese.tex Best regards: Otared
On 26 Feb 2024, at 21:32, Emanuel Han via ntg-context
wrote: Unfortunately vertical typesetting is not supported by ConTeXt. That's a big pity.
If horizontal typesetting is fine, this little working example with furigana might give you some hints. Hiragino Mincho Pro should be installed by Default on MacOS.
\enableregime[utf] % enable unicoded input \definefontfamily [JapaneseFont] [rm] [hiraginominchopro]
\setupruby[location=top,voffset=-1.6ex, ]
\starttext \JapaneseFont
\ruby{僕}{ぼく}はもう\ruby{寝}{ね}る。
お\ruby{休}{やす}みなさい^_^
\stoptext
On Feb. 26 2024, at 9:08 pm, Otared Kavian
wrote: Hi all, Does anyone have a simple setup of fonts to write a small Japanese document (possibly with furagana) ? I am using MacOS and I have several Japanese fonts on the system. I have some old examples which do not typeset correctly now, maybe because they use the old module simplefonts and commands such as \setcjkmainfont and friends.
Many thanks in advance: Otared
___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl webpage : https://www.pragma-ade.nl / https://context.aanhet.net (mirror) archive : https://github.com/contextgarden/context wiki : https://wiki.contextgarden.net ___________________________________________________________________________________ ___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl webpage : https://www.pragma-ade.nl / https://context.aanhet.net (mirror) archive : https://github.com/contextgarden/context wiki : https://wiki.contextgarden.net ___________________________________________________________________________________
Otared Kavian e-mail: otared@gmail.com Phone: +33 6 88 26 70 95
participants (8)
-
Emanuel Han
-
Hans Hagen
-
Henning Hraban Ramm
-
Jean-Pierre Delange
-
Jeong Dal
-
luigi scarso
-
Otared Kavian
-
Wolfgang Schuster