OSDN Git Service

Fix #43163
authorHironori Kitagawa <h_kitagawa2001@yahoo.co.jp>
Sat, 6 Nov 2021 12:34:34 +0000 (21:34 +0900)
committerHironori Kitagawa <h_kitagawa2001@yahoo.co.jp>
Sat, 6 Nov 2021 12:34:34 +0000 (21:34 +0900)
src/ltj-jfont.lua
src/ltj-rmlgbm.lua
test/test10-otf-noembed.tex [new file with mode: 0644]

index b097809..4c19e33 100644 (file)
@@ -3,7 +3,7 @@
 --
 luatexbase.provides_module({
   name = 'luatexja.jfont',
-  date = '2021-09-18',
+  date = '2021-11-06',
   description = 'Loader for Japanese fonts',
 })
 
@@ -889,12 +889,16 @@ do
        end
    end
    
-   local function prepare_extra_data_font(id, res)
+   local function prepare_extra_data_font(id, res, name)
       if type(res)=='table' and (res.psname or res.filename) then
-         local bname = res.psname or nameonly(res.filename)
-         local t = font_extra_basename[bname]
-         if not t then bname = prepare_extra_data_base(res) end
-         font_extra_info[id] = bname and (t or font_extra_basename[bname]) or dummytable
+         if (res.embedding=='no') and (type(name)=='string') and (name:sub(1,5)=='psft:') then
+            font_extra_info[id] = res.resources.ltj_extra
+         else
+            local bname = res.psname or nameonly(res.filename)
+            local t = font_extra_basename[bname]
+            if not t then bname = prepare_extra_data_base(res) end
+            font_extra_info[id] = bname and (t or font_extra_basename[bname]) or dummytable
+         end
       end
    end
     luatexbase.add_to_callback(
@@ -907,7 +911,7 @@ do
    luatexbase.add_to_callback(
       'luatexja.define_font',
       function (res, name, size, id)
-         prepare_extra_data_font(id, res)
+         prepare_extra_data_font(id, res, name)
       end,
       'ltj.prepare_extra_data', 1)
 
index 499d3ed..3e3113c 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
 
@@ -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
diff --git a/test/test10-otf-noembed.tex b/test/test10-otf-noembed.tex
new file mode 100644 (file)
index 0000000..e09eb03
--- /dev/null
@@ -0,0 +1,92 @@
+%#! lualatex
+\documentclass{ltjsarticle}
+\usepackage{luacode}
+\usepackage{luatexja-otf,lltjext}
+\usepackage[noembed]{luatexja-preset}
+%\usepackage[hiragino-pron]{luatexja-preset}
+\begin{document}
+
+※このファイルは和文フォントを埋め込んでいません.
+
+森\UTF{9DD7}外と\UTF{5167}田百\UTF{9592}とが\UTF{9AD9}島屋に行くところを想像した。
+
+\CID{7652}飾区の\CID{13706}野屋
+
+\section*{Adobe-Japan1-5で追加された文字を使った例}
+\begin{itemize}
+  \item 「\゜か」,「\゜き」,「\゜く」,「\゜け」,「\゜こ」,
+        「\゜カ」,「\゜キ」,「\゜ク」,「\゜ケ」,「\゜コ」は鼻濁音を表す。
+  \item Macintosh用キーボードの\UTF{2318}(Command key)を押す。
+  \item \UTF{2672}を心がけよう。
+\end{itemize}
+
+\section*{Adobe-Japan1-6で追加された文字を使った例}
+\begin{itemize}
+  \item ほげほげ番組\CID{20556}
+  \item ほげほげフェスティバル\CID{20656}
+  \item \CID{20939}(Bq: becquerel)は放射能の強さを表す単位である。
+  \item フラーレン(fullerene) C$_{60}$は
+        サッカーボール状(\CID{20957})の構造をしている。
+  \item \UTF{9B87}とは岩魚(イワナ)のことであり,嘉魚とも書く。
+\end{itemize}
+
+\section*{ajmacros}
+
+\begin{enumerate}\renewcommand{\labelenumi}{\ajLabel\ajKuroKaku{enumi}}
+\item その1
+\item その2
+\item その3
+\end{enumerate}
+
+{\bf(速報)}世界陸上\CID{20660},\ajLig{ボルト}がフライングで失格.
+
+
+\ajLig{明治}\ajLig{大正}\ajLig{昭和}\ajLig{平成}\ajLig{令和}%
+\textgt{\ajLig{明治}\ajLig{大正}\ajLig{昭和}\ajLig{平成}\ajLig{令和}}
+
+\hbox{\tate
+  \ajLig{明治}\ajLig{大正}\ajLig{昭和}\ajLig{平成}\ajLig{令和}%
+  \textgt{\ajLig{明治}\ajLig{大正}\ajLig{昭和}\ajLig{平成}\ajLig{令和}}}
+
+
+\aj半角{半角カタカナひらがな} %←JFM の問題か,半角ひらがなが全角幅で出てしまう.
+←luatexja-otf.sty内で,JFMの文法拡張を行いました.
+
+
+
+\newpage
+
+\newcommand\SAMPLE{%
+ \mbox{1\CID{0}☃ゃーん}\pbox<t>{2☃ゃーん}%
+ \mbox{3\UTF{2603}\UTF{3083}\UTF{30FC}ん}%
+ \pbox<t>{4\UTF{2603}\UTF{3083}\UTF{30FC}ん}%
+ \mbox{5\CID{8218}\CID{908}\CID{660}ん}%
+ \pbox<t>{6\CID{8218}\CID{908}\CID{660}ん}%
+ \mbox{7\CID{8218}\CID{7924}\CID{7891}ん}%
+ \pbox<t>{8\CID{8218}\CID{7924}\CID{7891}ん}}
+
+\SAMPLE\par\smallskip
+
+
+\section*{Adobe-Japan1-7 全グリフ}
+
+{\footnotesize
+% 表の作成は Lua でサボってしまう.
+% \CID{0} (.notdef) は luaotfload がマッピングしてくれないみたい.
+\begin{luacode*}
+for i = 0, 23059 do
+   if i % 50 == 0 then
+      tex.print(string.format("\\noindent%05d", i))
+   end
+   if i % 10 == 0 then
+      tex.print(" ")
+   end
+   tex.print("\\hbox to 1\\zw{\\CID{"..tostring(i).."}}%")
+   if i % 50 == 49 then
+      tex.print("\\\\")
+   end
+end
+\end{luacode*}
+}
+
+\end{document}