OSDN Git Service

Added new "font feature" jpotf; replace fullwidth comma to ideographic comma etc.
authorHironori Kitagawa <h_kitagawa2001@yahoo.co.jp>
Tue, 30 Apr 2019 03:14:17 +0000 (12:14 +0900)
committerHironori Kitagawa <h_kitagawa2001@yahoo.co.jp>
Tue, 30 Apr 2019 03:14:17 +0000 (12:14 +0900)
src/ltj-jfont.lua
test/test51-vtest.pdf
test/test51-vtest.tex

index dabed15..e242b1f 100644 (file)
@@ -3,7 +3,7 @@
 --
 luatexbase.provides_module({
   name = 'luatexja.jfont',
-  date = '2019/02/11',
+  date = '2019/04/30',
   description = 'Loader for Japanese fonts',
 })
 
@@ -1092,12 +1092,18 @@ do
      [0x300A]=0xFE3D, [0x300B]=0xFE3E, [0x3008]=0xFE3F, [0x3009]=0xFE40,
      [0x300C]=0xFE41, [0x300D]=0xFE42, [0x300E]=0xFE43, [0x300F]=0xFE44,
      [0xFF3B]=0xFE47, [0xFF3D]=0xFE48, 
+     [-0xFF0C]=0xFE11, [-0xFF0E]=0xFE12,
+     [-0x201C]=0x301D, [-0x201D]=0x301F,
   }
-  local function add_vform(coverage, vform, ft, add_vert)
+  local abs = math.abs
+  local function add_vform(coverage, vform, ft, add_vert, jpotf_vert)
      if type(coverage)~='table' then return end
      for i,v in pairs(vert_form_table) do
-         if not coverage[i] and ft.characters[v] then
-             vform[i] = v
+         if i>=0 and not coverage[i] and ft.characters[v] then
+            vform[i] = v
+         end
+         if jpotf_vert and i<0 and ft.characters[v]then
+             vform[abs(i)] = coverage[v] or v
          end
      end
      if add_vert then -- vert feature が有効にならない場合
@@ -1114,11 +1120,14 @@ luatexbase.add_to_callback(
          local add_vert  
            = not (provides_feature(fnum, t.properties.script, t.properties.language, 'vert'))
              and not (provides_feature(fnum, t.properties.script, t.properties.language, 'vrt2'))
+         local jpotf_vert = t.shared.features.jpotf
          -- 現在の language, script で vert もvrt2 も有効にできない場合,強制的に vert 適用
          for _,i in pairs(t.resources.sequences) do
             if i.order[1]== 'vert' and i.type == 'gsub_single' and i.steps then
                for _,j in pairs(i.steps) do
-                  if type(j)=='table' then add_vform(j.coverage,vform, t, add_vert) end
+                  if type(j)=='table' then
+                     add_vform(j.coverage,vform, t, add_vert, jpotf_vert)
+                 end
                end
             end
           end
index ed81a96..d4c7571 100644 (file)
Binary files a/test/test51-vtest.pdf and b/test/test51-vtest.pdf differ
index 4b030a2..ad0c192 100644 (file)
 \vfill\eject
 
 \vbox{\tate\hsize100mm
-\tfont\f=KozMinPr6N-Regular.otf:jfm=ujisv \f
+\tfont\f=[KozMinPr6N-Regular.otf]:jfm=ujisv \f
 
 \ltjsetparameter{yalbaselineshift=.25em}\baselineskip15pt\parindent\zw
 \LaTeX の特徴として、テキストファイルであるソースコードを入力として処理することでDVIや
@@ -444,14 +444,14 @@ $$
 }
 
 \TEST{IPAexMincho:}
-\TEST{hgrkk.ttc:}
-\TEST{hgrkk.ttc:script=kana}
-\TEST{hgrkk.ttc:script=kana;language=jan}
-\TEST{hgrkk.ttc:script=hani}
-\TEST{KozMinPr6N-Regular.otf:}
-\TEST{KozMinPr6N-Regular.otf:script=kana}
-\TEST{KozMinPr6N-Regular.otf:script=kana;language=jan}
-\TEST{KozMinPr6N-Regular.otf:script=hani}
+\TEST{[hgrkk.ttc]:}
+\TEST{[hgrkk.ttc]:script=kana}
+\TEST{[hgrkk.ttc]:script=kana;language=jan}
+\TEST{[hgrkk.ttc]:script=hani}
+\TEST{[KozMinPr6N-Regular.otf]:}
+\TEST{[KozMinPr6N-Regular.otf]:script=kana}
+\TEST{[KozMinPr6N-Regular.otf]:script=kana;language=jan}
+\TEST{[KozMinPr6N-Regular.otf]:script=hani}
 
 \def\X#1#2#3{%
 漢字\hbox{#1◆あい#2えお◆}漢字
@@ -473,4 +473,25 @@ $$
 \vbox{\tate
 \X\yoko Y{}\par\X\tate T{\hfil\break}\par\X\dtou D{\hfil\break}\par
 \X\utod U{\hfil\break}}
+
+
+\vfill\eject
+\def\T{KozMinPr6N-Regular.otf}
+%\def\T{ipaexm.ttf}
+%\def\T{HiraMinProN-W3.otf}
+\jfont\X=[\T]:jfm=ujis;language=latn;script=latn
+\tfont\V=[\T]:jfm=ujisv;+vert;jpotf;language=latn;script=latn
+\tfont\VM=[\T]:jfm=ujisv;+vert;language=latn;script=latn
+
+\noindent
+\vbox{\yoko\X\hsize=20\zw
+  \char"301Dあ「」ああ\char"301F---“あああ,あああ.”
+}\\
+\vbox{\tate\V\hsize=20\zw
+  \char"301Dあ「」ああ\char"301F---“あああ,あああ.”
+}
+\vbox{\tate\VM\hsize=20\zw
+  \char"301Dあ「」ああ\char"301F---“あああ,あああ.”
+}
+
 \end