typesetting and layout in multiple directionstug.org/tug2013/slides/plaice-t-13-tug.pdf · rtl |mu...

25
Typesetting and Layout in Multiple Directions John Plaice The University of New South Wales Sydney, Australia Visiting Scientist, Concordia University, Montreal, Canada October 26, 2013

Upload: others

Post on 24-Nov-2020

16 views

Category:

Documents


0 download

TRANSCRIPT

  • Typesetting and Layout in Multiple Directions

    John Plaice

    The University of New South WalesSydney, Australia

    Visiting Scientist, Concordia University,Montreal, Canada

    October 26, 2013

  • Example problem: Japanese

    Lines are read down,from left to right.Japanese is vertical.English is rotated -90◦.Numbers are verticalor horizontal.

  • Example problem: Mongolian

    Lines are read down,from right to left.Mongolian is like aMiddle-Eastern script,rotated 90◦. Chineseis vertical. English isrotated -90◦. Numbersare horizontal.

  • Previous work: pLATEX 2ε

    Generated by C

    amS

    canner from intsig.com

    Each hbox or vbox can be in yoko(normal) or tate direction. HisatoHamano, Vertical Typesetting withTEX, TUGboat 11(3):346–352, 1990.

  • Previous work: CSS (1)

    Horizontal Text, Cascading Style Sheets (CSS) for HTML.

    English, French, . . . Arabic, Hebrew, . . .

    Introduction of general terminology.

  • Previous work: CSS (2)

    Vertical Text, Cascading Style Sheets (CSS) for HTML.

    Japanese, Chinese, . . . Mongolian, Uighur, . . .

    http://www.w3.org/TR/css3-writing-modes

  • Previous work: Omega (1)

    In 2001, I was working on Omega with Yannis Haralambous.We proposed an approach for multiple direction documents.

    A writing direction could be defined by three components:

    1. The “top” of each page.

    2. The “left” of each line.

    3. The “top” of each character.

    John Plaice, Yannis Haralambous. Writing in multiple directionsin Omega. Fourth International Symposium on MultilingualComputing, March 1–3, 2001, Tokyo, Japan.

    Yannis Haralambous, John Plaice. The Omega Typesetting andDocument Processing System (in Japanese). BIT 4:173–152, 2001.

  • Previous work: Omega (2)

    TLT — Left-right (LR) scripts, horizontal CJK.

    TRT — Right-left (RL) scripts.

    RTT — Vertical CJK, upright LR scripts in vertical CJK.

    LTL — Mongolian and Uighur (MU).

    RTL — MU scripts in vertical CJK.

    RTR — Rotated LR scripts in vertical CJK.

    LTR — Rotated LR scripts in MU.

    LTT — Vertical CJK in MU.

  • Previous work: Omega (3)

    Each writing direction required different fonts.

  • My thesis: All this can be simplified

    I A writing system should be invariant to rotation.

    I Writing should not be defined by the box holding it.

    I For example, typesetting along a curve requires no boxes.

    I The different kinds of writing: baseline (LR and RL) and axial.

    I Baseline writing is naturally horizontal: glyphs are hung fromor placed on the baseline, the direction of writing isperpendicular to glyph orientation.

    I Axial writing is naturally vertical: glyphs are attached to theaxis, the direction of writing is opposite to glyph orientation.

    I The line orientation can be positive or negative.

  • The three different kinds of writing

    This is baseline left-to-right writing.

    Thisisbaselineright-to-leftwriting.

    WRITING◦

    THIS

    IS

    AXIAL

  • Embeddings

    In the following six slides, text A will be embedded in text B:

    A. pneumonoultramicroscopicsilicovolcanoconiosis

    B. I am glad · · · is not well known.Texts A and B will be using different combinations of writing style.The choice of text A: long, with many possible hyphenation points.

  • Embedding a baseline text in another baseline text

    I am glad pneumonoultramicroscopicsilicovol-canoconiosis is not well known.

    Iamgladpneumonoultramicroscopicsilicovol-canoconiosisisnotwellknown.

    Iamgladpneumonoultramicroscopicsilicovol-canoconiosisisnotwellknown.

    I Depending on the fonts, vertical adjustment of thebaseline of the embedded text may be necessary.

    I In mixed-mode, the embedded text can be mirrored or theTEX– TEX bidirectional paragrapher can be used.

  • Embedding a baseline text in an axial text (1)

    KNOWN◦

    osis

    IS

    NOT

    WELL

    ultra

    micro

    scopicsilico

    volca

    noco

    ni-

    I

    AM

    GLAD

    pneu

    mono-

    KNOWN◦

    osis

    IS

    NOT

    WELL

    ultramicroscopicsilic

    ovo

    lcanoco

    ni- I

    AM

    GLAD

    pneu

    mono-

    I If the embedded text is rotated, it can be rotated −90◦ or 90◦.

  • Embedding a baseline text in an axial text (2)

    KNOWN◦

    volcano-coniosis

    IS

    NOT

    WELL

    I

    AM

    GLAD

    pneumo-noultra-microsco-picsilico-

    I If the embedded text is not rotated, its width must be stated.

    I An inner paragrapher is required within the outer paragrapher.

  • Embedding an axial text in a baseline text (1)

    I am glad P N E U M O N O U L T R A

    M I C R O S C O P I C S I L I C O

    V O L C A N O C O N I O S I S isnot well known.

    I am glad

    PNEUMONOULTRA

    MICROSCOPICSILICO

    VOLCANOCONIOSIS isnot well known.

    I If the embedded text is rotated, it can be rotated 90◦ or −90◦.

  • Embedding an axial text in a baseline text (2)

    I am glad

    PNEUM

    ONOUL

    TRAMI

    CROSC

    OPICS

    ILICO

    VOLCA

    NOCON

    IOSIS

    is not well known.

    I If the embedded text is not rotated, its height must be stated.

    I An inner paragrapher is required within the outer paragrapher.

  • Embedding an axial text in a baseline text (3)

    I am glad

    VOLCA

    ILICO

    OPICS

    CROSC

    TRAMI

    ONOUL

    PNEUM

    IOSIS

    NOCON

    is not well known.

    I The embedded text can be inserted as LR text or RL text.

  • The importance of line orientation (1)

    The line orientation ofthe Mongolian is nega-tive, and of the Chineseand English is positive.Annotations should goto the left of the lines.

  • The importance of line orientation (2)

    Automatic language and typesetting processing with 161

    は,組版する文書にフィルタを選択的に適用することができ

    る(選択的とは,どんなフィルタをいつでも使ったり止めたりで

    きるということである.たとえば言語ごと,構成要素ごとに違う

    フィルタを適用することができる).この能力は,NLP(自然言語処理)の手法を用いて,組版の新たな地平を拓くこととなった.

    実際,文書の加工に特別な自然言語向けソフトウェアを必要とす

    る場合があるだろう.単にその言語の単語のコーパスで済む場合

    も,本当の形態素解析を要する場合もあるだろうけれど.

    and here is the text augmented with furigana:

    は,くみ

    組はん

    版するぶん

    文しょ

    書にフィルタをせん

    選たく

    択てき

    的にてき

    適よう

    用することがで

    きる(せん

    選たく

    択てき

    的とは,どんなフィルタをいつでもつか

    使ったりと

    止めた

    りできるということである.たとえばげん

    言ご

    語ごと,こう

    構せい

    成よう

    要そ

    素ごと

    にちが

    違うフィルタをてき

    適よう

    用することができる).こののう

    能りょく

    力は, NLP

    (し

    自ぜん

    然げん

    言ご

    語しょ

    処り

    理)のしゅ

    手ほう

    法をもち

    用いて,くみ

    組はん

    版のあら

    新たなち

    地へい

    平 をひら

    拓くこと

    となった.じっ

    実さい

    際,ぶん

    文しょ

    書のか

    加こう

    工にとく

    特べつ

    別なし

    自ぜん

    然げん

    言ご

    語む

    向けソフトウェア

    をひつ

    必よう

    要とするばあい

    場合があるだろう.たん

    単にそのげん

    言ご

    語のたん

    単ご

    語のコーパス

    です

    済むばあい

    場合も,ほん

    本とう

    当のけい

    形たい

    態そ

    素かい

    解せき

    析をよう

    要するばあい

    場合もあるだろうけ

    れど.

    We can see that in most of the cases, a kanji is covered by one, two or three

    kana. But in certain cases (for exampleばあい

    場合) we see a group of kanji coveredby a group of kana. Explanation: kanji are often combined with other kanji toformwords; we speak of a “kanji complex”. For pedagogical reasons, we retainin the case of kanji complexes the visual correspondence between a kanji andthe kana that correspond to it by centering the latter over the former. But incertain cases a kanji complex takes on a completely new pronunciation that hasnothing to dowith the pronunciation of the component kanji. We then speak ofan irregular kanji complex; in that case the set of kana is centered over the set ofkanji. Hyphenation of these sets is one of the problems of Japanese typesetting.

    Let us return to our morphological analyzer: by analyzing this text it providesus with information of the kind found in Figure 1. We see that for each kanjicomplex chasen provides a “reading”, i.e. an oral representation that seemsto it to be more suitable than others, given the context. But this oral represen-tation is global to the context: a priori it is not clear which kana correspondsto which kanji, nor even if this an irregular complex, in which case this corre-spondence is impossible, by definition.

    Yannis Haralambous and John Plaice. Automatic language andtypesetting processing with Omega (in French). CahiersGUTenberg 39–40:139–166, May 2001.

  • The importance of line orientation (3)

    萬延元年三月

    鷹司殿・近衞殿・ (實萬、前內大臣)

    三條殿等 

    〔御落飾御愼〕

    御愼御落飾被遊候樣取計、其他諸大夫始 

    〔メ〕何一ツ罪科無之 〔者〕ものを召

    捕、關東 〔へ〕江 〔指〕差下し、 〔それ

    それ〕

    夫々非道之 〔處〕所置 〔致し

    〕いたし、專 

    〔ら〕虎狼 

    〔の〕 〔猛〕之威 〔を〕ヲ以 

    〔て〕天下を屛息せしめ、畿內之開港

    邪敎寺取建等 (安政六年九月十三日、幕府、日米修好通商條約批准ノ爲外國奉行等ヲ米國ニ派遣ス)

    本條約 〔指〕差許 〔し且

    ハ〕

    候得は、 (尊融

    親王、安政六年十二月七日、退隱・永蟄居)

    靑蓮院宮樣 

    〔之〕御英邁を奉忌御失德有之樣申觸 

    〔し〕、御寺務取 〔し

    〕放

    幕府ハ無實ノ

    罪ニテ鷹司以

    下處罰ス

    本條約ヲ許可

    シ尊融親王ヲ

    幽閉スルハ北

    條足利ノ暴橫

    ニ等シ

    奉幽閉候所業、乍恐 玉 〔體〕躰二 〔可

    〕も奉迫候 〔之機

    〕趣顯然二而、 (義時、承久三年後鳥羽上皇ノ軍ヲ破ル)

    北條・ (尊氏

    、後醍醐天皇ニ叛ク)

    足利之暴橫二均 

    〔し〕く、 〔共に

    天を戴かざる〕

    不共戴天之國

    と 〔いふ

    〕云へし、嗚呼此儘二打過な八、赫々たる神州、一兩年を不出、內地之奸民邪敎二靡 〔き〕キ、彼

    一兩年ノ內ニ

    ハ國內邪敎ニ

    ナビキ奸

    彼ニ從屬スル

    ハ明ラカナリ

     〔か〕@勢焰を助け

    皇國之奸

    平身低頭して彼か正朔を奉する事、掌の上二視るか如し、苟 〔も〕モ人心有之 〔者〕もの、實

    二痛哭長大息に不堪事ならずや、雖然、

    東照宮之 

    〔御〕德澤未 

    〔だ〕地に 〔不墜

    〕墜ず、御三家御一門二は尾張殿・水戶殿・一橋殿・ (松平慶永、前福井藩主)

    越前 〔殿〕家・ (蜂須

    賀齊裕、德島

    阿波家・ (池因

     田慶德、鳥取藩主)

     藩主)州家之如き 德川家輔佐之良將も有之、外諸侯二も薩州・仙臺・福岡・佐賀・長州・土 〔佐〕州・

    宇和島・柳川等天下之爲忠憤之念日夜 〔怠ら

    ざる〕

    不怠、有名之諸侯も不少候 〔へ〕得ハ、內は則 

    〔ち〕御 〔家〕加門方 將

    內ハ家門方將

    軍家ヲ補佐シ

    內政ヲ修メ外

    ハ諸侯武備ヲ

    整へ神州ノ恥

    辱一洗シ叡慮

    ヲ安ゼン

    軍家を奉補佐專 

    〔ら〕內政を 〔修〕脩め、外は則有名之諸侯一意 〔「二

    」ナシ〕

    二忠力を盡し武備を 〔へ

    〕整な八 神州之恥辱

    を一洗して、 叡慮を奉 〔安〕要候事天地神明に誓 〔て〕ひ疑 〔ある

    へからず〕

    有まし、依之當今事態 〔之〕々槪略を記して天下

    之公論折衷を待 

    〔ち〕、左袒して天下を興起せんと欲する所 〔なり

    〕也、周 〔の〕之衰る婦人すら不恤諱して周家

    萬延元年三月

    之亡 

    〔る〕 〔「事

    」ナシ〕

    事を 〔憂ひ

    しに〕

    憂しに、まして三千年余之 〔天〕君恩を戴き、 〔二〕貳百年來

    東照宮之恩澤に沐浴する 〔者〕もの誰歟報效 〔の〕之念な 

    〔か〕らん 

    〔や〕、草仗之小臣痛憤切齒之 〔餘〕余 〔「り」ナシ〕

    り寢⻝を 〔不安

    〕安んせ

    す日夜遺憾 〔を吞

    て〕て時勢を憂 

    〔ひ〕しか、彼 〔の〕か罪惡追日增長 〔「す

    」ナシ〕

    す、豈唯 德川家之罪人 〔のみ

    〕而已ならんや、實

    彼ハ德川家ノ

    罪人神州ノ逆

    ナリ

     〔「二」ナシ〕

    二神州 〔の〕之逆

     〔也〕なり、 〔「然

    則」ナシ〕

    然則天地神人同憤之時二乘し、天下諸藩之同志と 

    〔合力〕同心して天下之 〔奸〕姦

    天下諸藩同志

    ト共ニ天下ノ

    ニ神罰ヲ

    加フル者也

    誅伐し、神罰を蒙ら 〔しむ

    る者〕

    するもの也、

    §§§§§§§§§§§§§§§§§§§§

    (卷

    紙)

    三月三日

    大老井伊直弼掃部

    屆書(案)

    ○史料編纂所所藏「幕府沙汰書」ハ、一、狼藉應戰屆書、二、同屆書別紙(彥根藩士死傷者書上)、三、水戶藩士死骸

    引取屆ノ三通ヲ收載ス、一ト本案ト

    言ノ異ナル箇所ヲ注記セリ、又

    紙添付位置ハ元來ノモノカ後考ヲ要ス、

    今朝登

    今朝登城中外

    櫻田門外ニテ

    狼藉者駕ヲ襲

    擊ス

    城 〔掛〕ケ、外櫻田 〔「御門外」ナシ〕

    御門外松平 (親良、杵築藩主)

    大隅守門前@上杉 (齊憲、米澤藩主)

    彈正大弼辻番所迄之間二而、狼藉者鐵炮打 〔ケ〕

    掛、凡

     〔二十〕貳拾人餘り拔連、駕 〔籠〕を目

    ケ切込候二付、供方之者共防戰致し、狼藉者壹人討留、其餘手疵深

    一人討取ルモ

    其外逃亡ス

    手等爲負候二付、悉く逃去申候、 

    〔拙者儀捕押方等指揮致候處怪我致し候二付一ト先歸宅致し候〕

    尤供 〔方始〕

    頭初卽死手負之者 〔別紙之通二〕

    何人御座候、此段御屆 〔被〕申

    逹候、以上、

    供頭等手負ア

    リ右御屆申逹

    Example from talkof NAKANO Ken.

  • The importance of line orientation (4)

    萬延元年三月

    鷹司殿・近衞殿・ (實萬、前內大臣)

    三條殿等 

    〔御落飾御愼〕

    御愼御落飾被遊候樣取計、其他諸大夫始 

    〔メ〕何一ツ罪科無之 〔者〕ものを召

    捕、關東 〔へ〕江 〔指〕差下し、 〔それ

    それ〕

    夫々非道之 〔處〕所置 〔致し

    〕いたし、專 

    〔ら〕虎狼 

    〔の〕 〔猛〕之威 〔を〕ヲ以 

    〔て〕天下を屛息せしめ、畿內之開港

    邪敎寺取建等 (安政六年九月十三日、幕府、日米修好通商條約批准ノ爲外國奉行等ヲ米國ニ派遣ス)

    本條約 〔指〕差許 〔し且

    ハ〕

    候得は、 (尊融

    親王、安政六年十二月七日、退隱・永蟄居)

    靑蓮院宮樣 

    〔之〕御英邁を奉忌御失德有之樣申觸 

    〔し〕、御寺務取 〔し

    〕放

    幕府ハ無實ノ

    罪ニテ鷹司以

    下處罰ス

    本條約ヲ許可

    シ尊融親王ヲ

    幽閉スルハ北

    條足利ノ暴橫

    ニ等シ

    奉幽閉候所業、乍恐 玉 〔體〕躰二 〔可

    〕も奉迫候 〔之機

    〕趣顯然二而、 (義時、承久三年後鳥羽上皇ノ軍ヲ破ル)

    北條・ (尊氏

    、後醍醐天皇ニ叛ク)

    足利之暴橫二均 

    〔し〕く、 〔共に

    天を戴かざる〕

    不共戴天之國

    と 〔いふ

    〕云へし、嗚呼此儘二打過な八、赫々たる神州、一兩年を不出、內地之奸民邪敎二靡 〔き〕キ、彼

    一兩年ノ內ニ

    ハ國內邪敎ニ

    ナビキ奸

    彼ニ從屬スル

    ハ明ラカナリ

     〔か〕@勢焰を助け

    皇國之奸

    平身低頭して彼か正朔を奉する事、掌の上二視るか如し、苟 〔も〕モ人心有之 〔者〕もの、實

    二痛哭長大息に不堪事ならずや、雖然、

    東照宮之 

    〔御〕德澤未 

    〔だ〕地に 〔不墜

    〕墜ず、御三家御一門二は尾張殿・水戶殿・一橋殿・ (松平慶永、前福井藩主)

    越前 〔殿〕家・ (蜂須

    賀齊裕、德島

    阿波家・ (池因

     田慶德、鳥取藩主)

     藩主)州家之如き 德川家輔佐之良將も有之、外諸侯二も薩州・仙臺・福岡・佐賀・長州・土 〔佐〕州・

    宇和島・柳川等天下之爲忠憤之念日夜 〔怠ら

    ざる〕

    不怠、有名之諸侯も不少候 〔へ〕得ハ、內は則 

    〔ち〕御 〔家〕加門方 將

    內ハ家門方將

    軍家ヲ補佐シ

    內政ヲ修メ外

    ハ諸侯武備ヲ

    整へ神州ノ恥

    辱一洗シ叡慮

    ヲ安ゼン

    軍家を奉補佐專 

    〔ら〕內政を 〔修〕脩め、外は則有名之諸侯一意 〔「二

    」ナシ〕

    二忠力を盡し武備を 〔へ

    〕整な八 神州之恥辱

    を一洗して、 叡慮を奉 〔安〕要候事天地神明に誓 〔て〕ひ疑 〔ある

    へからず〕

    有まし、依之當今事態 〔之〕々槪略を記して天下

    之公論折衷を待 

    〔ち〕、左袒して天下を興起せんと欲する所 〔なり

    〕也、周 〔の〕之衰る婦人すら不恤諱して周家

    萬延元年三月

    之亡 

    〔る〕 〔「事

    」ナシ〕

    事を 〔憂ひ

    しに〕

    憂しに、まして三千年余之 〔天〕君恩を戴き、 〔二〕貳百年來

    東照宮之恩澤に沐浴する 〔者〕もの誰歟報效 〔の〕之念な 

    〔か〕らん 

    〔や〕、草仗之小臣痛憤切齒之 〔餘〕余 〔「り」ナシ〕

    り寢⻝を 〔不安

    〕安んせ

    す日夜遺憾 〔を吞

    て〕て時勢を憂 

    〔ひ〕しか、彼 〔の〕か罪惡追日增長 〔「す

    」ナシ〕

    す、豈唯 德川家之罪人 〔のみ

    〕而已ならんや、實

    彼ハ德川家ノ

    罪人神州ノ逆

    ナリ

     〔「二」ナシ〕

    二神州 〔の〕之逆

     〔也〕なり、 〔「然

    則」ナシ〕

    然則天地神人同憤之時二乘し、天下諸藩之同志と 

    〔合力〕同心して天下之 〔奸〕姦

    天下諸藩同志

    ト共ニ天下ノ

    ニ神罰ヲ

    加フル者也

    誅伐し、神罰を蒙ら 〔しむ

    る者〕

    するもの也、

    §§§§§§§§§§§§§§§§§§§§

    (卷

    紙)

    三月三日

    大老井伊直弼掃部

    屆書(案)

    ○史料編纂所所藏「幕府沙汰書」ハ、一、狼藉應戰屆書、二、同屆書別紙(彥根藩士死傷者書上)、三、水戶藩士死骸

    引取屆ノ三通ヲ收載ス、一ト本案ト

    言ノ異ナル箇所ヲ注記セリ、又

    紙添付位置ハ元來ノモノカ後考ヲ要ス、

    今朝登

    今朝登城中外

    櫻田門外ニテ

    狼藉者駕ヲ襲

    擊ス

    城 〔掛〕ケ、外櫻田 〔「御門外」ナシ〕

    御門外松平 (親良、杵築藩主)

    大隅守門前@上杉 (齊憲、米澤藩主)

    彈正大弼辻番所迄之間二而、狼藉者鐵炮打 〔ケ〕

    掛、凡

     〔二十〕貳拾人餘り拔連、駕 〔籠〕を目

    ケ切込候二付、供方之者共防戰致し、狼藉者壹人討留、其餘手疵深

    一人討取ルモ

    其外逃亡ス

    手等爲負候二付、悉く逃去申候、 

    〔拙者儀捕押方等指揮致候處怪我致し候二付一ト先歸宅致し候〕

    尤供 〔方始〕

    頭初卽死手負之者 〔別紙之通二〕

    何人御座候、此段御屆 〔被〕申

    逹候、以上、

    供頭等手負ア

    リ右御屆申逹

    Note that there are two annotationlines, one to the right, one to the left.Magnification of previous example.

  • Multiple parallel axes and line orientation (1)

    major annotation axis−−−−−−−−−−−−−−−−−−→↑ central textual axis−−−−−−−−−−−−−−−−−−→minor annotation axis−−−−−−−−−−−−−−−−−−→

    majorannotationaxis −−−−−−−−−−−−−−−−−−→↑centraltextualaxis −−−−−−−−−−−−−−−−−−→minorannotationaxis −−−−−−−−−−−−−−−−−−→

    major

    ann

    otationaxis

    −−−−−−−−−−−−−−−−−−→↑

    central

    textual

    axis−−−−−−−−−−−−−−−−−−→m

    inor

    ann

    otationaxis

    −−−−−−−−−−−−−−−−−−→

    majorannotationaxis

    −−−−−−−−−−−−−−−−−−→

    ↑centraltextualaxis

    −−−−−−−−−−−−−−−−−−→

    minorannotationaxis

    −−−−−−−−−−−−−−−−−−→

    Positive orientation Negative orientation

  • Multiple parallel axes and line orientation (2)

    I A simple running text is a set of multiple interacting streams.

    I A more general setting is discussed in: Blanca Mancilla,Jarryd P. Beck, John Plaice: Typesetting multiple interactingstreams. ACM Symposium on Document Engineering 2012:149-152, Paris, France.

  • Adapting existing TEX engines

    I Limited number of primitives:I mirror text;I rotate clockwise;I rotate counterclockwise.

    I Limited number of parameters:I numeric: shifting the base line;I Boolean: mirror or not, rotation or not,

    clockwise or counterclockwise;I direction: text, mathematics, paragraph, page body, page.

    I Most of the Omega code is still relevant.

    I Both pTEX and XeTEX can be extended in these ways.

    I We need to add a paragrapher within the paragrapher.

    I New kinds of embeddings can be defined.

    I Adding multiple interacting streams is non-trivial.

    IntroductionpTeXCSSOmegaNew ideaEmbeddingOrientationImplementation