\dontcomplain % in font-imp-scripts, line 145, comment a few lines % % orientate = function(character) % local width = character.width or 0 % local height = character.height or 0 % local depth = character.depth or 0 % -- character.width = height + depth + rightshift + rightshift % character.height = width - downshift % character.depth = shift % -- character.xoffset = height + rightshift % -- character.yoffset = - downshift % -- character.orientation = orientation % end \setuplayout[middle] \starttext \startluacode local nuts = nodes.nuts local nextglyph = nuts.traversers.glyph local newhlist = nuts.pool.hlist local getboth = nuts.getboth local setboth = nuts.setboth local setlink = nuts.setlink local getlist = nuts.getlist local setlist = nuts.setlist local setwhd = nuts.setwhd local getwhd = nuts.getwhd local setorientation = nuts.setorientation local getbox = nuts.getbox local xheights = fonts.hashes.xheights local function is_vertical(c) return c >= 0x04E00 and c <= 0x09FFF end function document.manipulate_one(boxnumber) local box = getbox(boxnumber) local list = getlist(box) local all = { } for n, c, f in nextglyph, list do if is_vertical(c) then all[n] = f end end for n, f in next, all do local o = .2 * xheights[f] local prev, next = getboth(n) setboth(n) local l = newhlist(n) local w, h, d = getwhd(n) setlink(prev,l,next) setwhd(l,h+d+o,w,0) setorientation(l,0x003,o/2,-o/2,0,h,d-o) if n == list then setlist(box,l) end end end \stopluacode \startluacode function document.manipulate_two(boxnumber) local box = tex.getbox(boxnumber) local n = box.list local function is_vertical(c) return c >= 0x04E00 and c <= 0x09FFF end while n do if n.id == node.id("glyph") and is_vertical(n.char) then local o = .2 * fonts.hashes.identifiers[n.font].parameters.xheight local prev, next = n.prev, n.next n.next, n.prev = nil, nil local l = nodes.new("hlist") l.list = n local w, h, d = n.width, n.height, n.depth if prev then prev.next, l.prev = l, prev else box.list = l end if next then l.next, next.prev = next, l end l.width, l.height, l.depth = h + d + o, w, 0 l.orientation = 0x003 -- l.xoffset, l.yoffset = o/2, -o/2 l.hoffset, l.doffset = h, d - o n = next else n = n.next end end end \stopluacode % % % % % % % % % % \unexpanded\def\stripe#1{\hbox orientation 0 yoffset 3pt{\strut #1}} \setuptolerance[verytolerant,stretch] \definefont[NotoCJK][NotoSanstc-Regular*default @ 24pt] \setupinterlinespace[40pt] % % % % % % % % % % \setbox1000\hbox{\NotoCJK\startscript[hangul]\dorecurse{20}{通用规范汉字表 \stripe{test #1} }\stopscript} \ctxlua{document.manipulate_one(1000)} \ruledvbox orientation 1 to \textwidth \bgroup \hsize \textheight \unhbox1000 \vfill \egroup \page \setbox1000\hbox{\NotoCJK\startscript[hangul]\dorecurse{20}{通用规范汉字表 \stripe{test #1} }\stopscript} \ctxlua{document.manipulate_two(1000)} \ruledvbox orientation 1 to \textwidth \bgroup \hsize \textheight \unhbox1000 \vfill \egroup \page \setupinterlinespace[40pt] \definefontfeature [vertical] [vertical={% orientation=3,% down=.1,% right=.1,% ranges={% cjkcompatibility,% cjkcompatibilityforms,% cjkcompatibilityideographs,% cjkcompatibilityideographssupplement,% cjkradicalssupplement,% % cjkstrokes,% cjksymbolsandpunctuation,% cjkunifiedideographs,% cjkunifiedideographsextensiona,% cjkunifiedideographsextensionb,% cjkunifiedideographsextensionc,% cjkunifiedideographsextensiond,% cjkunifiedideographsextensione,% cjkunifiedideographsextensionf,% }% }] \definefont[NotoCJKvertical][NotoSanstc-Regular*default,vertical @ 24pt] \showglyphs \unexpanded\def\stripe#1{\hbox orientation 0 yoffset 3pt{\strut #1}} \setbox1000\hbox{\NotoCJKvertical\startscript[hangul]\dorecurse{20}{通用规范汉字表 \stripe{test #1} }\stopscript} \ruledvbox orientation 1 to \textwidth \bgroup \hsize \textheight \unhbox1000 \vfill \egroup % \stopscript \stoptext