summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/fontspec/fontspec.lua
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2011-09-13 22:53:04 +0000
committerKarl Berry <karl@freefriends.org>2011-09-13 22:53:04 +0000
commite646dedf9c5e492e2598cdfd13cda820ad2f62a7 (patch)
tree081a6eab5571d8fbe3292abda0a0064d9c616422 /Master/texmf-dist/tex/latex/fontspec/fontspec.lua
parent2ff31e7482486eeb8c9d13664a15c30fc293da95 (diff)
fontspec 2.2 (13sep11)
git-svn-id: svn://tug.org/texlive/trunk@23936 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/fontspec/fontspec.lua')
-rw-r--r--Master/texmf-dist/tex/latex/fontspec/fontspec.lua32
1 files changed, 25 insertions, 7 deletions
diff --git a/Master/texmf-dist/tex/latex/fontspec/fontspec.lua b/Master/texmf-dist/tex/latex/fontspec/fontspec.lua
index a6b5528391a..869bc5879dd 100644
--- a/Master/texmf-dist/tex/latex/fontspec/fontspec.lua
+++ b/Master/texmf-dist/tex/latex/fontspec/fontspec.lua
@@ -36,14 +36,14 @@ function fontspec.sprint (...) tex.sprint(luatexbase.catcodetables['latex-packag
local function check_script(id, script)
local s = string.lower(script)
if id and id > 0 then
- local otfdata = fonts.ids[id].shared.otfdata
+ local otfdata = fonts.identifiers[id].shared.otfdata
if otfdata then
local features = otfdata.luatex.features
for i,_ in pairs(features) do
for j,_ in pairs(features[i]) do
if features[i][j][s] then
fontspec.log("script '%s' exists in font '%s'",
- script, fonts.ids[id].fullname)
+ script, fonts.identifiers[id].fullname)
return true
end
end
@@ -55,14 +55,14 @@ local function check_language(id, language, script)
local s = string.lower(script)
local l = string.lower(language)
if id and id > 0 then
- local otfdata = fonts.ids[id].shared.otfdata
+ local otfdata = fonts.identifiers[id].shared.otfdata
if otfdata then
local features = otfdata.luatex.features
for i,_ in pairs(features) do
for j,_ in pairs(features[i]) do
if features[i][j][s] and features[i][j][s][l] then
fontspec.log("language '%s' for script '%s' exists in font '%s'",
- language, script, fonts.ids[id].fullname)
+ language, script, fonts.identifiers[id].fullname)
return true
end
end
@@ -75,14 +75,14 @@ local function check_feature(id, feature, language, script)
local l = string.lower(language)
local f = string.lower(feature:gsub("^[+-]", ""))
if id and id > 0 then
- local otfdata = fonts.ids[id].shared.otfdata
+ local otfdata = fonts.identifiers[id].shared.otfdata
if otfdata then
local features = otfdata.luatex.features
for i,_ in pairs(features) do
if features[i][f] and features[i][f][s] then
if features[i][f][s][l] == true then
fontspec.log("feature '%s' for language '%s' and script '%s' exists in font '%s'",
- feature, language, script, fonts.ids[id].fullname)
+ feature, language, script, fonts.identifiers[id].fullname)
return true
end
end
@@ -120,7 +120,7 @@ function fontspec.check_ot_feat(fnt, feat, lang, script)
end
end
function fontspec.mathfontdimen(fnt, str)
- local mathdimens = fonts.ids[font.id(fnt)].MathConstants
+ local mathdimens = fonts.identifiers[font.id(fnt)].MathConstants
if mathdimens then
local m = mathdimens[str]
if m then
@@ -133,6 +133,24 @@ function fontspec.mathfontdimen(fnt, str)
fontspec.sprint("0pt")
end
end
+local function set_capheight(fontdata)
+ local capheight
+ local units = fontdata.units
+ local size = fontdata.size
+ local otfdata = fontdata.shared.otfdata
+
+ if otfdata.pfminfo.os2_capheight > 0 then
+ capheight = otfdata.pfminfo.os2_capheight / units * size
+ else
+ if fontdata.characters[string.byte("X")] then
+ capheight = fontdata.characters[string.byte("X")].height
+ else
+ capheight = otfdata.metadata.ascent / units * size
+ end
+ end
+ fontdata.parameters[8] = capheight
+end
+luatexbase.add_to_callback("luaotfload.patch_font", set_capheight, "fontspec.set_capheight")
--
-- Copyright 2004--2011 Will Robertson <wspr81@gmail.com>
-- Copyright 2009--2010 Khaled Hosny <khaledhosny@eglug.org>