@@ -225,15 +225,46 @@ class Language:
225
225
"-D latex_elements.fontenc=" ,
226
226
)
227
227
228
+ preamble = r"""\usepackage[noto-otf]{luatexja-preset}
229
+ % 欧文はLatin Modernのまま
230
+ \usepackage{newunicodechar,luacode}
231
+ %↓入力中のU+FFFDを一旦U+F8FDに置き換える
232
+ \begin{luacode*}
233
+ luatexbase.add_to_callback('process_input_buffer', function (s)
234
+ if s ~= nil then
235
+ if s:match('\xef\xbf\xbd') then
236
+ return s:gsub('\xef\xbf\xbd', '\xef\xa3\xbd')
237
+ end
238
+ end
239
+ end, 'hedge_fffd')
240
+ \end{luacode*}
241
+ %
242
+ % - 基本的に"その字形があるフォント"を指定すればOK
243
+ % - "欧文側"のフォントで出したい場合は \ltjalchar"<符号値>
244
+ % - 特定の文字だけフォントを変えたい場合は \newunicodechar
245
+ % で文字を"命令化"して命令定義中でフォントを変える
246
+ %
247
+ %↓U+212Aの入力 → 'K'(U+004B)を出力
248
+ \newunicodechar{^^^^212a}{K}
249
+ %↓U+FFFDのグリフをもつフォントを用意する
250
+ \newfontface{\fRepC}{DejaVu Sans Mono}
251
+ %↓U+F8FDの入力 → U+FFFDを(欧文で, フォント変更して)出力
252
+ \newunicodechar{^^^^f8fd}{{\fRepC\ltjalchar"FFFD}}"""
253
+
254
+
255
+ preamble = "" .join (L for L in s .split ("\n " ) if L [0 ] != '%' )
256
+
257
+
228
258
PLATEX_DEFAULT = (
229
- "-D latex_engine=uplatex " ,
259
+ "-D latex_engine=lualatex " ,
230
260
"-D latex_elements.inputenc=" ,
231
261
"-D latex_elements.fontenc=" ,
232
- r"-D latex_elements.preamble=\\usepackage[prefernoncjk]{pxcjkcat} "
262
+ "-D latex_docclass.manual=ltjsbook" ,
263
+ "-D latex_docclass.howto=ltjsarticle" ,
264
+ '-D "latex_elements.preamble=' + preamble + '"'
233
265
)
234
266
235
267
236
-
237
268
XELATEX_WITH_FONTSPEC = (
238
269
"-D latex_engine=xelatex" ,
239
270
"-D latex_elements.inputenc=" ,
0 commit comments