Skip to content

Commit

Permalink
tools/mkmap{,-ai0}-ja.lua: use 2004 CMap for TrueType and add -90.map (
Browse files Browse the repository at this point in the history
  • Loading branch information
h20y6m committed Mar 24, 2024
1 parent 854c6e6 commit 8399e8a
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 7 deletions.
8 changes: 6 additions & 2 deletions tools/mkmap-ai0-ja.lua
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ local foundry_fallback = {
-- テーブルサイズが 5 のとき,4/5 番目は fallback の AJ1 フォント用
-- テーブルサイズが 3 のとき,全て fallback の AJ1 フォント用
local maps = {
['ptex-@'] = { -- pTeX 90JIS
['ptex-@-90'] = { -- pTeX 90JIS
{'rml', 'H', 'fmr'},
{'rmlv', 'V', 'fmr'},
{'gbm', 'H', 'fgru'},
Expand All @@ -102,7 +102,7 @@ local maps = {
{'gbm', '2004-H', 'fgru'},
{'gbmv', '2004-V', 'fgru'},
},
['uptex-@'] = { -- upTeX 90JIS
['uptex-@-90'] = { -- upTeX 90JIS
{'urml', '-l jp90', 'mr', 'fmr', 'UniJIS-UTF16-H'},
{'urmlv', '-w 1 -l jp90', 'mr', 'fmr', 'UniJIS-UTF16-V'},
{'ugbm', '-l jp90', 'gru', 'fgru', 'UniJIS-UTF16-H'},
Expand Down Expand Up @@ -252,6 +252,10 @@ for fd, v1 in pairs(foundry) do
local dirname = fd
print('jaEmbed: ' .. dirname)
mkdir(dirname)

maps['ptex-@'] = maps['ptex-@-90']
maps['uptex-@'] = maps['uptex-@-90']

for mnx, mcont in pairs(maps) do
if not string.match(mnx, '-04') or not foundry[fd].noncid or foundry[fd].separate then
local mapbase = gsub(mnx, '@', dirname)
Expand Down
34 changes: 29 additions & 5 deletions tools/mkmap-ja.lua
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ local foundry = {
},
['ms'] = {
noncid = true,
jis90ivs = true,
ml=':0:msmincho.ttc %!PS MS-Mincho',
mr=':0:msmincho.ttc %!PS MS-Mincho',
mb=':0:msmincho.ttc %!PS MS-Mincho',
Expand All @@ -33,6 +34,7 @@ local foundry = {
},
['ms-osx'] = {
noncid = true,
jis90ivs = true,
ml='MS-Mincho.ttf',
mr='MS-Mincho.ttf',
mb='MS-Mincho.ttf',
Expand All @@ -45,6 +47,7 @@ local foundry = {
},
['bizud'] = {
noncid = true,
jis90ivs = true,
ml=':0:BIZ-UDMinchoM.ttc %!PS BIZ-UDMincho-Medium',
mr=':0:BIZ-UDMinchoM.ttc %!PS BIZ-UDMincho-Medium',
mb=':0:BIZ-UDMinchoM.ttc %!PS BIZ-UDMincho-Medium',
Expand All @@ -57,6 +60,7 @@ local foundry = {
},
['yu-win'] = {
noncid = true,
jis90ivs = true,
ml='yuminl.ttf %!PS YuMincho-Light',
mr='yumin.ttf %!PS YuMincho-Regular',
mb='yumindb.ttf %!PS YuMincho-Demibold',
Expand All @@ -69,6 +73,7 @@ local foundry = {
},
['yu-win10'] = {
noncid = true,
jis90ivs = true,
ml='yuminl.ttf %!PS YuMincho-Light',
mr='yumin.ttf %!PS YuMincho-Regular',
mb='yumindb.ttf %!PS YuMincho-Demibold',
Expand Down Expand Up @@ -105,6 +110,7 @@ local foundry = {
},
['ipaex'] = {
noncid = true,
jis90ivs = true,
ml='ipaexm.ttf %!PS IPAexMincho',
mr='ipaexm.ttf %!PS IPAexMincho',
mb='ipaexm.ttf %!PS IPAexMincho',
Expand Down Expand Up @@ -297,7 +303,7 @@ local suffix = {
-- '#' は 'h', 'v' に置換される
-- '@' は jaEmbed の値に置換される
local maps = {
['ptex-@'] = { -- pTeX 90JIS
['ptex-@-90'] = { -- pTeX 90JIS
{'rml', 'H', 'mr'},
{'rmlv', 'V', 'mr'},
{'gbm', 'H', 'gru'},
Expand All @@ -309,7 +315,7 @@ local maps = {
{'gbm', '2004-H', 'grun'},
{'gbmv', '2004-V', 'grun'},
},
['uptex-@'] = { -- upTeX 90JIS
['uptex-@-90'] = { -- upTeX 90JIS
{'urml', 'UniJIS-UTF16-H', 'mr'},
{'urmlv', 'UniJIS-UTF16-V', 'mr'},
{'ugbm', 'UniJIS-UTF16-H', 'gru'},
Expand Down Expand Up @@ -474,12 +480,30 @@ for fd, v1 in pairs(foundry) do
local dirname = fd .. suffix[s][2]
print('jaEmbed: ' .. dirname)
mkdir(dirname)

-- デフォルトの map は、
-- フォントが OpenType (CID) の場合は、JIS90 用の設定で作る
-- フォントが TrueType の場合は、JIS2004 用の設定で作る
-- ただし TrueType でも separate なときは JIS90 用の設定で作る
if foundry[fd].noncid and not foundry[fd].separate then
maps['ptex-@'] = maps['ptex-@-04']
maps['uptex-@'] = maps['uptex-@-04']
else
maps['ptex-@'] = maps['ptex-@-90']
maps['uptex-@'] = maps['uptex-@-90']
end

for mnx, mcont in pairs(maps) do
--if not string.match(mnx, '-04') or string.match(s, jis2004_flag) then
-- フォントが OpenType (CID) の場合は、すべての map を作る
-- フォントが TrueType の場合は、基本的に -04 以外の map を作る
-- ただし TrueType でも separate なときは -04 も作る
if not string.match(mnx, '-04') or not foundry[fd].noncid or foundry[fd].separate then
-- フォントが TrueType の場合は、基本的に -90, -04 以外の map を作る
-- ただし TrueType でも separate なときは -90, -04 も作る
-- ただし TrueType でも jis90ivs なときは -90 も作る
if not foundry[fd].noncid or
foundry[fd].separate or
foundry[fd].jis90ivs and string.match(mnx, '-90') or
not string.match(mnx, '-90') and not string.match(mnx, '-04') then

local mapbase = gsub(mnx, '@', dirname)
local f = io.open(dirname .. '/' .. mapbase .. '.map', 'w+')
for _,x in ipairs(mcont) do
Expand Down

0 comments on commit 8399e8a

Please sign in to comment.