OSDN Git Service

added \ltjghostjachar
[luatex-ja/luatexja.git] / src / ltj-rmlgbm.lua
index 53f5b01..49f2018 100644 (file)
@@ -5,7 +5,7 @@ luatexja.load_module('base');      local ltjb = luatexja.base
 
 local cidfont_data = {}
 local cache_chars = {}
-local cache_ver = 10
+local cache_ver = 11
 local identifiers = fonts.hashes.identifiers
 
 local cid_reg, cid_order, cid_supp, cid_name
@@ -157,6 +157,7 @@ do
             tth[pricode], cidmo[i], pricode
                = { index = i }, pricode, pricode+1;
          end
+         ttu[i] = cidmo[i]
          ttu[cid_order .. '.' .. i] = cidmo[i]
       end
 
@@ -231,7 +232,7 @@ do
    cidf_vert_processor = {
       function (head, fnum)
          local fontdata = font_getfont(fnum)
-         if head and luatexja.jfont.font_metric_table[fnum].vert_activated then
+         if head and luatexja.jfont.font_metric_table[fnum] and luatexja.jfont.font_metric_table[fnum].vert_activated then
             local vt = fontdata.ltj_vert_table
             local nh = is_node(head) and to_direct(head) or head 
             for n in traverse_id(id_glyph, head) do
@@ -245,6 +246,9 @@ do
    }
 end
 
+local dummy_vht, dummy_vorg = {}, {}
+setmetatable(dummy_vht, {__index = function () return 1 end } )
+setmetatable(dummy_vorg, {__index = function () return 0.88 end } )
 local function cid_cache_outdated(t) return t.version~=cache_ver end
 local function read_cid_font()
    local dat = ltjb.load_cache("ltj-cid-auto-" .. string.lower(cid_name),
@@ -260,6 +264,9 @@ local function read_cid_font()
    end
    if cidfont_data[cid_name] then
       cidfont_data[cid_name].shared.processes = cidf_vert_processor
+      cidfont_data[cid_name].resources.ltj_extra
+        = { ind_to_uni = cidfont_data[cid_name].resources.unicodes,
+            vheight = dummy_vht, vorigin = dummy_vorg }
       for i,v in pairs(cidfont_data[cid_name].characters) do
          if not v.width then v.width = 655360 end
          v.height, v.depth = 576716.8, 78643.2 -- optimized for jfm-ujis.lua
@@ -291,7 +298,6 @@ local function mk_rml(name, size, id)
    local fontdata = {}
    local cachedata = {}
    local s = cidfont_data[cid_name]
-   luatexja.rmlgbm.vert_addfunc(id)
    for k, v in pairs(s) do
       fontdata[k] = v
       cachedata[k] = v
@@ -328,6 +334,7 @@ local function mk_rml(name, size, id)
       fontdata.characters = cache_chars[cid_name][size]
       cachedata.characters = cache_chars[cid_name][size]
    end
+   luatexja.rmlgbm.vert_addfunc(id, fontdata)
 
    -- other parameters
    do