OSDN Git Service

Typo
[luatex-ja/luatexja.git] / src / ltj-jfont.lua
index cb63545..45bf490 100644 (file)
@@ -3,7 +3,7 @@
 --
 luatexbase.provides_module({
   name = 'luatexja.jfont',
-  date = '2014/01/02',
+  date = '2014/02/01',
   description = 'Loader for Japanese fonts',
 })
 module('luatexja.jfont', package.seeall)
@@ -158,6 +158,8 @@ do
       t.chars = metrics[j].chars
       t.char_type = mult_table(metrics[j].char_type, sz)
       for i,v in pairs(t.char_type) do
+        v.align = (v.align=='left') and 0 or 
+           ((v.align=='right') and 1 or 0.5)
         if type(i) == 'number' then -- char_type
            for k,w in pairs(v.glue) do
               local h = node_new(id_glue_spec)
@@ -178,6 +180,7 @@ mem_leak_kern = mem_leak_kern +1
               v[k] = {false, g, w[2]/sz}
            end
         end
+        v.glue, v.kern = nil, nil
       end
       t.kanjiskip = mult_table(metrics[j].kanjiskip, sz)
       t.xkanjiskip = mult_table(metrics[j].xkanjiskip,sz)
@@ -268,15 +271,14 @@ do
 end
 
 do
--- EXT: zw, zh
-   function load_zw()
+   -- PUBLIC function
+   function get_zw() 
       local a = font_metric_table[tex.attribute[attr_curjfnt]]
-      tex.setdimen('ltj@zw', a and a.zw or 0)
+      return a and a.zw or 0
    end
-   
-   function load_zh()
+   function get_zh() 
       local a = font_metric_table[tex.attribute[attr_curjfnt]]
-      tex.setdimen('ltj@zh', a and a.zh or 0)
+      return a and a.zw or 0
    end
 end
 
@@ -317,6 +319,57 @@ do
 end
 
 ------------------------------------------------------------------------
+-- LATEX INTERFACE
+------------------------------------------------------------------------
+do
+   -- these function are called from ltj-latex.sty
+   local kyenc_list, ktenc_list = {}, {}
+   function add_kyenc_list(enc) kyenc_list[enc] = 'true ' end
+   function add_ktenc_list(enc) ktenc_list[enc] = 'true ' end
+   function is_kyenc(enc)
+      tex.sprint(cat_lp, '\\let\\ifin@\\if' .. (kyenc_list[enc] or 'false '))
+   end
+   function is_kyenc(enc) 
+      tex.sprint(cat_lp, '\\let\\ifin@\\if' .. (kyenc_list[enc] or 'false '))
+   end
+   function is_kenc(enc) 
+      tex.sprint(cat_lp, '\\let\\ifin@\\if' 
+                .. (kyenc_list[enc] or ktenc_list[enc] or 'false '))
+   end
+
+   local kfam_list, Nkfam_list = {}, {}
+   function add_kfam_list(enc, fam)
+      if not kfam_list[enc] then kfam_list[enc] = {} end
+      kfam_list[enc][fam] = 'true '
+   end
+   function add_Nkfam_list(enc, fam)
+      if not Nkfam_list[enc] then Nkfam_list[enc] = {} end
+      Nkfam_list[enc][fam] = 'true '
+   end
+   function is_kfam(enc, fam)
+      tex.sprint(cat_lp, '\\let\\ifin@\\if' 
+                .. (kfam_list[enc] and kfam_list[enc][fam] or 'false ')) end
+   function is_Nkfam(enc, fam)
+      tex.sprint(cat_lp, '\\let\\ifin@\\if' 
+                .. (Nkfam_list[enc] and Nkfam_list[enc][fam] or 'false ')) end
+
+   local ffam_list, Nffam_list = {}, {}
+   function add_ffam_list(enc, fam)
+      if not ffam_list[enc] then ffam_list[enc] = {} end
+      ffam_list[enc][fam] = 'true '
+   end
+   function add_Nffam_list(enc, fam)
+      if not Nffam_list[enc] then Nffam_list[enc] = {} end
+      Nffam_list[enc][fam] = 'true '
+   end
+   function is_ffam(enc, fam)
+      tex.sprint(cat_lp, '\\let\\ifin@\\if' 
+                .. (ffam_list[enc] and ffam_list[enc][fam] or 'false ')) end
+   function is_Nffam(enc, fam)
+      tex.sprint(cat_lp, '\\let\\ifin@\\if' 
+                .. (Nffam_list[enc] and Nffam_list[enc][fam] or 'false ')) end
+end
+------------------------------------------------------------------------
 -- ALTERNATE FONTS
 ------------------------------------------------------------------------
 alt_font_table = {}
@@ -330,7 +383,7 @@ function set_alt_font(b,e,ind,bfnt)
    -- ind: 新フォント, bfnt: 基底フォント
    if b>e then b, e = e, b end
    if b*e<=0 then
-      ltjb.package_eror('luatexja',
+      ltjb.package_error('luatexja',
                        'bad character range ([' .. b .. ',' .. e .. ']). ' ..
                           'I take the intersection with [0x80, 0x10ffff].')
       b, e = math.max(0x80,b),math.min(ucs_out-1,e)
@@ -390,7 +443,7 @@ function set_alt_font_latex(b,e,ind,bbase)
    -- ind: Alt font の enc/fam/ser/shape, bbase: 基底フォントの enc/fam/ser/shape
    if b>e then b, e = e, b end
    if b*e<=0 then
-      ltjb.package_eror('luatexja',
+      ltjb.package_error('luatexja',
                        'bad character range ([' .. b .. ',' .. e .. ']). ' ..
                           'I take the intersection with [0x80, 0x10ffff].')
       b, e = math.max(0x80,b),math.min(ucs_out-1,e)