OSDN Git Service

ltj_jfont.lua: forgot to set metatable
authorHironori Kitagawa <h_kitagawa2001@yahoo.co.jp>
Wed, 1 Jul 2020 07:16:18 +0000 (16:16 +0900)
committerHironori Kitagawa <h_kitagawa2001@yahoo.co.jp>
Wed, 1 Jul 2020 07:16:18 +0000 (16:16 +0900)
src/ltj-jfont.lua
src/ltj-lotf_aux.lua
src/ltj-setwidth.lua

index f5994e9..72aa008 100644 (file)
@@ -808,7 +808,7 @@ do
 end
 
 do
-   local cache_ver = 21
+   local cache_ver = 22
    local nameonly, lower = file.nameonly, string.lower
    local lfs = require"lfs"
    local file_attributes = lfs.attributes
@@ -830,7 +830,11 @@ do
          )
          -- if the cache is not found or outdated, save the cache
          if dest then
-            font_extra_basename[bname] = dest[1] or {}
+           font_extra_basename[bname] = dest[1] or {}
+           local vheight, vorigin = dest[1].vheight, dest[1].vorigin
+           local vhd, vod = vheight.default, vorigin.default
+            setmetatable(vheight, {__index = function () return vhd end } )
+            setmetatable(vorigin, {__index = function () return vod end } )
          else
             local dest = ltju.get_vmet_table(tfmdata, nil)
             dest = list_rotate_glyphs(tfmdata, dest)
index 2efafc0..80741a3 100644 (file)
@@ -102,8 +102,11 @@ local function get_vmet_table(tfmdata, dest)
        if v.vheight~=default_vheight then t_vheight[i] = v.vheight / units end
      end
    end
-   setmetatable(t_vheight, {__index = function () return default_vheight / units end } )
-   setmetatable(t_vorigin, {__index = function () return ascender / units end } )
+   local vhd, vod = default_vheight / units, ascender/units
+   t_vheight.default = vhd
+   t_vorigin.default = vod
+   setmetatable(t_vheight, {__index = function () return vhd end } )
+   setmetatable(t_vorigin, {__index = function () return vdd end } )
    dest = dest or {}
    dest.ind_to_uni = t_ind_to_uni
    dest.vorigin = t_vorigin -- designed size = 1.0
index 964d49e..9df7187 100644 (file)
@@ -194,8 +194,8 @@ local function capsule_glyph_tate(p, met, char_data, head, dir)
            return capsule_glyph_tate_rot(p, met, char_data, head, dir, 
               0.5*(get_ascender(pf)-get_descender(pf)))
         end
-      end
-      pwidth, ascender = feir.vheight[pc]*met.size, feir.vorigin[pc]*met.size
+     end
+     pwidth, ascender = feir.vheight[pc]*met.size, feir.vorigin[pc]*met.size
    end
    fwidth = fwidth or pwidth
    if pwidth>fwidth and char_data.round_threshold then