Re: [NTG-context] About vertical typesetting in ConTeXt
Hi, list. I've found a (sort of) way to do LTL typesetting in Lua(La)TeX based on "chickenize", a LuaTeX package. The font used is available here; http://www.mongolfont.com/en/font/mnglwhiteotf.html %Just for testing in LaTeX \documentclass{article} \usepackage{luacode} \usepackage{fontspec} \setmainfont{Mongolian White}[Renderer=Harfbuzz,Script=Mongolian] \begin{luacode*} -- How do I do this in ConTeXt? userdata = userdata or {} userdata.mongolian = function(head) --Ugly hackish line rotation rot = node.new(node.id("whatsit"),node.subtype("pdf_literal")) rot2 = node.new(node.id("whatsit"),node.subtype("pdf_literal")) for line in node.traverse_id(0,head) do w = line.width/65536*0.99625 rot.data = "-1 0 0 -1 "..w.." 0 cm" rot2.data = "-1 0 0 -1 "..-w.." 0 cm" line.head = node.insert_before(line.head,line.head,node.copy(rot)) node.insert_after(line.head,node.tail(line.head),node.copy(rot2)) end return head end \end{luacode*} \def\startmongolian{\directlua{luatexbase.add_to_callback("post_linebreak_filter", userdata.mongolian, "mongolian")}} \def\stopmongolian{% \par\directlua{luatexbase.remove_from_callback("post_linebreak_filter", "mongolian")}% } \usepackage{graphicx} \begin{document} \rotatebox{90}{% \parbox{8cm}{% \startmongolian \begin{flushleft} ᠣᠢᠷᠠ ᠵᠢᠨ ᠡᠳᠦᠷ᠂ ᠦᠪᠦᠷ ᠮᠣᠩᠭᠣᠯ ᠦᠨ ᠰᠢᠯᠢ ᠵᠢᠨ ᠭᠣᠣᠯ ᠠᠢᠮᠠᠭ ᠦᠨ ᠰᠢᠯᠣᠭᠣᠨ ᠬᠦᠬᠡ ᠬᠣᠰᠢᠭᠣᠨ ᠦ ᠰᠢᠭᠦᠬᠦ ᠬᠣᠷᠢᠶᠠ ᠨᠢᠭᠡᠨ ᠬᠦᠴᠦᠷᠬᠡᠭᠯᠡᠨ ᠨᠦᠵᠢᠳᠯᠡᠭᠰᠡᠨ ᠶᠠᠯᠠᠲᠣ ᠬᠡᠷᠡᠭ ᠲᠦ ᠰᠢᠭᠦᠯᠲᠡ ᠬᠢᠪᠡ᠃ ᠰᠢᠭᠦᠨ ᠲᠠᠰᠣᠯᠣᠯᠳᠠ ᠪᠠᠷ᠂ ᠵᠠᠭᠠᠯᠳᠣᠭᠳᠠᠭᠴᠢ ᠡᠷᠬᠢᠮᠲᠦ ᠵᠢ ᠬᠦᠴᠦᠷᠭᠡᠭᠯᠡᠨ᠂ ᠨᠦᠵᠢᠳᠯᠡᠭᠰᠡᠨ ᠶᠡᠯᠡ ᠪᠡᠷ ᠭᠣᠷᠪᠠᠨ ᠵᠢᠯ ᠦᠨ ᠬᠣᠭᠣᠴᠠᠭᠠ ᠲᠠᠢ ᠬᠣᠷᠢᠬᠣ ᠡᠷᠡᠭᠦᠦ ᠪᠡᠷ ᠰᠢᠳᠬᠡᠭᠰᠡᠨ ᠪᠠᠢᠨᠠ᠃ \end{flushleft} \stopmongolian } } \end{document} I can rotate boxes in ConTeXt using other methods than those used in LaTeX. However, my main concern is about "translating" the Lua(La)TeX piece to be used in ConTeXt. I've read about "finalizers" in the CLD manual and somewhere online, but I don't know how to access to node.subtype("pdf_literal"). I'll be happy to know about a better solution if ConTeXt offers it so it is accessible to other users. Thank you in advance. Regards, Jairo El mié., 10 de jun. de 2020 a la(s) 03:11, Jairo A. del Rio ( jairoadelrio6@gmail.com) escribió:
I totally ignored this document until now. As it looks really promising (to me), I'll make some attempts first. In my almost-one-year experience with ConTeXt, a manual or a discussion in the list usually foreshadows a solution. ConTeXt never ceases to amaze me with its tricks and quirks. Thank you very much, Hans.
Jairo :)
El mié., 10 de jun. de 2020 a la(s) 02:30, Hans Hagen (j.hagen@xs4all.nl) escribió:
On 6/10/2020 7:49 AM, Jairo A. del Rio wrote:
Hi list! I'm curious about vertical typesetting in ConTeXt. As far as I know, LuaTeX supports four text directions, but LTL is broken for Manchu script (letters are displayed unjoined in LTL mode) and LuaMetaTeX does not support vertical directions anymore, at least as primitives.
I found the following solution:
https://tex.stackexchange.com/a/140972/193767 I reproduce the code (in XeLaTeX), just in case
|% !TEX TS-program =
xelatex\documentclass{scrartcl}\usepackage{fontspec}\newfontfamily{\dcw}[]{DaicingWhite}%\begin{document}\noindentLine
above\\% to demonstrate that the lines are being stacked as normal\rotatebox{-90}{%\XeTeXupwardsmode1\\% successive lines will be stacked upwards instead of downwards\begin{minipage}{4em}% this will be the vertical length of the Mongolian section{\dcw% Font: Daicing White1 ᠮᠠᠨᠵᡠ ᡤᡳᠰᡠᠨ\\% direct Unicode input of Manchu letters2 ᠮᠠᠨᠵᡠ ᡤᡳᠰᡠᠨ }% End font\end{minipage}\XeTeXupwardsmode0 }% End rotatebox\noindentLine underneath \end{document}|
and I see XeTeX uses the primitive |\XeTeXupwardsmodeand some other tricks to get the proper display of Manchu text, so maybe MKII can do the magic using XeTeX as an engine. How would one use ConTeXt MKIV for this task? Is it possible to emulate \XeTeXupwardsmode in ConTeXt as a first step? Thank you very much. I admit that I have no clue about what xetex does in that departmentbut you're right that in lmtx the vertical directions are not supported. The main reason is that it didn't really integrates well in the way pages are constructed.
Vertical typesetting (afaiks) involves two things: one character wide columns and rotated glyphs. The first can be handled by the macro package and the second by a combination of engine and macro package.
Already for quite a while there are the basics for a more advanced vertical subsystem but it's typically one of these things that I explore and then set aside till some users show up who need it and are willing to spend time on discussing and testing intertfaces. After all, most of this tex stuff is kind of a hobby and it's easy to find new interesting experiments.
Anyway, you can get some ideas in chapter 6 of:
http://www.pragma-ade.com/general/manuals/followingup.pdf
but as said, probably no one ever read that. The question isnot so much if it can be done, but how to integrate it.
(There's more stuff waiting for being used but we leave that for users to run into and demand support for.)
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 -----------------------------------------------------------------
On 8/4/2020 10:32 AM, Jairo A. del Rio wrote:
hm, only for testing, not for use
I can rotate boxes in ConTeXt using other methods than those used in LaTeX. However, my main concern is about "translating" the Lua(La)TeX piece to be used in ConTeXt. I've read about "finalizers" in the CLD manual and somewhere online, but I don't know how to access to node.subtype("pdf_literal"). I'll be happy to know about a better solution if ConTeXt offers it so it is accessible to other users. Thank you in advance. The problem (or challenge) as usual is not in the coding but in what is a reasonable user interface. So, what are the use cases. Her eis one solution:
\protected\def\startvertical {\dosingleempty\dostartvertical} \def\dostartvertical[#1]% {\begingroup \getdummyparameters[width=\textwidth,height=\textheight,#1]% \vbox orientation 1 \doifelsedimension{\dummyparameter{width}}{to \dummyparameter{width}}{}% \bgroup \doifelsedimension{\dummyparameter{height}}{\hsize \dummyparameter{height}}{}} \protected\def\stopvertical {\vfill \egroup \endgroup} % test \starttext \definefont [MyFont] [file:mnglwhiteotf.ttf*default,mongolian @ 24pt] \showframe \startvertical \MyFont \setupalign[stretch,tolerant,stretch] \setupinterlinespace[40pt]% ᠣᠢᠷᠠ ᠵᠢᠨ ᠡᠳᠦᠷ᠂ ᠦᠪᠦᠷ ᠮᠣᠩᠭᠣᠯ ᠦᠨ ᠰᠢᠯᠢ ᠵᠢᠨ ᠭᠣᠣᠯ ᠠᠢᠮᠠᠭ ᠦᠨ ᠰᠢᠯᠣᠭᠣᠨ ᠬᠦᠬᠡ ᠬᠣᠰᠢᠭᠣᠨ ᠦ ᠰᠢᠭᠦᠬᠦ ᠬᠣᠷᠢᠶᠠ ᠨᠢᠭᠡᠨ ᠬᠦᠴᠦᠷᠬᠡᠭᠯᠡᠨ ᠨᠦᠵᠢᠳᠯᠡᠭᠰᠡᠨ ᠶᠠᠯᠠᠲᠣ ᠬᠡᠷᠡᠭ ᠲᠦ ᠰᠢᠭᠦᠯᠲᠡ ᠬᠢᠪᠡ᠃ ᠰᠢᠭᠦᠨ ᠲᠠᠰᠣᠯᠣᠯᠳᠠ ᠪᠠᠷ᠂ ᠵᠠᠭᠠᠯᠳᠣᠭᠳᠠᠭᠴᠢ ᠡᠷᠬᠢᠮᠲᠦ ᠵᠢ ᠬᠦᠴᠦᠷᠭᠡᠭᠯᠡᠨ᠂ ᠨᠦᠵᠢᠳᠯᠡᠭᠰᠡᠨ ᠶᠡᠯᠡ ᠪᠡᠷ ᠭᠣᠷᠪᠠᠨ ᠵᠢᠯ ᠦᠨ ᠬᠣᠭᠣᠴᠠᠭᠠ ᠲᠠᠢ ᠬᠣᠷᠢᠬᠣ ᠡᠷᠡᠭᠦᠦ ᠪᠡᠷ ᠰᠢᠳᠬᠡᠭᠰᠡᠨ ᠪᠠᠢᠨᠠ᠃ \stopvertical \page \startvertical[height=.75\textheight] \MyFont \setupalign[flushleft] \setupinterlinespace[40pt]% ᠣᠢᠷᠠ ᠵᠢᠨ ᠡᠳᠦᠷ᠂ ᠦᠪᠦᠷ ᠮᠣᠩᠭᠣᠯ ᠦᠨ ᠰᠢᠯᠢ ᠵᠢᠨ ᠭᠣᠣᠯ ᠠᠢᠮᠠᠭ ᠦᠨ ᠰᠢᠯᠣᠭᠣᠨ ᠬᠦᠬᠡ ᠬᠣᠰᠢᠭᠣᠨ ᠦ ᠰᠢᠭᠦᠬᠦ ᠬᠣᠷᠢᠶᠠ ᠨᠢᠭᠡᠨ ᠬᠦᠴᠦᠷᠬᠡᠭᠯᠡᠨ ᠨᠦᠵᠢᠳᠯᠡᠭᠰᠡᠨ ᠶᠠᠯᠠᠲᠣ ᠬᠡᠷᠡᠭ ᠲᠦ ᠰᠢᠭᠦᠯᠲᠡ ᠬᠢᠪᠡ᠃ ᠰᠢᠭᠦᠨ ᠲᠠᠰᠣᠯᠣᠯᠳᠠ ᠪᠠᠷ᠂ ᠵᠠᠭᠠᠯᠳᠣᠭᠳᠠᠭᠴᠢ ᠡᠷᠬᠢᠮᠲᠦ ᠵᠢ ᠬᠦᠴᠦᠷᠭᠡᠭᠯᠡᠨ᠂ ᠨᠦᠵᠢᠳᠯᠡᠭᠰᠡᠨ ᠶᠡᠯᠡ ᠪᠡᠷ ᠭᠣᠷᠪᠠᠨ ᠵᠢᠯ ᠦᠨ ᠬᠣᠭᠣᠴᠠᠭᠠ ᠲᠠᠢ ᠬᠣᠷᠢᠬᠣ ᠡᠷᠡᠭᠦᠦ ᠪᠡᠷ ᠰᠢᠳᠬᠡᠭᠰᠡᠨ ᠪᠠᠢᠨᠠ᠃ \stopvertical \stoptext But it's kind of a quick hack interface. We can have alignment, interlinespace etc parameters to. Maybe definable verticals and so. Hans ps. for chinese one would probably kick in an extra feature % \definefontfeature % [vertical] % [vertical={% % orientation=3,% % down=.1,% % right=.1,% % ranges={% % cjkcompatibility,% % cjkcompatibilityforms,% % cjkcompatibilityideographs,% % cjkcompatibilityideographssupplement,% % cjkradicalssupplement,% % % cjkstrokes,% % cjksymbolsandpunctuation,% % cjkunifiedideographs,% % cjkunifiedideographsextensiona,% % cjkunifiedideographsextensionb,% % cjkunifiedideographsextensionc,% % cjkunifiedideographsextensiond,% % cjkunifiedideographsextensione,% % cjkunifiedideographsextensionf,% % }% % }] and maybe some extreme hz would work out well too. ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl -----------------------------------------------------------------
participants (2)
-
Hans Hagen
-
Jairo A. del Rio