summaryrefslogtreecommitdiff
path: root/tex/context/base/font-con.lua
diff options
context:
space:
mode:
Diffstat (limited to 'tex/context/base/font-con.lua')
-rw-r--r--tex/context/base/font-con.lua84
1 files changed, 59 insertions, 25 deletions
diff --git a/tex/context/base/font-con.lua b/tex/context/base/font-con.lua
index aca705523..dd4cfa56a 100644
--- a/tex/context/base/font-con.lua
+++ b/tex/context/base/font-con.lua
@@ -394,7 +394,8 @@ function constructors.scale(tfmdata,specification)
targetparameters.forcedsize = forcedsize -- context specific
targetparameters.extrafactor = extrafactor -- context specific
--
- local tounicode = resources.tounicode
+ local tounicode = fonts.mappings.tounicode
+ --
local defaultwidth = resources.defaultwidth or 0
local defaultheight = resources.defaultheight or 0
local defaultdepth = resources.defaultdepth or 0
@@ -500,7 +501,8 @@ function constructors.scale(tfmdata,specification)
local autoitalicamount = properties.autoitalicamount
local stackmath = not properties.nostackmath
local nonames = properties.noglyphnames
- local nodemode = properties.mode == "node"
+ local haskerns = properties.haskerns or properties.mode == "base" -- we can have afm in node mode
+ local hasligatures = properties.hasligatures or properties.mode == "base" -- we can have afm in node mode
--
if changed and not next(changed) then
changed = false
@@ -594,39 +596,20 @@ function constructors.scale(tfmdata,specification)
-- we can have a dumb mode (basemode without math etc) that skips most
--
for unicode, character in next, characters do
- local chr, description, index, touni
+ local chr, description, index
if changed then
- -- basemode hack (we try to catch missing tounicodes, e.g. needed for ssty in math cambria)
local c = changed[unicode]
if c then
- local ligatures = character.ligatures -- the original ligatures (as we cannot rely on remapping)
description = descriptions[c] or descriptions[unicode] or character
character = characters[c] or character
index = description.index or c
- if tounicode then
- touni = tounicode[index] -- nb: index!
- if not touni then -- goodie
- local d = descriptions[unicode] or characters[unicode]
- local i = d.index or unicode
- touni = tounicode[i] -- nb: index!
- end
- end
- if ligatures and not character.ligatures then
- character.ligatures = ligatures -- the original targets (for now at least.. see libertine smallcaps)
- end
else
description = descriptions[unicode] or character
index = description.index or unicode
- if tounicode then
- touni = tounicode[index] -- nb: index!
- end
end
else
description = descriptions[unicode] or character
index = description.index or unicode
- if tounicode then
- touni = tounicode[index] -- nb: index!
- end
end
local width = description.width
local height = description.height
@@ -669,8 +652,10 @@ function constructors.scale(tfmdata,specification)
}
end
end
- if touni then
- chr.tounicode = touni
+ local isunicode = description.unicode
+ if isunicode then
+ chr.unicode = isunicode
+ chr.tounicode = tounicode(isunicode)
end
if hasquality then
-- we could move these calculations elsewhere (saves calculations)
@@ -767,7 +752,7 @@ function constructors.scale(tfmdata,specification)
end
end
end
- if not nodemode then
+ if haskerns then
local vk = character.kerns
if vk then
local s = sharedkerns[vk]
@@ -778,6 +763,8 @@ function constructors.scale(tfmdata,specification)
end
chr.kerns = s
end
+ end
+ if hasligatures then
local vl = character.ligatures
if vl then
if true then
@@ -1362,3 +1349,50 @@ function constructors.applymanipulators(what,tfmdata,features,trace,report)
end
end
end
+
+function constructors.addcoreunicodes(unicodes) -- maybe make this a metatable if used at all
+ if not unicodes then
+ unicodes = { }
+ end
+ unicodes.space = 0x0020
+ unicodes.hyphen = 0x002D
+ unicodes.zwj = 0x200D
+ unicodes.zwnj = 0x200C
+ return unicodes
+end
+
+-- -- keep for a while: old tounicode code
+--
+-- if changed then
+-- -- basemode hack (we try to catch missing tounicodes, e.g. needed for ssty in math cambria)
+-- local c = changed[unicode]
+-- if c then
+-- -- local ligatures = character.ligatures -- the original ligatures (as we cannot rely on remapping)
+-- description = descriptions[c] or descriptions[unicode] or character
+-- character = characters[c] or character
+-- index = description.index or c
+-- if tounicode then
+-- touni = tounicode[index] -- nb: index!
+-- if not touni then -- goodie
+-- local d = descriptions[unicode] or characters[unicode]
+-- local i = d.index or unicode
+-- touni = tounicode[i] -- nb: index!
+-- end
+-- end
+-- -- if ligatures and not character.ligatures then
+-- -- character.ligatures = ligatures -- the original targets (for now at least.. see libertine smallcaps)
+-- -- end
+-- else
+-- description = descriptions[unicode] or character
+-- index = description.index or unicode
+-- if tounicode then
+-- touni = tounicode[index] -- nb: index!
+-- end
+-- end
+-- else
+-- description = descriptions[unicode] or character
+-- index = description.index or unicode
+-- if tounicode then
+-- touni = tounicode[index] -- nb: index!
+-- end
+-- end