Home
luatexja-en. - ftp.uni
Contents
1. BEICA lt C FREE AMALIA CID 7652 8 K M CID 13706 EF RX A KOB EA BT ER l e E XcID 1481H Th 575R hd went Bl amp CID 8705 UTF FA11 aj AAD AZATYI 3 5 Changing default Japanese fonts Ifluatexja cfg can be seen from Lua TFX LuaTgx ja automatically reads it The main use of luatexja cfg is for changing default Japanese fonts when IPAex fonts cannot be installed in TEX system One should not overuse this luatexja cfg fonts which will be used in a document should be specified in its source For example def 1tj stdmcfont IPAMincho def 1tj stdgtfont IPAGothic makes that IPA Mincho and IPA Gothic will be used as default Japanese fonts instead of IPAex Mincho and IPAex Gothic For another example the following two lines makes that non embedded fonts Ryumin Light and GothicBBB Medium as default Japanese fonts as the earlier version of LuaTgxX ja def 1tj stdmcfont psft Ryumin Light def 1tj stdgtfont psft GothicBBB Medium 13 4 Changing Internal Parameters There are many internal parameters in LuaTgxX ja And due to the behavior of LuaTgX most of them are not stored as internal register of TEX but as an original storage system in Lua T X ja Hence to assign or acquire those parameters you have to use commands X1tjsetparameter and lt jgetparameter 4 1 Range of JAchars LuaTgX ja divides the Unicode codespace U 0080 U 10FFFF into character ranges numbered 1 to 217 The grouping c
2. OpenType font features are ignored in these parameters For example a fullwidth katakana 7 line 10 in the below input is replaced to its halfwidth variant 7 by hwid feature However the penalty inserted after it is 10 which is the postbreakpenalty of 7 not 20 on 1t jsetparameter postbreakpenalty 7 10 1tjsetparameter postbreakpenalty 20 newcommand showpostpena 1 7 leavevmode setbox0 hbox 1 hbox unhbox0 setbox0 lastbox the lastpenalty showpostpena 7 showpostpena addjfontfeatures CharacterWidth Half showpostpena 77 18 Part II Reference 5 catcode in LuaTpx ja 5 1 Preliminaries kcatcode in pIgX and upTIgX In pIFX and upTFX the value of kcatcode determines whether a Japanese character can be used in a control word For the detail see Table 4 kcatcode can be set by a row of JIS X 0208 in pIFX and generally by a Unicode block in upIEX So characters which can be used in a control word slightly differ between pIFX and upIgx 5 2 Case of LuaTpx ja The role of Xkcatcode in pIFX and upI X can be divided into the following four kinds and Lua TfX ja can control these four kinds separately e Distinction between JAchar or ALchar is controlled by the character range see Subsection 4 1 e Whether the character can be used in a control word is controlled by setting catcode to 11 enabled or 12 disabled as usual e Whether jcharwidowp
3. Characters usually not in Japanese fonts This range consists of almost all Unicode blocks which are not in other predefined ranges Hence instead of showing the block list we put the definition of this range itself lt jdefcharrange 4 500 10FF 1200 1DFF 2440 245F 27C0 28FF 2A00 2AFF 2C00 2E7F 4DCO 4DFF A4DO A82F A840 ABFF FBOO FEOF FE20 FE2F FE70 FEFF 10000 1FFFF E000 F8FF non Japanese Range 5A Surrogates and Supplementary Private Use Areas Range 6 Characters used in Japanese The block list is indicated in Table 2 Range 7 Characters used in CJK languages but not included in Adobe Japan1 6 The block list is indi cated in Table 3 MNotes on U 0080 U 00FF You should treat characters in textttU 0080 U 00FF as ALchar when you use traditional 8 bit fonts such as the textcomp package or the marvosym package For example the codepoint textparagraph which is provided by the textcomp package is 182 This codepoint corresponds Y U 00B6 in Unicode Similarly Frowny which is provided by the marvosym 15 Table 3 Unicode blocks in predefined character range 7 U 1100 U 11FF Hangul Jamo U 2F00 U 2FDF Kangxi Radicals U 2FFO U 2FFF Ideographic Description Characters U 3100 U 312F Bopomofo U 3130 U 318F Hangul Compatibility Jamo U 31A0 U 31BF Bopomofo Extended U 31C0 U 31EF CJK Strokes U A000 U A48F Yi Syllables U A490 U A4CF Yi Radicals U A830 U A83F Common Indic Number Forms U ACOO U
4. pa which equals to 0 25 mm and used in Japanese photo typesetting This jH is the same dimen register as jQ 1tj zw dimension A temporal register for the full width of current Japanese font The command zw sets this register to the correct value and return this register itself 1tj zh dimension A temporal register for the full height usually the sum of height of imaginary body and its depth of current Japanese font The command zh sets this register to the correct value and return this register itself 42 jfam attribute Current number of Japanese font family for math formulas 1tj curjfnt attribute The font index of current Japanese font for horizontal direction 1tj curtfnt attribute The font index of current Japanese font for vertical direction 1tj charclass attribute The character class of a JAchar This attribute is only set on a glyph_node which contains a JAchar 1tj yablshift attribute The amount of shifting the baseline of alphabetic fonts in scaled point 27 pt 1ltj ykblshift attribute The amount of shifting the baseline of Japanese fonts in scaled point 271 pt MtjUtablshift attribute MtjCtkblshift attribute Mtjlautospc attribute Whether the auto insertion of kanjiskip is allowed at the node 1tj autoxspc attribute Whether the auto insertion of xkanjiskip is allowed at the node 1tj icflag attribute An attribute for distinguishing kinds o
5. whose character code is 13 47 14 Patch for the listings Package It is well known that the listings package outputs weird results for Japanese input The listings package makes most of letters active and assigns output command for each letter 2 But Japanese characters are not included in these activated letters For pI X series there is no method to make Japanese characters active a patch jlisting sty 4 resolves the problem forcibly In LuaTFX ja the problem is resolved by using the process_input_buffer callback The callback function inserts the output command active character U FFFFF before each letter above U 0080 This method can omits the process to make all Japanese characters active most of the activated characters are not used in many cases If the listings package and LuaTpX ja were loaded then the patch Iltjp listings is loaded automatically at begin document 14 1 Notes and additional keys WVariation selectors lltjp listings add two keys namely vsraw and vscmd which specify how variation selectors are treated in 1stlisting or other enviroments Note that these additional keys are not usable in the preamble since Iltjp listings is loaded at begin document vsraw is a key which takes a boolean value and its default value is false If the vsraw key is true then variation selectors are combined with the previous character begin 1stlisting vsraw true 2 Blois
6. Sik Sa 1 Bh SMK Be 3 end lstlisting e Ifthe vsraw key is false then variation selectors are typeset by an appropriate command which is specified by the vscmd key The default setting of the vscmd key produces the following 1 begin lstlisting vsraw false 2 vscmd 1tjlistingsvsstdcmd 5 BERT BEME Bm i 4 end lstlisting Sikh NX 5A For example the following code is the setting of the vscmd key in this document 1 def IVSAH1 2 3 4 5 7 2 textcolor blue raisebox 3 5pt tt7 3 fboxsep 0 5pt fbox tiny oalign 0 1 2 crcr 3 4 5 crcr a s catcode 11 6 gdef IVSB 1 expandafter IVSA directlua 7 local cat_str luatexbase catcodetables string 8 tex sprint cat_str string format X OxEQOEF 1 s 1 lstset vscmd IVSB The default output command of variation selectors is stored in ltjlistingsvsstdcmd M The doubleletterspace key Even the column format is c fixed sometimes characters are not vertically aligned The following example is typeset with basewidth 2em and you ll see the leftmost H are not vertically aligned Hs H H H H lltjp listing adds the doubleletterspace key not activated by default for compatibility to improve the situation namely doubles inter character space in each output unit With this key the above input now produces better output 48 14 2 Class of characters Roughly speaking the listing
7. The value field of these nodes doesn t matter stack_marker Nodes for LuaTgxX ja s stack system see the next subsection The value field of these nodes is current group level char_by_cid Nodes for JAchar which the callback process of luaotfload won t be applied and the char acter code is stored in the value field Each node of this type are converted to a glyph_node after the callback process of luaotfload Nodes of this type is used in CID UTF and IVS support 43 replace_vs Similar to char_by_cid whatsits above These nodes are for ALchar which the callback process of luaotfload won t be applied begin_par Nodes for indicating beginning of a paragraph A paragraph which is started by item in list like environments has a horizontal box for its label before the actual contents So direction These whatsits will be removed during the process of inserting JAglues 12 2 Stack system of LuaT X ja MBackground LuaTpx ja has its own stack system and most parameters of Lua TfX ja are stored in it To clarify the reason imagine the parameter kanjiskip is stored by a skip and consider the following source 1 ltjsetparameter kanjiskip 0pt S HSH 2 setbox0 hbox lt jsetparameter kanjiskip 5pt lElF El 3 box0 U EU ENpar SE NE WUE ROTOS As described in Subsection 8 1 the only effective value of kanjiskip in an hbox is the latest value so the value of kanjiskip which applied in the entire hbox sh
8. kansuji hoge 12355 Y jis hoge char jis hoge E kansuji1701 To change characters of Chinese numerals for each digit set kansujichar parameter ltjsetparameter kansujichar 1 p 1tjsetparameter kansujichar 7 AH 1tjsetparameter kansujichar 0 Bh kansuji1701 5 y sees 34 a u e v no 9 2 inhibitglue inhibitglue suppresses the insertion of JAglue The following is an example using a special JFM that there will be a glue between the beginning of a box and 25 and also between 25 and 7 jfont g file KozMinPr6N Regular otf jfm test Ag p Ub fbox hbox 7 H inhibitglue 7 inhibitglue par noindent 1 mH 1 par inhibitglue noindent 252 2 par noindent inhibitglue 43 3 par hrule noindent Hoff inhibitglue ice dh office With the help of this example we remark the specification of inhibitglue e The call of inhibitglue in the internal vertical mode is simply ignored e The call of inhibitglue in the restricted horizontal mode is only effective on the spot does not get over boundary of paragraphs Moreover inhibitglue cancels ligatures and kernings as shown in the last line of above example e The call of inhibitglue in math mode is just ignored 9 3 ltjdeclarealtfont Using 1t jdeclarealtfont one can compose more than one Japanese fonts This 1t jdeclarealtfont uses in the following form 1tjdeclarealtf ont base_font_cs alt_font_cs ra
9. 0 0 00000 eee 42 122 Stacksystem ol Lua pX ja cocoa A Bee ead 44 12 3 Lua functions of the stack system oc a a eR ES eA karria ee 45 124 Extending Parameters so s aad ee ee ee oR ee eRe Ee ee da SA eas 45 13 Linebreak after a Japanese Character 46 131 Belerevce behavior pl oea uo ee eee ee pe be Ba ee ee 46 13 2 Behavior in Lua Xa e a a ew ee Bed BES OG Eee 46 14 Patch for the listings Package 48 14 1 Notes and additional keys co ke ee ee RR ee eee Re A 48 14 2 Class of characters cios io bo GA AEE ees Er RI Er Bee he 49 15 Cache Management of Lua TEX ja 50 Toil MSO IE 50 152 Internal opa Sh we RS eS ee ws oe BES a EEG Fa ba ws amp 51 References 52 This documentation is far from complete It may have many grammatical and contextual errors Also several parts are written in Japanese only Part I User s manual 1 Introduction The LuaTgxX ja package is a macro package for typesetting high quality Japanese documents when using LuaT X 1 1 Backgrounds Traditionally ASCII pI X an extension of TEX and its derivatives are used to typeset Japanese documents in TeX pI X is an engine extension of TFX so it can produce high quality Japanese documents without using very complicated macros But this point is a mixed blessing pIFX is left behind from other extensions of TFX especially e IgX and pdf T X and from changes about Japanese processing in computers e g the UTF 8 encoding Recently extensions of pIFX namely u
10. 2pt abcH 9 w5 There is an interesting side effect characters in different size can be vertically aligned center in a line by setting two parameters appropriately The following is an example beware the value is not well tuned vrule width 150pt height4 417pt depth 4 217pt kern 150pt Marge xyz scriptsize 1t jsetparameter yjabaselineshift 1 757pt yalbaselineshift 1 757pt BFxyzBwd HU MD abc xy EEN Sabe Note that setting positive yalbaselineshift or talbaselineshift parameters does not increase the depth of one letter syllable p of Alchar if its left protrusion lpcode and right protrusion rpcode are both non zero This is because These two parameters are implemented by setting yoffset field of a glyph node and this does not increase the depth of the glyph e To cope with the above situation LuaTEX ja automatically supplies a rule in every syllable e However we cannot use this supplying a rule method if a syllable comprises just one letter whose lpcode and rpcode are both non zero This problem does not apply for yjabaselineshift nor tjabaselineshift becuse a JAchar is encapsulated by a horizontal box if needed 17 Y a a a 0 o S 4 5 kinsoku parameters and OpenType features Among parameters which related to Japanese word wrapping process kinsoku shori jaxspmode alxspmode prebreakpenalty postbreakpenalty and kcatcode are stored by each character codes
11. TKIP EP par ZIF Qu 113171 3 1517 pTeX like 1tjsetparameter different jfm paverage Figure 1 Example of jfmvar key BAF AY AIBA AIT A IYI R BAF SYIRAITZ 3 4 BaF a BIF AF IIBADS a AFEITAR Ba newcommand test vrule 41 i 77 24 7 vrule jfont KMFW KozMinPr6N Regular jfm prop kern at 17pt jfont KMFK KozMinPr6N Regular jfm prop at 17pt kern is activated jfont KMPW KozMinPr6N Regular jfm prop script dflt pwid kern at 17pt jfont KMPK KozMinPr6N Regular jfm prop script dflt pwid t kern at 17pt begin multicols 2 1tjsetparameter kanjiskip Opt KMFW test KMFK test KMPW test KMPK test 1tjsetparameter kanjiskip 3pt KMFW test KMFK test KMPW test KMPK test end multicols Figure 2 Kerning information and kanjiskip j m min lua A counterpart for min10 tfm which is one of the default Japanese font metric shipped with pX The difference among these three JFMs is shown in Table 8 jfmvar string Sometimes there is a need that Using kerning information in a font Some fonts have information for inter glyph spacing This version of LuaTgX ja treats kerning spaces like an italic correction any glue and or kern from the JFM and a kerning space can coexist See Figure 2 for detail Note that in setmainjfont etc which are provided by luatexja fontspec package kerning option is set off Kerning 0ff by default because of the compatibility with previous versions of Lua
12. character required except character class 0 This field is a list of characters which are in this character type i This field is optional if i 0 since all JAchar which do not belong any character classes other than 0 are in the character class 0 hence the character class 0 contains most of JAchars In the list character s can be specified in the following form e a Unicode code point the character itself as a Lua string like 4 a string like 5x the character followed by an asterisk e several imaginary characters We will describe these later width length height length depth length italic length required Specify the width of characters in character class i the height the depth and the amount of italic correction All characters in character class i are regarded that its width height and depth are as values of these fields The default values are shown in Table 10 26 Direction of JFM yoko horizontal tate vertical width field the width of the real glyph 1 0 full width height field the height of the real glyph 0 5 half width depth field the depth of the real glyph 0 5 half width italic field 0 0 Table 10 Default values of width field and other fields Consider a Japanese character node which belongs to a charac ter class whose the align field is middle e The black rectangle is the imaginary body of the node Its width height and depth ar
13. determined by the glyph before application of features The following input is an example 1 jfont a file KozMinPr6N Regular otf jfm test vert Ses eae 2 Na Eo inhibitglue IRo IR 28 Table 11 Commands for Japanese math fonts Japanese fonts alphabetic fonts jfam 0 256 fam jatextfont jfam jfont_cs textfont fam font_cs jascriptfont jfam jfont_cs scriptfont fam font_cs jascriptscriptfont jfam jfont_cs scriptscriptfont fam font_cs Here the character class of the ideographic full stop o U 3002 is determined as follows 1 As the case of E the ideographic full stop o is converted to its vertical form U FE12 by vert feature 2 The character class of according to the JFM is zero O 3 3 However Lua TFX ja remembers that this is obtained from o by font features The character class of s is non zero value namely 2000 4 Hence the ideographic full stop o in above belongs the character class 2000 Mimaginary characters As described before you can specify several imaginary characters in chars field The most of these characters are regarded as the characters of class 0 in pIFX As a result Lua T X ja can control typesetting finer than pIFX The following is the list of imaginary characters poxbdd The beginning ending of a hbox and the beginning of a noindented i e began by noindent para grap
14. from align field in the JFM 0 left default 0 5 middle 1 right e For j E o j stores a kern or a glue which will be inserted between character class i and class j If a kern will be inserted the value of this field is j false kern_node ratio where kern_node is anode If a glue will be inserted we have j false spec_node ratio icflag where spec_node is also a node and icflag from_jfm priority The returned table new_jfont_info also should include these fields but you are free to add more fields to use them in the luatexja find_char_class callback The font_number is a font num ber A good example of this and the next callbacks is the luatexja otf package supporting AJ1 xxx form for Adobe Japan1 CID characters in a JFM This callback doesn t replace any code of LuaT X ja luatexja find_char_class callback This callback is called just when LuaTpx ja is trying to determine which character class a character chr_code belongs A function used in this callback should be in the following form function lt number gt char_class lt table gt jfont_info lt number gt chr_code 2 if char_class 0 then return char_class 3 else 4 This version of LuaTEX ja uses direct access model for accessing nodes if possible 30 5 return lt number gt new_char_class or 0 6 end 7end The argument char_class is the result of LuaT X ja s default routine or previous fu
15. hbox yoko DIR hbox tate DIR 3 hbox dtou DIR hbox utod DIR 4 hbox tate hbox tate math DIR TT YU 048 1 I 6 setbox2 hbox tate ltjgetparameter boxdir 2 w 6 3 Overridden box primitives To cope with multiple directions the following primitives are overridden by LuaT X ja using protected def 22 Y w Table 8 Differences between horizontal JFMs shipped with Lua T X ja 90000 DAHEEDR ARE TIA Po THLE 900000 HAHET AIBR TIA PITZ o Che 90000 HSHEEBS PUPS 45 UY TC Ac Cie a tale La Ebko BEveE 7 BEDE laff YD YB pb i lb Blue jfm ujis 1lua Black jfm jis lua Red jfm min lua JO unhbox num Nunvbox num unhcopy num Nunvcopy num vadjust material insert number material lastbox raise dimen box lower dimen box etc vcenter vcenter 7 Font Metric and Japanese Font 7 1 jfont To load a font as a Japanese font for horizontal direction you must use the jfont instead of font while jfont admits the same syntax used in font LuaTgX ja automatically loads luaotfload package so TrueType OpenType fonts with features can be used for Japanese fonts jfont tradgt file KozMinPr6N Regular otf script latn ttrad kern a at 14pt eS B S Yih tradgt S R E E Note that the defined control sequence tradgt in the example above using
16. io i TE a 2 RARO ruby MBA ED TARIE PERO HERE gt BRO rupy MBHHES CAPES BR eN ee Ey US ERE le Acta FE PERIL As the above example ruby hangover is allowed on the Hiragana before after its base characters Mono ruby To attach ruby characters to each base characters mono ruby one should use ruby mul tiple times 1 RRO ruby Wit ED Hruby AH CARI HOw HERG SSN Jukugo ruby Vertical bar denotes a boundary of groups 1 ed ers CAN SN Li a it ai If there are multiple groups in one ruby call A linebreak between two groups is allowed 1 vbox hsize 6 zw noindent Oe ae 2 NMhbox to 2 5 zw ruby R AHI HIT amp 5 DE fe i pozn 3 hbox to 2 5 zw ruby RI BB HIT FO 5 DE fe H P sa hbox to 3 zw ruby Rl BI AIBH 5 DE fe ji alo pl 3 pe If the width of ruby characters are longer than that of base characters ruby automatically selects the appropriate form among the line head form the line middle form and the line end form 1 vbox hsize 8 zw noindent a 2 null kern3 zw uu ruby A Dt ED S Es 3 MkerniWzw vuu ruby H H 3 IFT EDIAN Bowne HK a null kern5 zw ve ruby fH 3 lt EH ok de s 115 lltjext sty pXI X supplies additional macros for vertical writing in the plext package The Iltjext package which we want to describe here is the LuaTgX ja counterpart of the plext package 41 tabular array minipage environments These environments are extended by lt dir gt whi
17. jfont is not a font_def token but a macro Hence the input like fontname tradgt causes a error We denote control sequences which are defined in jfont by jfont_cs MJFM aJFMhas measurements of characters and glues kerns that are automatically inserted for Japanese typesetting The structure of JFM will be described in the next subsection At the calling of jfont you must specify which JFM will be used for this font by the following keys jfm name Specify the name of horizontal JFM If specified JFM has not been loaded Lua TfX ja search and load a file named jfm name 1ua The following JFMs are shipped with LuaTpx ja j m ujis lua A standard JFM in LuaTgx ja This JFM is based on upnmlminr h tfm a metric for UTF OTF package that is used in upIfX When you use the luatexja otf package you should use this JFM j m jis lua A counterpart for jis tfm JIS font metric which is widely used in pIRX A ma jor difference between jfm ujis lua and this jfm jis lua is that most characters under j m ujis lua are square shaped while that under jfm jis lua are horizontal rectangles 23 o o sys oun e V N H o o s oun e V N H ix 1tjsetparameter different jfm both jfont F file KozMinPr6N Regular otf jfm ujis jfont G file KozGoPr6N Medium otf jfm ujis jfont H f ile KozGoPr6N Medium otf jfm ujis jfmvar hoge F 0 halfwidth space INO Fa NH Tj fullwidth space EF EIFI CW A EF EW IIF Qe
18. opts which will be passed to the fontspec package scale float Override the ratio of the font size of Japanese fonts to that of alphabetic fonts The default value is calculated automatically for example about 0 924865 when the Itjsarticle class is used All other options listed above are simply passed to the fontspec package This means that two lines below are equivalent for example usepackage no math fontspec usepackage luatexja fontspec usepackage no math luatexja fontspec The reason that setmonojfont is not defined by default is that it is popular for Japanese fonts that nearly all Japanese glyphs have same widths Also note that kerning information in a font is not used that is kern feature is set off by default in these seven or eight commands This is because of the compatibility with previous versions of LuaTgxX ja see 7 1 Below is an example of jfontspec jfontspec CJKShape NLC KozMinPr6N Regular JIS X 0213 2004 gt 3 par JIS X 0213 2004 gt it jfontspec CJKShape J1S1990 KozMinPr6N Regular JIS X 0208 1990 gt JIS X 0208 1990 it 3 3 Presets of Japanese fonts One can load the luatexja preset package to use several presets of Japanese fonts This package provides functions in a part of japanese otf package and a part of PXchfon package by Takayuki Yato One can specified other options other than listed in this subsection These are simply passed to the luatexja fontspec For
19. parameter as pIpX As kanjiskip if the natural width of this parameter is maxdimen Lua TfX ja uses the value which is specified in the JFM for current Japanese font See Subsection 7 4 differentjfm mode Specify how glues kerns between two JAchars whose JFM or size are different The allowed argu ments are the followings average both large small pleft pright paverage The default value is paverage jacharrange ranges kansujichar digit chr_code kansujichar direction dir always local Assigning to this parameter has the same effect as yoko if dir 4 tate if dir 3 dtou if dir 1 or utod if dir 11 If the argument dir is not one of 4 3 1 nor 11 the behavior of this assignment is undefined 8 2 ltjgetparameter 1tjgetparameter is a control sequence for acquiring parameters It always takes a parameter name as first argument ltjgetparameter different jfm ltjgetparameter autospacing lt jgetparameter kanjiskip ltjgetparameter prebreakpenalty Y paverage 1 0 0pt plus 0 4pt minus 0 4pt 10000 The return value of Nltjgetparameter is always a string which is outputted by tex write Hence any character other than space U 0020 has the category code 12 other while the space has 10 space If first argument is one of the following no additional argument is needed jcharwidowpenalty yjabaselineshift yalbaselineshift autospaci
20. tate direction is vertical writing The fourth column dtou direc tion is actually a hidden feature of pIEX We implemented this for debugging purpose The fifth column utod direction corresponds the tate math direction of pX Directions can be changed by yoko tate dtou utod only when the current list is null Also the direction of a math formula is changed to utod when the direction outside the math formula is tate vertical writing 6 1 Boxes in different direction As in pIFX one can use boxes of different direction in one document The below is an example 20 row col pX uplgX LuaTpx ja row col pX uplgX LuaTpx ja U 30FB 1 6 N Y N U FF5C 1 35 N N Y U 309B 1 11 Y N U FFOB 1 60 Y U 309C 1 12 N Y N U FF1D 1 65 N N Y U FF40 1 14 N N Y lt U FF1C 1 67 N N Y U FF3E 1 16 N N Y gt U FF1E 1 68 N N Y U FFES 1 17 N N Y U FF03 1 84 N N Y U FF3F 1 18 N N Y amp U FFO6 1 85 N N Y 11 U 3003 1 23 N N Y U FFOA 1 86 N N Y AD U 4EDD 1 24 N Y Y O UFF20 1 837 N N Y U 3005 1 25 N N Y T U 3012 2 9 N N Y PF U 3006 1 26 N N Y m U 3013 2 14 N N Y U 3007 1 27 N N Y U FFE2 2 44 N N Y U 30FC 1 28 N Y Y A u 212B 2 82 N N Y ES U FFOF 1 31 N N Y Greek letters row 6 Y N Y N U FF3C 1 32 N N Y Cyrillic letters row 7 N N Y n wm w e Table 6 Directions supported by Lua T X ja horizontal yoko direction vertical tate direction
21. yoko EZ CH YOKO 3 fboxsep Omm fbox copy32767 38 48877pt 4 vbox hsize 20mm 8 46753pt f s yoko YOKO the ltjgetwd32767 i e the ltjgetht32767 the ltjgetdp32767 ESS Se 7 vbox hsize 20mm raggedleft ao 2 22 S s tate TATE the ltjgetwd32767 Sw ages the ltjgetht32767 the ltjgetdp32767 EERS SF 1 vbox hsize 20mm raggedleft Oo So NS gt oe u dtou DTOU MtheXltjgetwd32767 AM Hs 2 the ltjgetht32767 the ltjgetdp32767 21 Table 7 Boxes in different direction typeset in yoko direction typeset in tate or utod direction typeset in dtou direction Hy Y 4 Dy Wy hy da Hy Wy Dy 0pt lt Wy gt A a 2 Hy US Wp Y ho Dy Wy hp dp Ay Wp Hy dp Hy dy Dy Opt Dy hp Dy h 1t jsetwd num dimen 1t jsetht num dimen 1tjsetdp num dimen These commands set the dimension of box num One does not need to group the argument num four calls of ltjsetwd below have the same meaning Mtjsetwd42 20pt ltjsetwd42 20pt ltjsetwd 42 20pt ltjsetwd 42 20pt 6 2 Getting current direction The direction parameter returns the current direction and the boxdir parameter with the argument num returns the direction of a box register box num The returned value of these parameters are a string Direction yoko tate dtou utod empty Returned value 4 3 1 11 0 1 leavevmode def DIR 1tjgetparameter direction 2
22. 0 30FF BoldFeatures Color 007F00 does not work Instead one have to write UprightFeatures AltFont Font HogeraMin Light Range 3000 30FF F BoldFeatures AltFont 4 Font HogeraMin Bold Range 3000 30FF Color 007F00 On the other hand YokoFeatures TateFeatures and TateFont keys can be specified in each list in the AltFont key Also one can specify AltFont inside YokoFeatures TateFeatures Note that features which are specified in YokoFeatures and TateFeatures are always interpreted after other direction independent features This explains why addjfontfeatures at line 6 in Figure 6 has no effect because a color specification is already done in YokoFeatures and TateFeatures keys 11 2 luatexja otf This optional package supports typesetting characters in Adobe Japan1 character collection or other CID character collection if the font is supported The package luatexja otf offers the following 2 low level commands 39 o uy oao ua e Uu N H a un e v No CID number Typeset a character whose CID number is number UTF hex_number Typeset a character whose character code is hex_number in hexadecimal This command is similar to char hex_number but please remind remarks below This package automatically loads luatexja ajmacros sty which is slightly modified version of ajmacros sty Hence one can use macros which sre defined in ajmacros sty such as VajHA MRema
23. 04 81 0 FS Oc 8100 48 10E Th Specifying glyph variants by IVS precedes glyph replacement by font features For example only Es in p4 is changed by font features jp78 or jp90 which does not followed by any variation selector def TEST 1 jfontspec 1 KozMinPr6N Regular EZL Bt RK 8r Smith Sek BRAV jp78 IX SMK 7308 JEE L TEST jp90 Ei GA E texttt jp78 TEST CJKShape JIS1978 texttt jp90 TEST CJKShape JIS1990 11 3 luatexja adjust see Japanese version of this manual Useful macros by iNOUE Koich for the japanese otf package 40 no adjustment DEORAN VERTE EK MEN GA without priority AED BLA i ERNE oH E MLAS A with priority JA EOS ORR E KARENA R a em in this figure for making the difference obvious em Note the value of kanjiskip is 0 pt Figure 8 Line adjustment 11 4 luatexja ruby This addon package provides functionality of ruby furigana annotations using callbacks of Lua TpX ja There is no detailed manual of luatexja ruby sty in English Japanese manual is another PDF file luatexja ruby pdf Group ruby By default ruby characters the second argument of ruby are attached to base characters the first argument as one object This type of ruby is called group ruby A y AHA k 3 CATER IN RAR
24. A textmc mcfamily mcdefault gothic V Y JF textgt gtfamily gtdefault By default the following fonts are used for mincho and gothic classification family mdseries bf series scale mincho HA ATA mc IPAex Mincho IPAex Gothic 0 962216 gothic 17 Y 91 gt IPAex Gothic IPAex Gothic 0 962216 Note that the bold series in both family are same as the medium series of gothic family There is no italic nor slanted shape for these mc and gt e Japanese characters in math mode are typeset by the font family mc e If you use the beamer class with the default font theme which uses sans serif fonts and with Lua TfX ja you might want to change default Japanese fonts to gothic family The following line changes the default Japanese font family to gothic renewcommand kanjifamilydefault gtdefault However above settings are not sufficient for Japanese based documents To typeset Japanese based documents you are better to use class files other than article cls book cls and so on At the present we have the counterparts of jclasses standard classes in p XTgxX and jsclasses classes by Haruhiko Oku mura namely Itjclasses and Itjsclasses Mgeometry package and classes for vertical writing It is well known that the geometry package produces the following error when classes for vertical writing is used Incompatible direction list can t be unboxed begindvi gt unvbox begindvibox globa
25. As closing this subsection we shall introduce an example of SetRelationFont and userelfont 36 o A o a ma 0 N HB e wv o n DeclareKanjiFamily JY3 Hedm DeclareFontShape JY3 edm m n lt gt s KozMinPr6N Regular jfm ujis DeclareFontShape JY3 edm m green lt gt s KozMinPr6N Regular jfm ujis color 007F00 DeclareFontShape JY3 edm m blue lt gt s KozMinPr6N Regular jfm ujis color 0000FF DeclareAlternateKanjiFont JY3 edm m n JY3 edm m green 4E00 67FF 2 2 DeclareAlternateKanjiFont JY3 edm m n JY3 edm m blue 6800 9FFF kanjifamily edm selectfont AFERA ESR NEAR EARRA SIC TTL e AAS RRS ECEE NAIC BW ONGC CTI Le Figure 5 An example of DeclareAlternateKanjiFont makeatletter SetRelationFont JY3 k family m n 0T1 pag m n k family current Japanese font family V9 abc userelfont selectfont amp L 3 abc 10 2 Detail of fontfamily command In this subsection we describe when fontfamily family changes current Japanese alphabetic font family Basically current Japanese fotn family is changed to family if it is recognized as a Japanese font family and similar with alphabetic font family There is a case that current Japanese alphabetic font family are both changed to family and another case that family isn t recognized as a Japanese alphabetic font family either MRecognition as Japanese font family First Whether Japanese font fami
26. D7AF Hangul Syllables U D7BO U D7FF Hangul Jamo Extended B package has the same codepoint as U 00A7 Hence as previous versions of LuaT X ja if these charac ters are treated as JAchars then textparagraph produces ltjjachar T in a Japanese font and Frowny produces in a Japanese font To avoid such situations the default setting of LuaTgX ja is changed in this release so that all characters U 0080 U 00FF are treated as ALchar If you want to output a character as ALchar and JAchar regardless the range setting you can use ltjalchar and 1tjjachar respectively as the following example 1 gtfamily large default ALchar JAchar q q q 2 Y Mitjalchar Y Mitjjachar QA default ALchar ed a WMtjalchar A Mtjjachar A default JAchar a a a w 4 2 kanjiskip and xkanjiskip JAglue is divided into the following three categories e Glues kerns specified in JFM If inhibitglue is issued around a JAchar this glue will not be inserted at the place e The default glue which inserted between two JAchars kanjiskip e The default glue which inserted between a JAchar and an ALchar xkanjiskip The value a skip of kanjiskip or xkanjiskip can be changed as the following Note that only their values at the end of a paragraph or a hbox are adopted in the whole paragraph or the whole hbox ltjsetparameter kanjiskip Opt plus 0 4pt minus 0 4pt xkanjiskip 0 25 zw plus 1pt minus 1pt Here zw is a internal
27. OO U FFEF Halfwidth and Fullwidth Forms into three subblocks and kcatcode can be set by a subblock 19 Table 4 kcatcode in upTpX kcatcode meaning control word widow penalty linebreak 15 non cjk treated as usual ATEx 16 kanji X Y ignored 17 kana Y Y ignored 18 other N N ignored 19 hangul Y Y space Table 5 Difference of the set of non kanji JIS X 0208 characters which can be used in a control word 5 3 Non kanji characters in a control word Because the engine differ so non kanji JIS X 0208 characters which can be used in a control word differ e o in pI X in upIFX and in LuaTgx ja Table 5 shows the difference Except for four characters k O s oe LuaTgpX ja admits more characters in a control word than upIpX Difference becomes larger if we consider non kanji JIS X 0213 characters For the detail see https github com h kitagawa kct 6 Directions LuaT X supports four Q style directions TLT TRT RTT and LTL However neither directions are not well suited for typesetting Japanese vertically hence we implemented vertical writing by rotating TLT box by 90 degrees LuaTgx ja supports four directions as shown in Table 6 The second column yoko direction is just horizontal writing and the third column
28. Takayuki Yato Now we describe these eight ranges The superscript J or A after the number shows whether each character in the range is treated as JAchars or not by default These settings are similar to the prefercjk settings defined in PXbase bundle Any characters equal to or above U 0080 which does not belong to these eight ranges belongs to the character range 217 Range 8 The intersection of the upper half of ISO 8859 1 Latin 1 Supplement and JIS X 0208 a basic character set for Japanese This character range consists of the following characters e U 00A7 Section Sign e U 00B4 Spacing acute e U 00A8 Diaeresis e U 00B6 Paragraph sign U 00B0 Degree sign e x U 00D7 Multiplication sign e U 00B1 Plus minus sign e U 00F7 Division Sign Range 1 Latin characters that some of them are included in Adobe Japan1 6 This range consists of the following Unicode ranges except characters in the range 8 above 14 Table 1 Unicode blocks in predefined character range 3 U 2000 U 206F General Punctuation U 2070 U 209F Superscripts and Subscripts U 20A0 U 20CF Currency Symbols U 20D0 U 20FF Comb Diacritical Marks for Symbols U 2100 U 214F Letterlike Symbols U 2150 U 218F Number Forms U 2190 U 21FF Arrows U 2200 U 22FF Mathematical Operators U 2300 U 23FF Miscellaneous Technical U 2400 U 243F Control Pictures U 2500 U 257F Box Drawing U 2580 U 259F Block Elements U 25A0 U 25FF Geometr
29. The LuaTpxX ja package The LuaT X ja project team December 12 2015 Contents II User s manual Introduction LL PakO iu dd id A dd CS bo db She Ss Le Mejor chapeer trom pink da he ed a a ee A A a iaraa Ca ii e sg ee Bo A A i ee Es ded 14 Aboutthe prajecee ono HR EPR EEG EES EEE MEE hee EEE ee Getting Started al Tata oda se das dese Siete eee eas a dea Metal Hover ede Rupiah ok dda dase 24 o ge ke eee RO RS RR eR RR Re RRS ee RS 24 Disciplinas oo ER BH Ee RA SESE eee eee hi eS SG Eads 24 Using MIRS oi ies ead ee a a ee Bae a oe a ee Changing Fonts Sl e es sae ae ee ee EAN 32 lwatexjacfontepec package o cec ved rati wee ee ye Pda be Be eed 33 Presets al Japanese TOMES os a cope Ge pp ae ee Re PA eS 3 4 CID UTF and macros in japanese otf package o o ooo oo 35 Changing default Japanese fonts o co ro cies eas eb ee ed ee eds Changing Internal Parameters 2 RANES Oe JCAL o oh eS og ea he E ee BAe PE EG ee Bed AD ana xkanjikip 0 A we a E SO PO ee A 43 Tnsertion setting of xkanjiskip os 2 4 ora ee eee Le ae 24 Shing tine baseline 0 es BK aa Rok Bees hee ase Gee Rak we Rape eRe ase eae 4 5 kinsoku parameters and OpenType features o ooo Reference catcode in LuaTpx ja 5 1 Preliminaries kcatcode in plpX and upIpX o o oo oo ccoo A S2 Caseol uaa o omar LD eR Ree ee ye de ee ee ead 5 3 Non kanji characters in a control word o oo oo Directions Gl Boxes i
30. TpX ja Mextend and slant The following setting can be specified as OpenType font features extend extend expand the font horizontally by extend slant slant slant the font 24 Table 9 Differences between vertical JFMs shipped with LuaTgx ja D4 kEBH gt EE TUES 4 Red jfm tmin lua E ES Blue jfm ujisv lua e mw D M CB Z UK Note that LuaTgxX ja doesn t adjust JFMs by these extend and slant settings you have to write new JFMs on purpose For example the following example uses the standard JFM jfm ujis 1ua hence letter spacing and the width of italic correction are not correct jfont E KozMinPr6N Regular extend 1 5 jfm ujis kern E BWDAS Y dah MAAS DL 7 ABC e jfont S KozMinPr6N Regular slant 1 jfm ujis kern AS U3 ABC a 7 2 tfont 7 3 Prefix psft Besides file and name prefixes which are introduced in the luaotfload package LuaTgX ja adds psft prefix in jfont and font to specify a name only Japanese font which will not be embedded to PDF Note that these non embedded fonts under current Lua TEX has Identity H encoding and this violates the standard ISO32000 1 2008 10 OpenType font features such as jp90 have no meaning in name only fonts using psft prefix because we can t expect what fonts are actually used by the PDF reader Note that extend and slant settings see above a
31. a is an example location If you cloned entire Git repository making a symbolic link of src instead copying is also good Ifmktexlsr is needed to update the file name database make it so 6 2 2 Cautions For changes from pI X see Subsection 1 2 e The encoding of your source file must be UTF 8 Other encodings such as EUC JP or Shift JIS are not supported e LuaTpX ja is very slower than pIFX Generally speaking LuaJITTFX processes LuaTgx ja about 30 faster than LuaTgx but not always e Outdated note for MiKTgX users LuaTgX ja requires that several CMap files must be found from LuaTgx Strictly speaking those CMaps are needed only in the first run of LuaTgxX ja after in stalling or updating But it seems that MiKTgX does not satisfy this condition so you will encounter an error like the following LuaTeX error iles x86 MiKTeX 2 9 tex luatex luatexja 1tj rmlgbm lua bad argument 1 to open string expected got nil If so please execute a batch file which is written on the Project Wiki English This batch file creates a temporary directory copy CMaps in it run a test file which loads LuaT X ja in this directory and finally delete the temporary directory 2 3 Using in plain TEx To use LuaTgx ja in plain TEX simply put the following at the beginning of the document input luatexja sty This does minimal settings like ptex tex for typesetting Japanese documents e The following 12 Japanese fon
32. an be globally customized by 1t jdefcharrange The next line adds whole characters in Supplementary Ideographic Plane and the character E to the character range 100 1tjdefcharrange 100 20000 2FFFF 3 A character can belong to only one character range For example whole SIP belong to the range 4 in the default setting of LuaT X ja and if you execute the above line then SIP will belong to the range 100 and be removed from the range 4 The distinction between ALchar and JAchar is performed by character ranges This can be edited by setting the jacharrange parameter For example the code below is just the default setting of LuaTgx ja and 1t sets e a character which belongs character ranges 1 4 5 and 8 is ALchar e a character which belongs character ranges 2 3 6 and 7 is JAchar ltjsetparameter jacharrange 1 2 3 4 5 6 7 8 The argument to jacharrange parameter is a list of non zero integer Negative integer n in the list means that each character in the range n is an ALchar and positive integer n means that is a JAchar Note that characters U 0000 U 007F are always treated as an ALchar this cannot be customized MDefault character ranges LuaTpX ja predefines eight character ranges for convenience They are determined from the following data e Blocks in Unicode 6 0 e The Adobe Japan1 UCS2 mapping between a CID Adobe Japan1 6 and Unicode e The PXbase bundle for upIFX by
33. anied alphabetic font family with respect to current Japanese font family which was set by DeclareRelationFont or SetRelationFont Like fontfamily selectfont is required to take an effect adjustbaseline In pBTFX 2 adjustbaseline sets tbaselineshift to match the vertical center of M and that of 25 in vertical typesetting hy HO the d tbaselineshift lt 5 os d dy Ca where h and d denote the height of a and the depth respectively In LuaTgX ja this adjustbaseline does same task namely setting the talbaselineshift parameter fontfamily family As in BIFX 2 this command changes current font family alphabetic Japanese or both to family See Subsection 10 2 for detail DeclareAlternateKanjiFont base encoding base family base series base shape alt encoding alt family alt series alt shape range As ltjdeclarealtfont Subsection 9 3 characters in range of the Japanese font we say the base font which specified by first 4 arguments are typeset by the Japanese font which specified by fifth to eighth arguments we say the alternate font An example is shown in Figure 5 e In ltjdeclarealtfont the base font and the alternate font must be already defined But this DeclareAlternateKanjiFont is not so In other words DeclareAlternateKanjiFont is effective only after current Japanese font is changed or only after selectfont is executed
34. arks ALchar standing for all other characters like latin alphabets We say alphabetic fonts for fonts used in ALchar and Japanese fonts for fonts used in JAchar e A word in a sans serif font with underline like prebreakpenalty means an internal parameter for Japanese typesetting and it is used as a key in Nltjsetparameter command e A word in a sens serif font without underline like fontspec means a package or a class of ETpx In this document natural numbers start from zero denotes the set of all natural numbers 1 4 About the project MProject Wiki Project Wiki is under construction e https osdn jp projects luatex ja wiki FrontPage 28en 29 English e https osdn jp projects luatex ja wiki FrontPage Japanese e https osdn jp projects luatex ja wiki FrontPage 28zh 29 Chinese This project is hosted by OSDN Mi Members e Hironori KITAGAWA e Kazuki MAEDA e Takayuki YATO e Yusuke KUROKI e Noriyuki ABE e Munehiro YAMAMOTO e Tomoaki HONDA e Shuzaburo SAITO e MA Qiyuan 2 Getting Started 2 1 Installation The following packages are needed for the LuaTgX ja package LuaTgx beta 0 80 0 or later luaotfload v2 5 or later adobemapping Adobe cmap and pdfmapping files everysel if you want to use Lua TEX ja with BIFX 2 fontspec v2 4 IPAex fonts http ipafont ipa go jp In summary this version of LuaT X ja no longer supports TEX Live 2014 or older version Now LuaTpx ja is availabl
35. ascriptfont jascriptscriptfont jacharrange e ltjgetparameter chartorange chr_code returns the range number which chr_code be longs to although there is no parameter named chartorange If chr_code is between 0 and 127 this chr_code does not belong to any character range In this case ltjgetparameter chartorange chr_code returns 1 Hence one can know whether chr_code is JAchar or not by the following 1tjgetparameter jacharrange ltjgetparameter chartorange chr_code 0 if JAchar 1 if ALchar e Because the returned value is string the following conditionals do not work if kanjiskip or xkanjiskip has the stretch part or the shrink part ifdim 1tjgetparameter kanjiskip gt z fi ifdim 1tjgetparameter xkanjiskip gt z fi The correct way is using a temporary register tempskipa lt jgetparameter kanjiskip ifdim tempskipa gt z fi tempskipa 1t jgetparameter xkanjiskip ifdim tempskipa gt z fi 9 Other Commands for plain TEX and BIEX 2 9 1 Commands for compatibility with pIpx The following commands are implemented for compatibility with pIfX Note that the former five com mands don t support JIS X 0213 but only JIS X 0208 The last kansuji converts an integer into its Chinese numerals kuten jis euc sjis jis kansuji These six commands takes an internal integer and returns a string newcount hoge hoge 2423 9251 JL the hoge
36. ation ISO 32000 1 2008 Document management Portable document format Part 1 PDF 1 7 2008 http www iso org iso iso_catalogue catalogue_tc catalogue_detail htm csnumber 51502 52
37. ch specifies the direction as follows begin tabular lt dir gt pos table spec end tabular beginfarray lt dir gt pos table spec end array begin minipage lt dir gt pos width end minipage This option permits one of the following five values If none of them is specified the direction inside the environment is same as that outside the enviromnent y yoko direction horizontal writing t tate direction vertical writing z utod direction if direction outside the env is tate d dtou direction u utod direction parbox lt dir gt pos width contents parbox command is also extended by lt dir gt pbox lt dir gt width L pos contents This commands typeset contents in LR mode in dir direction If width is positive the width of the box becomes this width In this case contents will be aligned picture environment rensujil pos contents rensujiskip Kanjit counter_name kasen contents bou contents boutenchar Part III Implementations 12 Storing Parameters 12 1 Used dimensions attributes and whatsit nodes Here the following is the list of dimensions and attributes which are used in LuaTgx ja ay jQ dimension jQ is equal to 1 Q 0 25 mm where Q also called is a unit used in Japanese phototypesetting So one should not change the value of this dimension 6 LE 99 jH dimension There is also a unit called
38. collects __________outputs__________ collects Other outputs collects _____outputs______ collects Prev Kanji outputs collects Open collects Close outputs collects In the above table e outputs means to output the collected character string i e line breaking is permitted there e collects means to append the next character to the collected character string i e line breaking is prohibited there Characters above or equal to U 0080 except Variation Selectors are classified into above 5 classes by the following rules e ALchars above or equal to U 0080 are classified as Letter JAchars are classified in the order as follows 1 Characters whose prebreakpenalty is greater than or equal to 0 are classified as Open 2 Characters whose postbreakpenalty is greater than or equal to 0 are classified as Close 3 Characters that don t satisfy the above two conditions are classified as Kanji The width of halfwidth kana U FF61 U FF9F is same as the width of ALchar the width of the other JAchars is double the width of ALchar This classification process is executed every time a character appears in the 1stlisting environment or other environments commands 49 Table 12 cid key and corresponding files cid key name of the cache used CMaps Adobe Japani 1tj cid auto adobe japan1 lua UniJIS2004 UTF32 Adobe Japani UCS2 Adobe Koreai 1tj cid auto adobe koreal lua UniKS UTF32 x Adobe Koreai UCS2 Adobe GB1 1
39. dimension which stores fullwidth of the current Japanese font This zw can be used as the unit zw in pIpX The value of these parameter can be get by lt jgetparameter Note that the result by 1tj getparameter is not the internal quantities but a string hence Nthe cannot be prefixed kanjiskip ltjgetparameter kanjiskip kanjiskip 0 0pt plus 0 4pt minus 0 4pt xkanjiskip ltjgetparameter xkanjiskip xkanjiskip 2 40555pt plus 1 0pt minus 1 0pt m It may occur that JFM contains the data of ideal width of kanjiskip and or ideal width of xkanjiskip To use these data from JFM set the value of kanjiskip or xkanjiskip to maxdimen these ideal width cannot be retrived by ltjgetparameter 4 3 Insertion setting of xkanjiskip It is not desirable that xkanjiskip is inserted into every boundary between JAchars and ALchars For exam ple xkanjiskip should not be inserted after opening parenthesis e g compare 5 and 4 Lua TEX ja can control whether xkanjiskip can be inserted before after a character by changing jaxspmode for JAchars and alxspmode parameters ALchars respectively 1 ltjsetparameter jaxspmode 5 preonly alxspmode postonly p Hq Wt 2 pq LID 16 w The second argument preonly means that the insertion of xkanjiskip is allowed before this character but not after the other possible values are postonly allow and inhibit jaxspmode and alxspmode use a same table to stor
40. dtou direction utod direction Commands Xyoko tate dtou utod Beginning of the page Top Right Left Right Beginning of the line Left Top Bottom Top Used Japanese font horizontal jfont vertical tfont horizontal 90 rotated l Example A Notation used in Q TLT RTR RTT LBL RTR AN Z 2135487 yoko hbox tate tate hbox it tate 0 HA fa KEH hbox yoko ANDANA yoko is ETAT S TeMBAEICER DY yoko A CeO Ear D N Z Z aH E RCRD Table 7 shows how a box is arranged when the direction inside the box and that outside the box differ W vd and direction In pIFX wd ht dp means the dimensions of a box register with respact to the current direction This means that the value of wd0 etc might differ when the current direction is different even if box0 stores the same box However this no longer applies in Lua TpX ja setbox0 hbox to 20pt foo the wd0 hbox tate vrule the wd0 wd0 100pt the wd0 hbox tate the wd0 1d0 001T 100 0pt To access box dimensions with respect to current direction one have to use the following commands instead of wd wtc ltjgetwd num ltjgetht num ltjgetdp num These commands return an internal dimension of Nbox num with respect to the current direction One can use these in dimexpr primitive as the followings dimexpr 2 ltjgetwd42 3pt relax the ltjgetwd1701 The following is an example 1 parindentOpt 2 setbox32767 hbox
41. e from CTAN in the macros luatex generic luatexja directory and the following distributions MiKTEX in luatexja tar 1zma see the next subsection TeX Live in texmf dist tex luatex luatexja W32T X in luatexja tar xz IPAex fonts are also available in these distributions MManual installation 1 Download the source by one of the following method At the present LuaT X ja has no stable release e Clone the Git repository git clone git git osdn jp gitroot luatex ja luatexja git e Download the tar gz archive of HEAD in the master branch from http git osdn jp view p luatex ja luatexja git a snapshot h HEAD sf tgz Note that the master branch and hence the archive in CTAN are not updated frequently the forefront of development is not the master branch Extract the archive You will see src and several other sub directories But only the contents in src are needed to work Lua TpX ja If you downloaded this package from CTAN you have to run following commands to generate classes and 1tj kinsoku lua the file which stores default kinsoku parameters cd src lualatex ltjclasses ins lualatex ltjsclasses ins lualatex 1tjltxdoc ins luatex 1tj kinsoku_make tex Do not forget The last line processing lt 7 kinsoku_make tex dtx ins and1tj kinsoku_make tex used here are not needed in regular use Copy all the contents of src into one of your TEXMF tree TEXMF tex luatex luatexj
42. e is set to 14 comment by LuaT X ja is appended to an input line before Lua T X actually process it if and only if the following three conditions are satisfied 1 The category code of endlinechar is 5 end of line 2 The category code of U FFFFF itself is 14 comment 3 The input line matches the following regular expression any char JAchar catcode 1 U catcode 2 MRemark The following example shows the major difference from the behavior of pTpX 1 fontspec Ligatures TeX Linux Libertine 0 2 ltjsetparameter autoxspacing false 3 ltjsetparameter jacharrange 6 x xyz u 4 y ltjsetparameter jacharrange 6 zL su It is not strange that 45 does not printed in the above output This is because TEX Gyre Termes does not contain 25 and because 25 in line 3 is considered as an ALchar e Note that there is no space before y in the output but there is a space before u This follows from following reasons e When line 3 is processed by process_input buffer callback 25 is considered as an JAchar Since line 3 ends with an JAchar the comment character U FFFFF is appended to this line and hence the linebreak immediately after this line is ignored e When line 4 is processed by process_input_buffer callback Vv is considered as an ALchar Since line 4 ends with an ALchar the linebreak immediately after this line emits a space Usually it is return
43. e specified by JFM e Since the align fieldis middle the real glyph is cen tered horizontally the green rectangle first fe e Furthermore the glyph is shifted according to values of fields Left and down The ultimate position of the real glyph is indicated by the red rectangle Figure 3 The position of the real glyph horizontal Japanese fonts E ight Figure 4 The position of the real glyph vertical Japanese fonts left length down length align align These fields are for adjusting the position of the real glyph Legal values of align field are left middle and right If one of these 3 fields are omitted left and down are treated as 0 and align field is treated as left The effects of these 3 fields are indicated in Figures 3 and 4 In most cases left and down fields are 0 while it is not uncommon that the align field is middle or right For example setting the align field to right is practically needed when the current character class is the class for opening delimiters kern j kern j kern ratio ratio glue j width stretch shrink ratio ratio Specifies the amount of kern or glue which will be inserted between characters in character class i and those in character class j ratio specifies how much the glue is originated in the right character It is a real number between 0 and 1 and treated as 0 5 if omitted For
44. e the parameters on the current version Therefore line 1 in the code above can be rewritten as follows lt jsetparameter alxspmode 4 preonly jaxspmode postonly One can use also numbers to specify these two parameters see Subsection 8 1 If you want to enable disable all insertions of kanjiskip and xkanjiskip set autospacing and autoxspacing parameters to true false respectively 4 4 Shifting the baseline To make a match between a Japanese font and an alphabetic font sometimes shifting of the baseline of one of the pair is needed In pIgx this is achieved by setting ybaselineshift or tbaselineshift toa non zero length the baseline of ALchar is shifted below However for documents whose main language is not Japanese it is good to shift the baseline of Japanese fonts but not that of alphabetic fonts Because of this LuaTpX ja can independently set the shifting amount of the baseline of alphabetic fonts and that of Japanese fonts Horizontal writing yoko direction etc Vertical writing tate direction Alphabetic fonts yalbaselineshift parameter talbaselineshift parameter Japanese fonts yjabaselineshift parameter tjabaselineshift parameter Here the horizontal line in the below example is the baseline of a line vrule width 150pt height 0 2pt depth 0 2pt hskip 120pt Mtjsetparametertyjabaselineshift 0pt abc HLS abe yalbaselineshift 0pt abcL 3 D ltjsetparameter yjabaselineshift 5pt yalbaselineshift
45. e the same font This option is enabled by default deluxe Use mincho with two weights medium and bold gothic with three weights medium bold and heavy and rounded gothic The heavy weight of gothic can be used by changing the family gtebf amily or textgteb This is because the fontspec package can handle only medium mdseries and bold bf series expert Use horizontal vertical kana alternates and define a command rubyfamily to use kana characters designed for ruby bold Substitute bold series of gothic for bold series of mincho 90jis Use 90JIS glyph variants if possible jis2004 Use JIS2004 glyph variants if possible jis Use the JFM jfm jis lua instead of jfm ujis lua which is the default JFM of LuaTpX ja Note that 90jis and jis2004 only affect with mincho gothic and possibly rounded gothic defined by this package We didn t taken account of when both 90jis and jis2004 are specified MPresets for multi weight Besides morisawa pro and morisawa pr6n presets fonts are specified by font name not by file name In following tables starred fonts e g KozGo Regular are used for medium series of gothic if and only if de Luze option is specified kozuka pro Kozuka Pro Adobe Japan1 4 fonts kozuka pr6 Kozuka Pr Adobe Japan1 6 fonts kozuka pr6n Kozuka Pr6N Adobe Japan1 6 JIS04 savvy fonts Kozuka Pro Pr N fonts are bundled with Adobe s software such as Adobe InDesign There is not round
46. ed gothic family in Kozuka fonts family series kozuka pro kozuka pr6 kozuka pr6n lia medium KozMinPro Regular KozMinProVI Regular KozMinPr6N Regular bold KozMinPro Bold KozMinProVI Bold KozMinPr6N Bold KozGoPro Regular KozGoProVI Regular KozGoPr6N Regular medisin KozGoPro Medium KozGoProVI Medium KozGoPr6N Medium othic j bold KozGoPro Bold KozGoProVI Bold KozGoPr6N Bold heavy KozGoPro Heavy KozGoProVI Heavy KozGoPr6N Heavy rounded gothic KozGoPro Heavy KozGoProVI Heavy KozGoPr6N Heavy hiragino pro Hiragino Pro Adobe Japan1 5 fonts hiragino pron Hiragino ProN Adobe Japan1 5 JIS04 savvy fonts Hiragino fonts are bundled with Mac OS X 10 5 or later Some editions of a Japanese word processor KBB 2012 includes Hiragino ProN fonts Note that the heavy weight of gothic family only sup ports Adobe Japan1 3 character collection Std StdN 5Provided by mgfamily and textmg because rounded gothic is called maru gothic LV 9 in Japanese 11 family series hiragino pro hiragino pron F medium Hiragino Mincho Pro W3 Hiragino Mincho ProN W3 mincho ME i nomen bold Hiragino Mincho Pro W6 Hiragino Mincho ProN W6 medinm Hiragino Kaku Gothic Pro W3 Hiragino Kaku Gothic ProN W3 Hiragino Kaku Gothic Pro W6 Hiragino Kaku Gothic ProN W6 othic e bold Hiragino Kaku Gothic Pro W6 Hiragino Kaku Gothic ProN W6 heavy Hiragino Kaku Gothic Std W8 Hiragino Kaku Gothic StdN W8 rounded gothic Hiragino Mar
47. el is level 12 4 Extending Parameters Keys for ltjsetparameter and ltjgetparameter can be extended as in luatexja adjust MSetting parameters Figure 9 shows the most outer definition of two commands ltjsetparameter and ltjglobalsetparameter Most important part is the last setkeys which is offered by the xkeyval package Hence to add a key in lt jsetparameter one only have to add a key whose prefix is 1t j and whose family is japaram as the following define key 1tj japaram ltjsetparameter and ltjglobalsetparameter automatically sets luatexja isglobal Its mean ing is the following globa1 global 1 luatexja isglobal local 45 N w This is determined not only by command name M1tjsetparameter orYltjglobalsetparameter but also by the value of globaldefs MGetting parameters Mltjgetparameter is implemented by a Lua script For parameters that do not need additional arguments one only have to define a function in the table luatexja unary_pars For example with the following function 1tjgetparameter hoge returns a string 42 function luatexja unary_pars hoge t return 42 end Here the argument of luatexja unary_pars hoge is the stack level of LuaTgX ja s stack system see Subsection 12 2 On the other hand for parameters that need an additional argument this must be an integer one have to define a function in luatexja binary_pars first For example function luate
48. enalty can be inserted before the character is controlled by the lowermost bit of the kcatcode parameter Linebreak after a JAchar does not produce a space Default setting of catcode of Unicode characters are located in plain Lua TFX luatex unicode letters tex which is based on unicode letters tex for XHIpX LuaKTf X now included in MIFX kernel as unicode letters def However the default setting of catcode differs between X IFX and LuaT X by the following reasons e plain format luatex unicode letters tex is based on old unicode letters tex e The latter half of unicode letters tex and unicode letters def sets catcode of several characters to 11 via setting KeTeXcharclass However this latter half does not exist plain case or not executed BIFX case in Lua TEX In other words plain LuaT X Kanji nor kana characters cannot be used in a control word in the default setting of plain LuaT X LuaKTFX In recent 2015 10 01 or later LualXTFX Kanji and kana characters in a control word is sup ported these catcode are 11 but not fullwidth alphanumerics and several other characters This would be inconvenient for pIEX users to shifting to Lua T X ja since several control words contain ing Kanji or other fullwidth characters such as A or 1 FEAE are used in pIfX Hence Lua T X ja have a counterpart of unicode letters tex for LuaTpX to match the catcode setting with that of XIX SupT X divides U FF
49. example The width of a glue between an ideographic full stop s and a fullwidth middle dot is three fourth of fullwidth namely halfwidth from the ideographic full stop and quarter width from the fullwidth middle dot In this case we specify ratio to 0 25 0 5 0 25 1 3 In case of glue one can specify following additional keys in each j subtable 27 priority priority An integer in 2 2 treated as 0 if omitted and this is used only in line adjustment with priority by luatexja adjust see Subsection 11 3 Higher value means the glue is easy to stretch and is also easy to shrink kanjiskip_natural num kanjiskip_stretch num kanjiskip_shrink num These keys specifies the amount of the natural width of kanjiskip the stretch shrink part re spectively which will be inserted in addition to the original JFM glue Default values of them are all 0 As an example in jfm ujis 1ua the standard JFM in horizontal writing we have Between an ordinal letter 25 and an ideographic opening bracket we have a glue whose natural part and shrink part are both half width while its stretch part is zero However this glue also can be stretched as much as the stretch part of kanjiskip times the value of kanjiskip_stretch key 1 in this case e Between an ideographic closeing brackets the ideographic comma is included and an ordinal letter we have the same glue Again this glue also can be st
50. example the line 5 in below example is eqivalent to lines 1 3 usepackage no math fontspec usepackage match luatexja fontspec usepackage kozuka pr6n luatexja preset usepackage no math match kozuka pr6n luatexja preset General options fontspec With this option Japanese fonts are selected using functionality of the luatexja fontspec package This means that the fontspec package is automatically loaded by this package This option is enabled by default If you need to pass some options to fontspec you can load fontspec manually before luatexja preset usepackage no math fontspec usepackage luatexja preset nfssonly With this option selecting Japanese fonts won t be performed using the functionality of the fontspec package but only standard NFSS2 hence without addjfontfeatures etc This option is ignored when luatexja fontspec package is loaded When this option is specified fontspec and luatexja fontspec are not loaded by default Nevertheless the packagefontspec can coexist with the option as the following tif nfssonly option is not specified in this case these options are simply ignored 10 usepackage fontspec usepackage hiragino pron nfssonly luatexja preset In this case one can use setmainfont etc to select alphabetic fonts nodeluxe Use one weighted mincho and gothic font families This means that mcfamily bfseries gtfamily bfseries and gtfamily mdseries us
51. f a node One of the following value is assigned to this attribute italic 1 Kerns from italic correction or from kerning information of a Japanese font These kerns are ignored in the insertion process of JAglue unlike explicit kern packed 2 kinsoku 3 Penalties inserted for the word wrapping process kinsoku shori of Japanese char acters from_jfm 2 from_jfm 2 4 8 Glues kerns from JFM kanji_skip 9 kanji_skip_jfm 10 Glues from kanjiskip xkanji_skip 11 xkanji_skip_jfm 12 Glues from xkanjiskip processed 13 Nodes which is already processed by ic_processed 14 Glues from an italic correction but already processed in the insertion process of JAglues boxbdd 15 Glues kerns that inserted just the beginning or the ending of an hbox or a para graph 1tj kcati attribute Where i is a natural number which is less than 7 These 7 attributes store bit vectors indicating which character block is regarded as a block of JAchars 1tj dir attribute dir_node_auto 128 dir_node_manual 256 Furthermore LuaTgxX ja uses several user defined whatsit nodes for internal processing All those nodes except direction whatsits store a natural number hence its type is 100 direction whatsits store anode list hence its type is 110 Their user_id used for distinguish user defined whatsits are allocated by luatexbase newuserwhatsitid inhibitglue Nodes for indicating that inhibitglue is specified
52. for single weight Next we describe settings for using only single weight noembed ipa ipaex ms mincho Ryumin Light non embedded IPA Mincho IPAex Mincho MS Mincho gothic GothicBBB Medium non embedded IPA Gothic IPAex Gothic MS Gothic 12 Y u a a Rh v MUsing HG fonts We can use HG fonts bundled with Microsoft Office for realizing multiple weights ipa hg ipaex hg ms hg mincho medium IPA Mincho IPAex Mincho MS Mincho mincho bold HG Mincho E Gothic medium without deluxe IPA Gothic IPAex Gothic MS Gothic with jis2004 IPA Gothic IPAex Gothic MS Gothic otherwise HG Gothic M gothic bold HG Gothic E gothic heavy HG Soei Kaku Gothic UB rounded gothic HG Maru Gothic PRO Note that HG Mincho E HG Gothic E HG Soei Kaku Gothic UB and HG Maru Gothic PRO are inter nally specified by default by font name HGMinchoE etc 90jis by file name hgrme ttc hgrge ttc hgrsgu ttc hgrsmp ttf jis2004 by file name hgrme04 ttc hgrge04 ttc hgrsgu04 ttc hgrsmp04 ttf 3 4 CID UTF and macros in japanese otf package Under pF Tpx japanese otf package developed by Shuzaburo Saito is used for typesetting characters which is in Adobe Japan1 6 CID but not in JIS X 0208 Since this package is widely used LuaTgX ja supports some of functions in the japanese otf package as an external package luatexja otf jfontspec KozMinPr6N Regular otf R UTF 9DD7 5 amp AH UTF 9592 amp D UTF 9AD9
53. h parbdd The beginning of an indented paragraph jcharbdd A boundary between JAchar and anything else such as ALchar kern glue 1 The left right boundary of an inline math formula MPorting JFM from plIgxX See Japanese version of this manual 7 5 Math font family TEX handles fonts in math formulas by 16 font families and each family has three fonts textfont scriptfont and scriptscriptfont LuaTgx ja s handling of Japanese fonts in math formulas is similar Table 11 shows counterparts to TEX s primitives for math font families There is no relation between the value of fam and that of jfam with appropriate settings you can set both fam and jfam to the same value Here jfont_cs in the argument of jatextfont etc is a control sequence which is defined by jfont i e a horizontal Japanese font 7 6 Callbacks LuaTpx ja also has several callbacks These callbacks can be accessed via luatexbase add_to_callback function and so on as other callbacks luatexja load_jfm callback With this callback you can overwrite JFMs This callback is called when a new JFM is loaded Omega Aleph LuaT X and e u pIEX can handles 256 families but an external package is needed to support this in plain TeX and BIFX 29 function lt table gt jfm_info lt string gt jfm_name 2 return lt table gt new_jfm_info 3 end The argument jfm_info contains a table similar to the table in a JFM file except
54. he family family has been defined under it family is recognized as an alphabetic font family and to memorize this family is appended to the list Fy Now LuaTpx ja looks whether there exists an alphabetic font encoding enc such that a font defi nition named enc family fd the file name is all lowercase exists If so current alphabetic font family will be changed to family the font definition file won t be loaded here If not current alphabetic font family won t be changed and family is appended to the list Na 37 BHO T Ab jfontspec it YokoFeatures Color 007F00 TateFeatures Color 00007F a TateFont KozGoPr6N Regular D KozMinPr6N Regular A hbox yoko BOT A b hbox tate MOT A b F addjfontfeatures Color FF0000 RAH hbox yoko 8 hbox tate thi de al Figure 6 An example of TateFeatures etc Also each call of DeclareFontFamily after loading of LuaTFX ja makes the second argument fam ily is appended to the list Fy The above order is very similar to fontfamily in pBTFX 2 but more complicated clause 3 This is because pXT X 2 is a format however LuaT X ja is not hence LuaT X ja does not know calls of DeclareFontFamily before itself is loaded MRemarks Of course there is a case that family is not recognized as a Japanese font family nor an alphabetic font family In this case LuaTgX ja treats the argument family is wrong so set both current alphabetic and Japane
55. he input processor of LuaT X is the same as that of TeX and they can t be customized by any callbacks Hence we can only use process_input_buffer and token_filter callbacks for to suppress a space by a line break which is after Japanese characters However token_filter callback cannot be used either since a character in category code 5 end of line is converted into an space token in the input processor So we can use only the process_input_buffer callback This means that suppressing a space must be done just before an input line is read Considering these situations handling of an end of line in Lua TFX ja are as follows 46 G Beginning of group usually and ending of group usually J Japanese characters 5 end of line usually J 10 space usually O other characters whose category code is in 3 4 6 7 8 11 12 13 L par emits a space or par We omitted about category codes 9 ignored 14 comment and 15 invalid from the above diagram We also ignored the input like A or F7af When a character whose category code is 0 escape character is seen by TFX the input processor scans a control sequence scan a c s These paths are not shown in the above diagram After that the state is changed to State S skipping blanks in most cases but to State M middle of line sometimes Figure 10 State transitions of pIgX s input processor A character U FFFFF its category cod
56. ic Shapes U 2600 U 26FF Miscellaneous Symbols U 2700 U 27BF Dingbats U 2900 U 297F Supplemental Arrows B U 2980 U 29FF Misc Mathematical Symbols B U 2BO0 U 2BFF Miscellaneous Symbols and Arrows Table 2 Unicode blocks in predefined character range 6 U 2460 U 24FF Enclosed Alphanumerics U 2E80 U 2EFF CJK Radicals Supplement U 3000 U 303F CJK Symbols and Punctuation U 3040 U 309F Hiragana U 30A0 U 30FF Katakana U 3190 U 319F Kanbun U 31F0 U 31FF Katakana Phonetic Extensions U 3200 U 32FF Enclosed CJK Letters and Months U 3300 U 33FF CJK Compatibility U 3400 U 4DBF CJK Unified Ideographs Extension A U 4E00 U 9FFF CJK Unified Ideographs U F900 U FAFF CJK Compatibility Ideographs U FE10 U FE1F Vertical Forms U FE30 U FE4F CJK Compatibility Forms U FE50 U FE6F Small Form Variants U 20000 U 2FFFF Supplementary Ideographic Plane U E0100 U E01EF Variation Selectors Supplement e U 0080 U 00FF Latin 1 Supplement e U 0100 U 017F Latin Extended A U 0300 U 036F e U 0180 U 024F Latin Extended B Combining Diacritical Marks e U 0250 U 02AF IPA Extensions e U 1EOO U 1EFF e U 02B0 U 02FF Spacing Modifier Letters Latin Extended Additional Range 2 Greek and Cyrillic letters JIS X 0208 hence most of Japanese fonts has some of these charac ters e U 0370 U 03FF Greek and Coptic e U 1FOO U 1FFF Greek Extended e U 0400 U 04FF Cyrillic Range 3 Punctuations and Miscellaneous symbols The block list is indicated in Table 1 Range 4
57. ical writing A demonstrarion is shown in Figure 6 YokoFeatures features The YokoFeatures key specifies font features which are only turned on in horizontal writing A demonstrarion is shown in Figure 6 38 x wo jfontspec AltFont Range 4E00 67FF Color 007F00 Range 6800 9EFF Color 0000FF Range 3040 306F Font KozGoPr6N Regular KozMinPr6N Regular EJER IESICRSENKHARICHI CORRE SIC THML DNEEDNSOFRORAI MmERCOMMCKSMRE PABLO TARO DERRAMAR oo HJER ERIC EN REA INIAARARAU CAT DNEEDNEDFROKYD lc MARE OMAICKSERRE DAHeHICDKO CANOES TRIN eHERLY eos Figure 7 An example of AltFont AltFont As ltjdeclarealtfont Subsection 9 3 and DeclareAlternateKanjiFont Subsection 10 1 with this key one can typeset some Japanese characters by a different font and or using different features The AltFont feature takes a comma separated list of comma separated lists as the follow ing AltFont Range range features Range range Font fontname features Range range Font fontname Each sublist should have the Range key sublist which does not contain Range key is simply ignored A demonstrarion is shown in Figure 7 WM Remark on AltFont YokoFeatures TateFeatures keys In AltFont YokoFeatures TateFeatures keys one cannot specify per shape settings such as BoldFeatures For example AltFont Font HogeraMin Light BoldFont HogeraMin Bold Range 300
58. imen0 1t j getparameter talbaselineshift 1tjsetparameter prebreakpenalty 100 ifnum ltjgetparemeter direction 4 fi Note that pIfX adds new two useful units namely zw and zh As shown above they are changed by zw and zh respectively in Lua TFX ja MLinebreak after a Japanese character In pIpX a line break after Japanese character is ignored and doesn t yield a space since line breaks in source files are permitted almost everywhere in Japanese texts However Lua TFX ja doesn t have this feature completely because of a specification of LuaT X For the detail see Section 13 MSpaces related to Japanese characters The insertion process of glues kerns between two Japanese characters and between a Japanese character and other characters we refer glues kerns of both kinds as JAglue is rewritten from scratch e As LuaTpX s internal ligature handling is node based e g of fice doesn t prevent ligatures the insertion process of JAglue is now node based Furthermore nodes between two characters which have no effects in line break e g special node and kerns from italic correction are ignored in the insertion process e Caution due to above two points many methods which did for the dividing the process of the insertion of JAglue in plex are not effective anymore In concrete terms the following two methods are not effective anymore Bebo BiWod If you want to do so please put an empty horizontal b
59. l let begindvi empty Now LuaTpX ja automatically applies the patch IItjp geometry to the geometry package when the direction of the document is tate vertical writing This patch Iltjp geometry also can be used in p Tpx for the detail please refer 11tjp geometry pdf Japanese 3 Changing Fonts 3 1 plain TeX and BIFX 2 Mplain TeX To change Japanese fonts in plain TEX you must use the command jfont and tfont So please see Subsection 7 1 METEX 2 NFSS2 For BIFX 2 LuaTgX ja adopted most of the font selection system of pX4TFX 2 in plfonts dtx e Commands fontfamily fontseries and fontshape can be used to change attributes of Japanese fonts encoding family series shape selection alphabetic fonts romanencoding romanfamily romanseries romanshape useroman Japanese fonts kanjiencoding kanjifamily kanjiseries kanjishape usekanji both fontseries fontshape auto select fontencoding fontfamily usefont Itjarticle cls ltjbook cls ltjreport cls ltjtarticle cls ltjtbook cls ltjtreport cls The latter 1tjt cls are for vertically writtened Japanese documents 3ltjsarticle cls 1tjsbook cl1s 1tjskiyou cls w Y w A a fontencoding encoding changes the encoding of alphabetic fonts or Japanese fonts depending on the argument For example fontencoding JY3 changes the encoding of Japanese fonts to JY3 and fontencoding T1 changes the encoding of alphabetic font
60. low Insertion of xkanjiskip is allowed both before the character and after the character This is the default value This parameter is similar to the inhibitxspcode primitive of pIgx but not compatible with inhibitxspcode alxspmode chr_code mode xspcode Set whether inserting xkanjiskip is allowed before after a ALchar whose character code is chr_code The followings are allowed for mode 0 inhibit Insertion of xkanjiskip is inhibited before the character nor after the character 1 preonly Insertion of xkanjiskip is allowed before the character but not after 2 postonly Insertion of xkanjiskip is allowed after the character but not before 3 allow Insertion of xkanjiskip is allowed before the character and after the character This is the default value Note that parameters jaxspmode and alxspmode share a common table hence these two parameters are synonyms of each other autospacing bool autospacing autoxspacing bool autoxspacing 32 e wv Boe kanjiskip skip anjiskip The default glue which inserted between two JAchars Changing current Japanese font does not alter this parameter as pIEX If the natural width of this parameter is maxdimen LuaTgxX ja uses the value which is specified in the JFM for current Japanese font See Subsection 7 4 xkanjiskip skip xkanjiskip The default glue which inserted between a JAchar and an ALchar Changing current font does not alter this
61. ly will be changed is deter mined in following order This order is very similar to fontfamily in pXTFX 2 but we re implemented in Lua We use an auxiliary list N 1 If the family family has been defined already by DeclareKanjiFamily family is recognized as a Japanese font family Note that family need not be defined under current Japanese font encoding If the family family has been listed in a list Ny this means that family is not a Japanese font family If the luatexja fontspec package is loaded we stop here and family is not recognized as a Japanese font family If the luatexja fontspec package is not loaded now LuaTFX ja looks whether there exists a Japanese font encoding enc such that a font definition named enc family fd the file name is all lower case exists If so family is recognized as a Japanese font family the font definition file won t be loaded here If not family is not a Japanese font family and family is appended to the list Ny Recognition as alphabetic font family Next whether alphabetic font family will be changed is determined in following order We use auxiliary lists F and Na 1 2 If the family family has been listed in a list Fy family is recognized as an alphabetic font family If the family family has been listed in a list N this means that family is not an alphabetic font family If there exists an alphabetic font encoding such that t
62. nction calls in this callback hence this argument may not be 0 Moreover the returned new_char_class should be as same as char_class when char_class is not 0 otherwise you will overwrite the Lua T X ja s default routine luatexja set_width callback This callback is called when LuaTpx ja is trying to encapsule a JAchar glyph_node to adjust its dimension and position function lt table gt shift_info lt table gt jfont_info lt table gt char_type 2 return lt table gt new_shift_info 3end The argument shift_info and the returned new_shift_info have down and left fields which are the amount of shifting down left the character in a scaled point A good example is test valign lua After loading this file the vertical position of glyphs is automat ically adjusted the ratio height depth of glyphs is adjusted to be that of letters in the character class 0 For example suppose that The setting of the JFM height 88x depth 12x the standard values of Japanese Open Type fonts e The value of the real font height 28y depth 5y the standard values of Japanese TrueType fonts Then the position of glyphs is shifted up by 88x 26 ak 8y 5y 28y Ly 1 04y me a as y 8 Parameters 8 1 ltjsetparameter As described before ltjsetparameter and ltjgetparameter are commands for accessing most pa rameters of LuaTFX ja One of the main reason that LuaTFX ja didn t adopted the syntax simila
63. ndiferent directo i sacos is li cn and LE eS ead bee ca a i 62 Getting currentdirection lt 6 46 66 pb beh eRe Re BER EEE CaS Cee ees G3 OEI Dox primitives occ a eee be ee Ed e Se SU et Font Metric and Japanese Font Mot AOR A ee AO ahead ae tt rt A AS E ay a Oe oe i ge Gs A he ees Bae BESTE Gee ed ae ee ES Ee bee 7 4 Structure ofa JFM file ee 76 Mathiontiamiy 26464 65654 4 5 e A e es FG ISA RES ec naii Sire a de Bw Bert Se a EA A S a 10 13 13 14 14 16 16 17 18 19 19 19 19 20 20 20 22 22 8 Parameters 31 Bi SNitjeetparameter sororis A Se ee ees 31 Be EN JESOPAT REE oa de oaar a Bok eh ae he ia orcas BER Re Bla a eai 33 9 Other Commands for plain TeX and BIEX 2 34 9 1 Commands for compatibility with PIEX o ooo e 34 98 Ainhibitglue co cena ko are k aa Pe ia d 35 93 Sitjdeclarcaltfont cuore aa e E AR E D a 35 10 Commands for BIFX 2 35 TO Patch Tor NESSA o ausor NR Ae a a 35 10 2 Detail of fontfamily command coo enn a a OG ee ee 37 11 Addon packages 38 11 1 haatex actovitepee com asus gari RR RADA ORR ORE RSA A O E A 38 1102 A 2 ito Ge ed ai BES Ed bed ee BE 39 IS Index AEUSt sc ea Ve KR ARO AE REE RE AAA RS 40 ILA REN SRE ik ee ce eek ee we Re ee ee ed ee BE a A Be a o 41 113 LITTERE LN e cee ded ok GR Oe GE Sepa Ha Gaede bee dae aed a deed 41 III Implementations 42 12 Storing Parameters 42 12 1 Used dimensions attributes and whatsit nodes
64. ng autoxspacing kanjiskip xkanjiskip differentjfm direction Note that ltjgetparameter autospacing and ltjgetparameter autoxspacing returns 1 or 0 not true nor false If first argument is one of the following an additional argument a character code for example is needed kcatcode prebreakpenalty postbreakpenalty jaxspmode alxspmode ltjgetparameter jaxspmode and ltjgetparameter alxspmode returns 0 1 2 or 3 instead of preonly etc e ltjgetparameter jacharrange range returns O if characters which belong to the char acter range range are JAchar 1 if are ALchar Although there is no character range 1 specifying 1 to range does not cause an error returns 1 33 m w A a Y w A e For an integer digit between 0 and 9 ltjgetparameter kansujichar digit returns the character code of the result of kansuji digit e ltjgetparameter adjustdir returns a integer which represents the direction of the surround ing vertical list As direction the return value 1 means down to up direction 3 means tate direction vertical typesetting and 4 means yoko direction horizontal typesetting e For an integer reg_num between 0 and 65535 lt j getparameter boxdim reg_num returns the direction of box reg_num If this box register is void the returned value is zero e The following parameter names cannot be specified in Nltjgetparameter jatextfont j
65. nge where base_font_cs and alt_font_cs are defined by jfont Its meaning is If the current Japanese font is base_font_cs characters which belong to range is typeset by another Japanese font alt_font_cs instead of base_font_cs Here range is a comma separated list of character codes but also accepts negative integers n n gt 1 means that all characters of character classes n with respect to JFM used by base_font_cs Note that characters which do not exist in alt_font_cs are ignored For example if hoge uses jfm ujis lua the standard JFM of LuaTgx ja then 1tjdeclarealtfont hoge piyo 3000 30FF 1 1 does If the current Japanese font is Nhoge U 3000 U 30FF and characters in class 1 ideographic opening brackets are typeset by piyo 10 Commands for BIEX 2 10 1 Patch for NFSS2 Japanese patch for NFSS2 in LuaT X ja is based on plfonts dtx which plays the same role in pIXTgxX 2 We will describe commands which are not described in Subsection 3 1 additonal dimensions Like pBTFX 2 LuaT X ja defines the following dimensions for information of current Japanese font cht height cdp depth cHT sum of former two cwd width cvs lineskip chs equals to cwd and its normalsize version 35 Cht height Cdp depth Cwd width Cvs equals to baselineskip Chs equals to cwd Note that cwd and cHT may differ from zw and zh respectively On the one hand
66. ould be 5 pt However by the implementation method of LuaT X this 5 pt cannot be known from any callbacks In the tex packaging w which is a file in the source of LuaTpX there are the following codes 1226 void package int c 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 scaled h height of box halfword p first node in a box scaled d max depth int grp grp Cur_group d box_max_depth unsave save_ptr 4 if cur_list mode field hmode cur_box filtered_hpack cur_list head_field cur_list tail field saved_value 1 saved_level 1 grp saved_level 2 subtype cur_box HLIST_SUBTYPE_HBOX Notice that unsave is executed before filtered_hpack where hpack_filter callback is executed here So 5 pt in the above source is orphaned at unsave and hence it can t be accessed from hpack_filter callback Mimplementation The code of stack system is based on that in a post of Dev luatex mailing lis stack level is s and the TgX s group level is just after the hbox group then tt These are two T X count registers for maintaining information Ltj stack for the stack level and 1t j group level for the TEX s group level when the last assignment was done Parameters are stored in one big table named charprop_stack_table where charprop_stack_table i stores data of stack level i If a new stack level is created by 1t jset
67. ox hbox between it instead E k hbox o amp e In the process two Japanese fonts which only differ in their real fonts are identified MDirections From version 20150420 0 Lua TEX ja supports vertical writing We implement this feature by using callbacks of LuaT X so it must not be confused with Q style direction support of LuaT X itself Due to implementation the dimension returned by wd ht or dp depends on the content of the register only This is major difference with pIpx Mdiscretionary Japanese characters in discretionary break discretionary is not supported MGreek and Cyrillic letters and ISO 8859 1 symbols By default LuaTFX ja uses Japanese fonts to typeset Greek and Cyrillic letters To change this behavior put 1t j setparameter jacharrange 2 3 in the preamble For the detailed description see Subsection 4 1 From this version characters which belongs both ISO 8859 1 and JIS X 0208 such as Y and are now typeset in alphabetic fonts This means that without the fontspec and luatexja fontspec package these characters are not typeset correctly 1 3 Notations In this document the following terms and notations are used e Characters are classified into following two types Note that the classification can be customized by a user see Subsection 4 1 JAchar standing for characters which is used in Japanese typesetting such as Hiragana Katakana Kanji and other Japanese punctuation m
68. pIgX Unicode implementation of pIgX and e pIFX merging of pIFX and e TFX extension have developed to fill those gaps to some extent but gaps still exist However the appearance of LuaTFX changed the whole situation With using Lua callbacks users can customize the internal processing of Lua TEX So there is no need to modify sources of engines to support Japanese typesetting to do this we only have to write Lua scripts for appropriate callbacks 1 2 Major changes from pIfX The LuaTgxX ja package is under much influence of pIFX engine The initial target of development was to implement features of pIfX However implementing all feature of pIFX is impossible since all process of Lua T X ja must be implemented only by Lua and TeX macros Hence Lua TpX ja is not a just porting of pIpX unnatural specifications behaviors of pIgX were not adopted The followings are major changes from pIFX For more detailed information see Part III or other sec tions of this manual MCommand names pIFX addes several primitives such as kanjiskip prebreakpenalty and ify dir They can be used as follows kanjiskip 10pt dimen0 kanjiskip tbaselineshift 0 1zw dimen0O tbaselineshift Xprebreakpenalty 4 100 ifydir fi However we cannot use them under LuaTgx ja Instead of them we have to write as the following ltjsetparameter kanjiskip 10pt dimen0O 1tjgetparameter kanjiskip l1tjsetparameter talbaselineshift 0 1 zw d
69. parameter all data of the previous level is copied To resolve the problem mentioned in above paragraph Background Lua TfX ja uses another trick When the stack level is about to be increased a whatsit node whose type subtype and value are 44 user_defined stack_marker and the current group level respectively is appended to the current list we refer this node by stack_flag This enables us to know whether assignment is done just inside a hbox Suppose that the e Ifthere is no stack_flag node in the list of the contents of the hbox then no assignment was occurred inside the hbox Hence values of parameters at the end of the hbox are stored in the stack level s 1 Dev luatex tex currentgrouplevel a post at 2008 8 19 by Jonathan Sauer 44 30 protected def 1tj setpar global 31 relax ifnum globaldefs gt 0 directlua luatexja isglobal global 382 else directlua luatexja isglobal fi 383 334 protected def 1tjsetparameter 1 35 ltj setpar global setkeys 1tj japaram 1 ignorespaces 336 protected def 1t jglobalsetparameter 1 37 relax ifnum globaldefs lt 0 directlua luatexja isglobal 388 else directlua luatexja isglobal global fi 39 setkeys 1tj japaram 1 ignorespaces Figure 9 Definiton of parameter setting commands e If there is a stack_flag node whose value is t 1 then an assignment was occurred just inside the hbox group Hence values of parameters at the end of the hbox are
70. r to that of pI X e g prebreakpenalty 10000 is the position of hpack_filter callback in the source of LuaT X see Section 12 ltjsetparameter and ltjglobalsetparameter are commands for assigning parameters These take one argument which is a key value list The difference between these two commands is the scope of assignment 1t j setparameter does a local assignment and 1tjglobalsetparameter does a global one They also obey the value of globaldefs like other assignments The following is the list of parameters which can be specified by the 1ltjsetparameter command cs indicates the counterpart in pI X and symbols beside each parameter has the following meaning values at the end of a paragraph or a hbox are adopted in the whole paragraph or the whole hbox e T assignments are always global jcharwidowpenalty penalty jcharwidowpenalty Penalty value for suppressing orphans This penalty is inserted just after the last JAchar which is not regarded as a Japanese punctuation mark kcatcode chr_code natural number An additional attributes which each character whose character code is chr_code has At the present version the lowermost bit of natural number indicates whether the character is considered as a punctuation mark see the description of jcharwidowpenalty above 31 prebreakpenalty chr_code penalty prebreakpenalty Set a penalty which is inserted a
71. re supported with psft prefix because they are only simple linear transformations Mcidkey The default font defined by using psft prefix is for Japanese typesetting it is Adobe Japan1 6 CID keyed font One can specify cid key to use other CID keyed non embedded fonts for Chinese or Korean typesetting 1 jfont testJ psft Ryumin Light cid Adobe Japan1 6 jfm jis Japanese 2 jfont testD psft Ryumin Light jfm jis default value is Adobe Japan1 6 3 jfont testC psft AdobeMingStd Light cid Adobe CNS1 6 jfm jis Traditional Chinese 4 jfont testG psft SimSun cid Adobe GB1 5 jfm jis Simplified Chinese s jfont testK psft Batang cid Adobe Korea1 2 jfm jis Korean Note that the code above specifies jfm jis lua which is for Japanese fonts as JFM for Chinese and Korean fonts At present LuaTEX ja supports only 4 values written in the sample code above Specifying other values eg jfont test psft Ryumin Light cid Adobe Japan2 jfm jis produces the following error 1 Package luatexja Error bad cid key Adobe Japan2 2 3See the luatexja package documentation for explanation Type H lt return gt for immediate help s lt to be read again gt 25 6 par 71 78 8 9 h 1w I couldn t find any non embedded font information for the CID 1 Adobe Japan2 For now I ll use Adobe Japani 6 1 Please contact the LuaTeX ja project team B 7 4 Structure of a JFM file A JFM file i
72. retched as much as the stretch part of kanjiskip times the value of kanjiskip_stretch key 1 in this case Hence we have the following result 1 leavevmode gt 2 ltjsetparameter kanjiskip Opt plus 3 zw 45 Poy Fy 3 vrule hbox to 15 zw H TU 3 AH vrule PAY o end_stretch kern end_shrink kern MCharacter to character classes We explain how the character class of a character is determined using jfm test 1lua which contains the following 0 4 chars align left left 0 0 down 0 0 width 1 0 height 0 88 depth 0 12 italic 0 0 F 2000 chars CEN Ts align left left 0 0 down 0 0 width 0 5 height 0 88 depth 0 12 italic 0 0 Now consider the following input output 1 jfont a file KozMinPr6N Regular otf jfm test hwid 2 setbox0 hbox a Ej 15 0pt 3 the wd0 Now we look why the above source outputs 15 pt 1 The character EC is converted to its half width form t by hwid feature 2 According to the JFM the character class of t is 2000 hence its width is halfwidth 3 The character class of 2 is zero hence its width is fullwidth 4 Hence the width of hbox equals to 15 pt This example shows that the character class of a character is generally determined after applying font features by luaotfload However if the class determined by the glyph after application of features is zero Lua T X ja adopts the class
73. rks Characters by CID and UTF commands are different from ordinary characters in the fol lowing points Always treated as JAchars e Processing codes for supporting OpenType features e g glyph replacement and kerning by the luaotfload package is not performed to these characters M Additional syntax ofJFM The package luatexja otf extends the syntax of JFM the entries of chars table in JFM now allows a string in the form AJ1 xxx which stands for the character whose CID number in Adobe Japanl is xxx This extended notation is used in the standard JFM jfm ujis lua to typeset halfwidth Hiragana glyphs CID 516 598 in halfwidth MIVS support Recent fonts support Ideographic Variation Selector IVS It seems that luaotfload and fontspec packages do not support IVS so we implemented IVS support in luatexja otf IVS support is exper imental if you want to enable this load luatexja otf and execute the following directlua luatexja otf enable_ivs After executing the command above you can use IVS like the following Large jfontspec KozMinPr6N Regular O al a PREV ESOT E RIAA RK ASE CAE MAA 35 0F0R 5 ORO SES ORO SES OEO RE Feet 00 8101 1v8 102 8 103 18 35 DEO SES OES 8 OEOSES OEO SES OEO MES MES E Y NENT Ne 105 48106548 107 89 108 82 109 NENA zZ A 365 OEORES OE0 E OED ES OEORES OO Jee ere E E dE 1
74. s a Lua script which has only one function call luatexja jfont define_jfm Real data are stored in the table which indicated above by So the rest of this subsection are devoted to describe the structure of this table Note that all lengths in a JFM file are floating point numbers in design size unit dir direction required The direction of JFM yoko horizontal or tate vertical are supported zw length required The amount of the length of the full width zh length required The amount of the full height height depth kanjiskip natural stretch shrink optional This field specifies the ideal amount of kanjiskip As noted in Subsection 4 2 if the parameter kanjiskip is maxdimen the value specified in this field is actually used if this field is not specified in JFM it is regarded as 0 pt Note that stretch and shrink fields are in design size unit too xkanjiskip natural stretch shrink optional Like the kanjiskip field this field specifies the ideal amount of xkanjiskip MCharacter classes Besides from above fields a JFM file have several sub tables those indices are natural numbers The table indexed by i stores information of character class i At least the character class 0 is always present so each JFM file must have a sub table whose index is 0 Each sub table its numerical index is denoted by i has the following fields chars
75. s package processes input as follows 1 Collects letters and digits which can be used for the name of identifiers 2 When reading an other outputs the collected character string with modification if needed 3 Collects others 4 When reading a letter or a digit outputs the collected character string 5 Turns back to 1 By the above process line breaks inside of an identifier are blocked A flag lst ifletter indicates whether the previous character can be used for the name of identifiers or not For Japanese characters line breaks are permitted on both sides except for brackets dashes etc Hence the patch Iltjp listings introduces a new flag lst ifkanji which indicates whether the previous char acter is a Japanese character or not For illustration we introduce following classes of characters Letter Other Kanji Open Close lst ifletter T F T F T lst ifkanji F F T T F Meaning char in an identifier other alphabet most of Japanese char opening brackets closing brackets Note that digits in the listings package can be Letter or Other according to circumstances For example let us consider the case an Open comes after a Letter Since an Open represents Japanese open brackets it is preferred to be permitted to insert line break after the Letter Therefore the collected character string is output in this case The following table summarizes 5 x 5 25 cases Next Letter Other Kanji Open Close Letter
76. s to T1 fontfamily also changes the current Japanese font family the current alphabetic font family or both For the detail see Subsection 10 1 e For defining a Japanese font family use DeclareKanjiFamily instead of DeclareFontFamily In previous version of LuaTgxX ja using DeclareFontFamily didn t cause any problem But this no longer applies the current version e Defining a Japanese font shape can be done by usual DeclareFontShape DeclareFontShape JY3 mc bx n lt gt s KozMinPr6N Bold jfm ujis kern Kozuka Mincho Pr6N Bold MRemark Japanese characters in math mode Since pIgX supports Japanese characters in math mode there are sources like the following _ 55E f_ text high temperature Saim fhigh temperature ME y x 1 72 2 quad KD T quad y gt 0 M 5 in p in mathbb N text p is a prime y x 17 2 KnT y gt 0 5ER pEN pis a prime We the project members of LuaTgxX ja think that using Japanese characters in math mode are allowed if and only if these are used as identifiers In this point of view e The lines 1 and 2 above are not correct since ym in above is used as a textual label and Ko T is used as a conjunction However the line 3 is correct since 3 is used as an identifier Hence in our opinion the above input should be corrected as f_ text B im _ text high temperature ML y x 1 72 2 quad mathrel text k g
77. se font family to family to use the default family for font substitution 11 Addon packages LuaTgx ja has several addon packages These addons are written as BIEX packages but luatexja otf and luatexja adjust can be loaded in plain LuaTgxX by input 11 1 luatexja fontspec As described in Subsection 3 2 this optional package provides the counterparts for several commands defined in the fontspec package requires fontspec v2 4 In addition to OpenType font features in the original fontspec the following font features specifications are allowed for the commands of Japanese version CID name JFM name JFM var name These 3 keys correspond to cid jfm and jfmvar keys for jfont and tfont respectively See Subsections 7 1 and 7 3 for details of cid jfm and jfmvar keys The CID key is effective only when with NoEmbed described below The same JFM cannot be used in both horizontal Japanese fonts and vertical Japanese fonts hence the JFM key will be actually used in YokoFeatures and TateFeatures keys NoEmbed By specifying this key one can use name only Japanese font which will not be embedded in the output PDF file See Subsection 7 3 Kanjiskip bool TateFeatures features TateFont font The TateFeatures key specifies font features which are only turned on in vertical writing such as Style VerticalKana vkna feature Similarly the TateFont key specifies the Japanese font which will be used only in vert
78. stored in the stack level s 1 e If there are stack_flag nodes but all of their values are more than 1 1 then an assignment was occurred in the box but it is done in more internal group Hence values of parameters at the end of the hbox are stored in the stack level s Note that to work this trick correctly assignments to 1tj stack and 1tj group level have to be local always regardless the value of globaldefs To solve this problem we use another trick the assignment directlua tex globaldefs 0 is always local 12 3 Lua functions of the stack system In this subsection we will see how a user use LuaTpX ja s stack system to store some data which obeys the grouping of TEx The following function can be used to store data into a stack luatexja stack set_stack_table index lt any gt data Any values which except nil and NaN are usable as index However a user should use only negative inte gers or strings as index since natural numbers are used by Lua TFX ja itself Also whether data is stored lo cally or globally is determined by luatexja isglobal stored globally ifand only if luatexja isglobal global Stored data can be obtained as the return value of luatexja stack get_stack_table index lt any gt default lt number gt level where level is the stack level which is usually the value of 1tj stack and default is the default value which will be returned if no values are stored in the stack table whose lev
79. t T quad y gt 0 M 5 in p in mathbb N text p is a AOA i 5ER pEN pis a prime f ioii 0 high temperature y x 1 2 koT y gt 0 We also believe that using Japanese characters as identifiers is rare hence we don t describe how to change Japanese fonts in math mode in this chapter For the method please see Subsection 7 5 3 2 luatexja fontspec package To use the functionality of the fontspec package to Japanese fonts it is needed to load the luatexja fontspec package in the preamble as follows usepackage options luatexja fontspec This luatexja fontspec package automatically loads luatexja and fontspec packages if needed In the luatexja fontspec package the following seven commands are defined as counterparts of original commands in the fontspec package Japanese fonts jfontspec setmainjfont setsansjfont setmonojfont alphabetic fonts fontspec setmainfont setsansfont setmonofont Japanese fonts newjfontfamily newjfontface defaultjfontfeatures addjfontfeatures alphabetic fonts newfontfamily newfontface defaultfontfeatures addfontfeatures 9 w e The package option of luatexja fontspec are the followings match If this option is specified usual family changing commands such as rmfamily textrm sffamily also change Japanese font family Note that setmonojfont is defined if and only if this match option is specified pass opts Obsoleted Specify options
80. the contents of the cache and its return value is whether the cache is outdated load_cache first tries to read the binary cache filename luc Lub If its contents is up to date load_cache returns the contents If the binary cache is not found or its contents is outdated load_cache tries to read the text form filename lua Hence the return value of load_cache is non nil if and only if the updated cache is found 51 References 1 2 3 4 5 6 7 9 10 Victor Eijkhout TEX by Topic A TEXnician s Reference Addison Wesley 1992 C Heinz B Moses The Listings Package Takuji Tanaka upTeX Unicode version of pTeX with CJK extensions TUG 2013 October 2013 http tug org tug2013 slides TUG2013_upTeX pdf Thor Watanabe Listings MyTeXpert http mytexpert osdn jp index php Listings W3C Japanese Layout Task Force ed Requirements for Japanese Text Layout W3C Working Group Note 2011 2012 http www w3 org TR jlreq CB minio 74 Y PEDOT http argent shinshu u ac jp otobe tex files min10 pdf XEDIRA Formatting rules HA TSE Japanese Industrial Standard JIS X 4051 for Japanese documents 1993 1995 2004 epi A HAHA BIRR TEX OH AO imtH OREO HAA texmf dist doc ptex base ptexdoc pdf Hisato Hamano Vertical Typesetting with TEX TUGBoat 11 3 346 352 1990 International Organization for Standardiz
81. the depth of descender e vertical variants The following is the structure of the that table return 10955 4 U 2ACB Subset Of Above Not Equal To 65024 983879 lt 2ACB FE00 gt vwidth 0 98 vertical width Fa 37001 U 9089 3B 0 37001 lt 9089 E0100 gt 991049 lt 9089 E0101 gt vert 995025 vertical variant chksum FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF checksum of the fontfile version 2 version of the cache 50 1tj jisx0208 luc 1lub The binary version of 1tj jisx0208 lua This is the conversion table between JIS X 0208 and Uni code which is used in Kanji code conversion commands for compatibility with pI X 15 2 Internal Cache management system of LuaT X ja is stored in luatexja base 1tj base lua There are three public functions for cache management in luatexja base where filename stands for the file name without suffix save_cache filename data Save a non nil table data into a cache filename Both the text form filename lua and its binary version are created or updated save_cache_luc filename data serialized_data Same as save_cache except that only the binary cache is updated The third argument serial ized_data is not usually given But if this is given it is treated as a string representation of data load_cache filename outdate Load the cache filename outdate is a function which takes one argument
82. the former dimensions are determined from the character 25 but on the other hand zw and zh are specified by JFM DeclareYokoKanj iEncoding encoding text settings math settings DeclareTateKanjiEncoding encoding text settings math settings In NFSS2 under LuaTgx ja distinction between alphabetic fonts and Japanese fonts are only made by their encodings For example encodings OT1 and T1 are encodings for alphabetic fonts and Japanese fonts cannot have these encodings These command define a new encoding scheme for Japanese font families DeclareKanjiEncodingDefaults text settings math settings DeclareKanjiSubstitution encoding family series shape DeclareErrorKanjiFont encoding family series shape size The above 3 commands are just the counterparts for DeclareFontEncodingDefaults and others reDeclareMathAlphabet unified cmd al cmd ja cmd DeclareRelationFont ja encoding ja family ja series ja shape al encoding al family al series al shape This command sets the accompanied alphabetic font given by the latter 4 arguments with respect to a Japanese font given by the former 4 arguments SetRelationFont This command is almost same as DeclareRelationFont except that this command does a local assignment where DeclareRelationFont does a global assignment userelfont Change current alphabetic font encoding family to the accomp
83. this argument has chars field which contains character codes whose character class is not 0 An example of this callback is the 1t jarticle class with forcefully assigning character class 0 to parbdd in the JFM jfm min lua luatexja define jfont callback This callback and the next callback form a pair and you can assign characters which do not have fixed code points in Unicode to non zero character classes This luatexja define_font callback is called just when new Japanese font is loaded 1 function lt table gt jfont_info lt number gt font_number 2 return lt table gt new_jfont_info 3end jfont_info has the following fields which may not overwritten by a user size The font size specified at jfont in scaled points 1 sp 27 pt zw zh kanjiskip xkanjiskip These are scaled value of those specified by the JFM by the font size jim The internal number of the JFM var The value of jfmvar key which is specified at jfont The default value is the empty string chars The mapping table from character codes to its character classes The specification i chars character in the JFM will be stored in this field as chars character i char_type For i char_typelil is information of characters whose class is i and has the following fields e width height depth italic down left are just scaled value of those specified by the JFM by the font size e align is a number which is determined
84. tj cid auto adobe gb1 lua UniGB UTF32 Adobe GB1 UCS2 Adobe CNS1 1tj cid auto adobe cns1 lua UniCNS UTF32 x Adobe CNS1 UCS2 15 Cache Management of LuaTpx ja LuaTgx ja creates some cache files to reduce the loading time in a similar way to the luaotfload package e Cache files are usually stored in and loaded from TEXMFVAR luatexja e In addition to caches of the text form the extension is 1ua caches of the binary precompiled form are supported We cannot share same binary cache for LuaTFX and LuaJITTgx Hence we distinguish them by their extension 1uc for LuaT X and 1ub for LuaJIT TEx In loading a cache the binary cache precedes the text form When LuaTgx ja updates a cache hoge lua its binary version is also updated 15 1 Use of cache LuaTgx ja uses the following cache 1tj cid auto adobe japan1 lua The font table of a CID keyed non embedded Japanese font This is loaded in every run It is created from three CMaps UniJIS2004 UTF32 H V and Adobe Japan1 UCS2 and this is why these two CMaps are needed in the first run of Lua T X ja Similar caches are created as Table 12 if you specified cid key in jfont to use other CID keyed non embedded fonts for Chinese or Korean as in Page 25 extra_ lua This file stores the table which stores the following e unicode variants in a font e vertical width of glyphs if it is not equal to the sum of the height of ascender and
85. ts are preloaded direction classification font name 10 pt 7 pt 5 pt yoko horizontal mincho IPAex Mincho tenmin sevenmin fivemin gothic TPAex Gothic tengt sevengt fivegt tate vertical mincho IPAex Mincho tentmin seventmin fivetmin gothic TPAex Gothic Wtentgt seventgt fivetgt With luatexja cfg one can use other fonts as default Japanese fonts Subsection 3 5 A character in an alphabetic font is generally smaller than a Japanese font in the same size So actual size specification of these Japanese fonts is in fact smaller than that of alphabetic fonts namely scaled by 0 962216 The amount of glue that are inserted between a JAchar and an ALchar the parameter xkanjiskip is set to 1 pt l pt 1 pt 0 25 0 962216 10pt ae 2 40554 pt 2 4 Using in BIEX Using in BIFX 2 is basically same To set up the minimal environment for Japanese you only have to load luatexja sty usepackage luatexja It also does minimal settings counterparts in pATpX are plfonts dtx and pldefs 1tx e Font encodings for Japanese fonts is JY3 for horizontal direction and JT3 for vertical direction e Traditionally Japanese documents use two typeface categories mincho HAKATA and gothic AY Y 94 mincho is used in the main text while gothic is used in the headings or for emphasis luni JIS2004 UTF32 H V and Adobe Japan1 UCS2 classification family name mincho HAH
86. u Gothic Pro W4 morisawa pro Morisawa Pro Adobe Japan1 4 fonts Hiragino Maru Gothic ProN W4 morisawa pr6n Morisawa Pr6N Adobe Japan1 6 JIS04 savvy fonts family series morisawa pro morisawa pr6n cts medium A OTF RyuminPro Light otf A OTF RyuminPr6N Light otf bold A OTF FutoMinA101Pro Bold otf A OTF FutoMinA101Pr6N Bold otf medium A OTF GothicBBBPro Medium otf A OTF GothicBBBPr6N Medium otf gothic bold A OTF FutoGoB101Pro Bold otf A OTF FutoGoB101Pr6N Bold otf heavy A OTF MidashiGoPro MB31 otf A OTF MidashiGoPr6N MB31 otf rounded gothic A OTF Jun101Pro Light otf A OTF ShinMGoPr6N Light otf yu win Yu fonts bundled with Windows 8 1 yu osx Yu fonts bundled with OSX Mavericks family series yu win yu osx mido medium YuMincho Regular YuMincho Medium bold YuMincho Demibold YuMincho Demibold medium YuGothic Regular YuGothic Medium YuGothic Bold YuGothic Bold gothic bold YuGothic Bold YuGothic Bold heavy YuGothic Bold YuGothic Bold rounded gothic YuGothic Bold YuGothic Bold moga mobo MogaMincho MogaGothic and MoboGothic These fonts can be downloaded from http yozvox web fc2 com family series default 90jis option jis2004 option mincho medium Moga90Mincho MogaMincho bold Moga90Mincho Bold MogaMincho Bold medum Moga90Gothic MogaGothic Moga90Gothic MogaGothic gothic bold Moga90Gothic Bold MogaGothic Bold heavy Moga90Gothic Bold MogaGothic Bold rounded gothic Mobo90Gothic MoboGothic MPresets
87. utomatically before the character chr_code to prevent a line starts from this character For example a line cannot started with one of closing brackets so LuaT EX ja sets ltjsetparameter prebreakpenalty 10000 by default pIFX has following restrictions on prebreakpenalty and postbreakpenalty but they don t exist in LuaTpx ja e Both prebreakpenalty and postbreakpenalty cannot be set for the same character e We can set prebreakpenalty and postbreakpenalty up to 256 characters postbreakpenalty chr_code penalty postbreakpenalty Set a penalty which is inserted automatically after the character chr_code to prevent a line ends with this character jatextfont jfam jfont_cs textfont in TEX jascriptfont jfam jfont_cs scriptfont in TEX jascriptscriptfont jfam jfont_cs scriptscriptfont in TEX yjabaselineshift dimen yalbaselineshift dimen ybaselineshift tjabaselineshift dimen talbaselineshift dimen tbaselineshift jaxspmode chr_code mode Set whether inserting xkanjiskip is allowed before after a JAchar whose character code is chr_code The followings are allowed for mode 0 inhibit Insertion of xkanjiskip is inhibited before the character nor after the character 1 preonly Insertion of xkanjiskip is allowed before the character but not after 2 postonly Insertion of xkanjiskip is allowed after the character but not before 3 al
88. xja binary_pars fuga c t return tostring c tostring 42 end Here the first argument t is the stack level as before The second argument c is just the second argument ofXltjgetparameter For parameters that need an additional argument one also have to execute the TEX code like 1tj decl array param fuga to indicate that the parameter fuga needs an additional argument 13 Linebreak after a Japanese Character 13 1 Reference behavior in pIfX In pIFX a line break after a Japanese character doesn t emit a space since words are not separated by spaces in Japanese writings However this feature isn t fully implemented in LuaT X ja due to the specification of callbacks in LuaT X To clarify the difference between pIFX and LuaTgx We briefly describe the handling of a line break in pI X in this subsection plgX s input processor can be described in terms of a finite state automaton as that of TEX in Section 2 5 of 1 The internal states are as follows e State N new line e State S skipping spaces e State M middle of line e State K after a Japanese character The first three states N S and M are as same as TFX s input processor State K is similar to state M and is entered after Japanese characters The diagram of state transitions are indicated in Figure 10 Note that pIFX doesn t leave state K after beginning ending of a group characters 13 2 Behavior in LuaTgx ja States in t
Download Pdf Manuals
Related Search
Related Contents
Efficient Compilation of Bit-Exact Applications for DSP563xx eID User Guide for Mac (External) (v20100318) ISRxx Serie Bedienungsanleitung Cables Direct RJEXT-10 networking cable 966KB - Dynabook User and installation guide Steam Vac Tubular 5 取扱説明書 Argoclima Bamboo Otterbox Commuter iPad Copyright © All rights reserved.
Failed to retrieve file