summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/luatex/luatexja/ltj-plain.sty
blob: c6f976767ff09e75968ee97dc18fc0f12d41cd19 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
%
% ltj-plain.sty
%

%! これは外から読まれない
%% Avoid multiple loading.
\csname luatexjaplainLoaded\endcsname
\edef\ltj@plain@AtEnd{%
\endlinechar=\the\endlinechar
\relax}
\endlinechar=-1 %
\def\luatexjaplainLoaded{\endinput}

\ifltj@in@latex                 %<*LaTeX>
  \NeedsTeXFormat{LaTeX2e}
  \PackageWarning{ltj-plain}{Don't load this package directly; load luatexja.sty instead.}
  \ProvidesPackage{ltj-plain}[]
\fi                             %</LaTeX>

%%------------------

\endlinechar=13
%! ↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓
% LuaTeX-ja macros against plain TeX

%%%%\shipout
\newluafunction\ltj@@lua@shipout@inner
\directlua{
  local t = lua.get_functions_table()
  local getbox, setbox = tex.getbox, tex.setbox
  local shipout_lthook = luatexja.direction.shipout_lthook
  t[\the\ltj@@lua@shipout@inner]=function ()
    local a = shipout_lthook(getbox(\the\ltj@afbox))
  if a then setbox(\the\ltj@afbox, a) end
  end
}
\protected\luadef\ltj@@lua@shipout\ltj@@lua@shipout@inner
\def\ltj@shipout@{\ltj@@lua@shipout\primitive\shipout\box\ltj@afbox}%
\protected\def\ltj@shipout{\ltj@afterbox\ltj@shipout@}
\ifprimitive\shipout\let\shipout\ltj@shipout\fi
\directlua{luatexja.direction.shipout_lthook = nil}

\ifdefined\ltj@stdmcfont\else\def\ltj@stdmcfont{file:HaranoAjiMincho-Regular.otf}\fi
\ifdefined\ltj@stdgtfont\else\def\ltj@stdgtfont{file:HaranoAjiGothic-Medium.otf}\fi
\ifdefined\ltj@stdyokojfm\else\def\ltj@stdyokojfm{ujis}\fi
\ifdefined\ltj@stdtatejfm\else\def\ltj@stdtatejfm{ujisv}\fi
\newread\ltj@@cfgread
\openin\ltj@@cfgread{luatexja.cfg}%
\ifeof\ltj@@cfgread
  \@PackageInfoNoLine{ltj-plain}{Cannot find file `luatexja.cfg'}%
\else
  \closein\ltj@@cfgread
  \input luatexja.cfg
\fi
\let\ltj@@cfgread\relax\advance\count16\m@ne\relax

\jfont\tenmin=\ltj@stdmcfont:jfm=\ltj@stdyokojfm\space at 9.62216pt
\jfont\sevenmin=\ltj@stdmcfont:jfm=\ltj@stdyokojfm\space at 6.73551pt
\jfont\fivemin=\ltj@stdmcfont:jfm=\ltj@stdyokojfm\space at 4.81108pt
\jfont\tengt=\ltj@stdgtfont:jfm=\ltj@stdyokojfm\space at 9.62216pt
\jfont\sevengt=\ltj@stdgtfont:jfm=\ltj@stdyokojfm\space at 6.73551pt
\jfont\fivegt=\ltj@stdgtfont:jfm=\ltj@stdyokojfm\space at 4.81108pt

\tfont\tentmin=\ltj@stdmcfont:jfm=\ltj@stdtatejfm\space at 9.62216pt
\tfont\seventmin=\ltj@stdmcfont:jfm=\ltj@stdtatejfm\space at 6.73551pt
\tfont\fivetmin=\ltj@stdmcfont:jfm=\ltj@stdtatejfm\space at 4.81108pt
\tfont\tentgt=\ltj@stdgtfont:jfm=\ltj@stdtatejfm\space at 9.62216pt
\tfont\seventgt=\ltj@stdgtfont:jfm=\ltj@stdtatejfm\space at 6.73551pt
\tfont\fivetgt=\ltj@stdgtfont:jfm=\ltj@stdtatejfm\space at 4.81108pt

\def\mc{\tenmin\tentmin}
\def\gt{\tengt\tentgt}
\mc

\ltjsetparameter{%
  autospacing, autoxspacing, differentjfm=paverage,
  jatextfont={0, \tenmin}, jascriptfont={0, \sevenmin},
  jascriptscriptfont={0, \fivemin},
}
\setbox\z@=\hbox{M}
\jfam\z@
\ltjsetparameter{talbaselineshift=.5\ht0, tjabaselineshift=\z@}

\ltjdefcharrange{1}{"80-"36F, "1E00-"1EFF}
\ltjdefcharrange{2}{"370-"4FF, "1F00-"1FFF}
\ltjdefcharrange{3}{%
  "2070-"243F, "2500-"27BF, "2900-"29FF, "2B00-"2BFF}
\ltjdefcharrange{4}{%
   "500-"10FF, "1200-"1DFF, "2440-"245F, "27C0-"28FF, "2A00-"2AFF,
  "2C00-"2E7F, "4DC0-"4DFF, "A4D0-"A95F, "A980-"ABFF, "E000-"F8FF,
  "FB00-"FE0F, "FE20-"FE2F, "FE70-"FEFF, "10000-"1AFFF, "1B170-"1F0FF,
  "1F300-"1FFFF, "2000-"206F
} % non-Japanese
\ltjdefcharrange{5}{"D800-"DFFF, "E0000-"E00FF, "E01F0-"10FFFF}
\ltjdefcharrange{6}{%
  "2460-"24FF, "2E80-"2EFF, "3000-"30FF, "3190-"319F, "31F0-"4DBF,
  "4E00-"9FFF, "F900-"FAFF, "FE10-"FE1F, "FE30-"FE6F, "FF00-"FFEF,
  "1B000-"1B16F, "1F100-"1F2FF, "20000-"3FFFF, "E0100-"E01EF
}
\ltjdefcharrange{7}{%
  "1100-"11FF, "2F00-"2FFF, "3100-"318F, "31A0-"31EF, "A000-"A4CF,
  "A960-"A97F, "AC00-"D7FF
}
\ltjdefcharrange{8}{"A7, "A8, "B0, "B1, "B4, "B6, "D7, "F7}
\ltjdefcharrange{9}{
  "2002, "2010, "2011, "2013, "2014, "2015, "2016, "2018, "2019,
  "201A, "201C, "201D, "201E, "2020, "2021, "2022, "2025, "2026,
  "2030, "2032, "2033, "2039, "203A, "203B, "203C, "203E, "203F,
  "2042, "2044, "2047, "2048, "2049, "2051
}
\ltjsetparameter{jacharrange={-1, +2, +3, -4, -5, +6, +7, -8, +9}}

\directlua{for x=128,255 do luatexja.math.is_math_letters[x] = true end}

\directlua{luatexja.jfont.register_vert_replace{
  [',']='、', ['.']='。', ['“']=0x301D, ['”']=0x301F,
}}

%%------------------ all done
\ltj@plain@AtEnd
\endinput
%% EOF