OSDN Git Service

\ltj@vert@ori: orientation of a character in \tate
[luatex-ja/luatexja.git] / src / ltj-setwidth.lua
index 43004f4..9f13c97 100644 (file)
@@ -58,6 +58,7 @@ local dir_tate = luatexja.dir_table.dir_tate
 local attr_ykblshift = luatexbase.attributes['ltj@ykblshift']
 local attr_tkblshift = luatexbase.attributes['ltj@tkblshift']
 local attr_icflag = luatexbase.attributes['ltj@icflag']
+local attr_vert_ori = luatexbase.attributes['ltj@vert@ori']
 
 local ltjf_font_extra_info = ltjf.font_extra_info
 
@@ -177,19 +178,18 @@ local function capsule_glyph_tate(p, met, char_data, head, dir)
    local ascent, descent = met.ascent, met.descent
    local fwidth, pwidth = char_data.width
    do
-      local pf = getfont(p)
-      local pc = getchar(p)
+      local pf, pc = getfont(p), getchar(p)
       local feir = ltjf_font_extra_info[pf]
       if feir and feir.rotation and met.vert_activated then
-        if feir.rotation[pc] then
+        if feir.rotation[pc] and (has_attr(p, attr_vert_ori) or 0)<=0 then
            return capsule_glyph_tate_rot(p, met, char_data, head, dir, 0.5*(ascent-descent))
         end
       end
       local ident = fonts.hashes.identifiers[pf]
-      pwidth = (ident.descriptions and ident.descriptions[pc] 
+      pwidth = (ident.descriptions and ident.descriptions[pc]
          and ident.descriptions[pc].vheight
          and ident.descriptions[pc].vheight / ident.units * met.size)
-        or (ident.metadata and ident.metadate.defaultvheight) or (ascent+descent)
+         or (ident.metadata and ident.metadata.defaultvheight) or (ascent+descent)
       ascent = feir.vorigin[pc] and (feir.vorigin[pc] / ident.units * met.size) or ascent
    end
    fwidth = fwidth or pwidth