[NTG-context] Re: Japanese
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 ___ 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 ___
[NTG-context] Re: Japanese
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 wrote: > 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
[NTG-context] Re: Japanese
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 ___ 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 ___
[NTG-context] Wiki page : Mixed languages sample (French, Ancient Greek, Arabic, Chinese)
Dear List, Several years ago I tried to write documents, mainly lectures, but also essays, in which I tried to make several languages (Romance and non-Romance) coexist. Here below is an example of an attempt to compose an acceptable document, in the form of an exercise in which Arabic and Chinese are introduced into a document written in French. With footnotes and a few framed lines. I submit this example for your perusal and ask you whether it could possibly appear on a wiki page devoted to the combination of non-European languages in the same text. In English translation, of course. %We are giving below an example of a text written in a Latin language, in which we want to print here and there some text in ancient Greek, Arabic and Chinese. \setuplanguage[fr][patterns={fr,agr}] \mainlanguage[fr] \setuplayout [backspace=40mm] \setuppagenumbering[alternative=doublesided, location={header, inmargin}] \setupmargindata[inmargin][location=inner, style={\ssx\setupinterlinespace[line=2.8ex]}] \setupmarginframed[inmargin][align=right] \setupbodyfontenvironment[default][em=italic] % Use Theano Didot as Ancient Greek font \definefallbackfamily[mainface][serif][Theano Didot][preset=range:greek, it={Old Standard Italic}, force=yes] % Choose between Ipaexmincho font and NotoSansTC (Traditional Chinese) %\definefallbackfamily [mainface] [rm] [ipaexmincho] [range=cjkunifiedideographs] \definefallbackfamily [mainface] [rm] [notosanstc] [range=cjkunifiedideographs] % Choose between two Arabic fonts %\definefallbackfamily[mainface] [serif] [nafeesnastaleeq] [range=arabic] \definefallbackfamily[mainface] [serif] [hussaininastaleeq] [range=arabic] \definefontfamily [mainface] [serif] [GaramondNo8][sc=NewG8 Regular SC] \definefontfamily [mainface] [sans] [FreeSans] [rscale=0.7] \definefontfamily[mainface] [serif] [GFS Didot] \setupbodyfont[mainface] \setupindenting[1.5em] \setupindenting[yes] \setupcolors[state=start] \defineframedtext [MyFrame] [before={\blank}, after={\blank}, frame=off, background=MyFrame, %width=\textwidth, width=max, height=fit, style=italic] \definelabel [Définition] [headstyle=\bf\smallcaps] \startuseMPgraphic{MyFrame} path b; picture p; %p := textext.rt("\white\Définition"); p := textext.rt("\white\framedtextparameter{Title}"); %p := textext.rt("\white\getvariable{text}{text1}"); p := p shifted (2BodyFontSize,OverlayHeight-ypart center p+.25ExHeight); b := boundingbox p leftenlarged .5EmWidth rightenlarged .5EmWidth; fill OverlayBox withcolor lightgray; %\MPcolor{ fill b withcolor darkred; draw bottomboundary OverlayBox withpen pencircle scaled 1pt withcolor darkred; draw topboundary OverlayBox withpen pencircle scaled 1pt withcolor darkred; draw p; setbounds currentpicture to boundingbox currentpicture enlarged 2mm; \stopuseMPgraphic \defineoverlay [MyFrame] [\useMPgraphic{MyFrame}] \setupwhitespace[medium] \setupinterlinespace[line=3.2ex] \setupitemize[each][margin=yes] \setuphead[title][header=empty] \setupheader[style={\sc}] \setupfooter[style={\itxx}] \setupheadertexts[Utilisation de plusieurs langues dans un même texte avec \ConTeXt][][][{\getmarking[section]}] \setupfootertexts[][][][© J.-P. Delange, 2016 — La reproduction de ce texte est soumise à autorisation.] \defineparagraphs[TwoColumns][n=2, align={hz, hanging}] \setupparagraphs[TwoColumns][1][width=210pt, style=rm, align=left] \starttext \title{\ConTeXt, ou comment imprimer des langues non-romanes} \section {\sc Préambule} Lorsqu'il s'agit de proposer un document dans une langue nationale (le français), tout va bien. Lorsqu'il s'agit de rédiger en français un document un peu complexe, avec des citations — ou des références — dans une autre langue, qui en particulier n'a pas les mêmes exigences que le français, ni les mêmes {\em signes diacritiques} on se heurte à quelques difficultés. Les suites logicielles comme Microsoft Office ou LibreOffice ne manquent pas de puissance, mais à vrai dire, dès que nous entrons dans les exigences de l'édition professionnelle, qui consistent à présenter un texte lisible et enrichi (en notes, etc.), la situation devient vite techniquement assez pénible. La situation la plus courante que nous rencontrons dans les Lettres, en Philosophie, en Histoire, et plus généralement dans les Humanités, est celle d'un texte dans lequel il y a des citations d'auteurs grecs ou latin, avec des références en notes de bas de page, qui contiennent du grec. Cela pourrait être quelque chose comme ceci : \blank\startnarrower[1*left,1*right]\tfx\setupinterlinespace \noindent \quotation{Ἔφη γάρ οἱ Σωκράτη ἐντυχεῖν λελουμένον τε καὶ τὰς βλαύτας ὑποδεδεμένον, ἃ ἐκεῖνος ὀλιγάκις ἐποίει· καὶ ἐρέσθαι αὐτὸν ὅποι ἴοι οὕτω καλὸς γεγενημένος. καὶ τὸν εἰπεῖν ὅτι· Ἐπὶ δεῖπνον εἰς Ἀγάθωνος. χθὲς γὰρ αὐτὸν διέφυγον τοῖς ἐπινικίοις, φοβηθεὶς τὸν ὄχλον· ὡμολόγησα δ᾽ εἰς τήμερον παρέσεσθαι. ταῦτα δὴ ἐκαλλωπισάμην, ἵνα
[NTG-context] Re: Japanese
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 wrote: > > > On Wed, 28 Feb 2024 at 20:53, Emanuel Han via ntg-context (mailto: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_characters > > , 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