summaryrefslogtreecommitdiff
path: root/tex/context/base/font-chk.lua
diff options
context:
space:
mode:
Diffstat (limited to 'tex/context/base/font-chk.lua')
-rw-r--r--tex/context/base/font-chk.lua56
1 files changed, 10 insertions, 46 deletions
diff --git a/tex/context/base/font-chk.lua b/tex/context/base/font-chk.lua
index 6dc1667bb..1b89366fd 100644
--- a/tex/context/base/font-chk.lua
+++ b/tex/context/base/font-chk.lua
@@ -9,9 +9,8 @@ if not modules then modules = { } end modules ['font-chk'] = {
-- possible optimization: delayed initialization of vectors
-- move to the nodes namespace
-local formatters = string.formatters
+local format = string.format
local bpfactor = number.dimenfactors.bp
-local fastcopy = table.fastcopy
local report_fonts = logs.reporter("fonts","checking")
@@ -24,11 +23,9 @@ local fonthashes = fonts.hashes
local fontdata = fonthashes.identifiers
local fontcharacters = fonthashes.characters
-local helpers = fonts.helpers
-
-local addprivate = helpers.addprivate
-local hasprivate = helpers.hasprivate
-local getprivatenode = helpers.getprivatenode
+local addprivate = fonts.helpers.addprivate
+local hasprivate = fonts.helpers.hasprivate
+local getprivatenode = fonts.helpers.getprivatenode
local otffeatures = fonts.constructors.newfeatures("otf")
local registerotffeature = otffeatures.register
@@ -68,7 +65,7 @@ local function onetimemessage(font,char,message) -- char == false returns table
if char == false then
return table.sortedkeys(category)
elseif not category[char] then
- report_fonts("char %C in font %a with id %a: %s",char,tfmdata.properties.fullname,font,message)
+ report_fonts("char %U in font %a with id %a: %s",char,tfmdata.properties.fullname,font,message)
category[char] = true
end
end
@@ -150,7 +147,7 @@ local variants = {
{ tag = "yellow", r = .6, g = .6, b = 0 },
}
-local pdf_blob = "pdf: q %0.6f 0 0 %0.6f 0 0 cm %s %s %s rg %s %s %s RG 10 M 1 j 1 J 0.05 w %s Q"
+local package = "q %0.6f 0 0 %0.6f 0 0 cm %s %s %s rg %s %s %s RG 10 M 1 j 1 J 0.05 w %s Q"
local cache = { } -- saves some tables but not that impressive
@@ -165,9 +162,9 @@ local function addmissingsymbols(tfmdata) -- we can have an alternative with rul
for i =1, #fakes do
local fake = fakes[i]
local name = fake.name
- local privatename = formatters["placeholder %s %s"](name,tag)
+ local privatename = format("placeholder %s %s",name,tag)
if not hasprivate(tfmdata,privatename) then
- local hash = formatters["%s_%s_%s_%s_%s_%s"](name,tag,r,g,b,size)
+ local hash = format("%s_%s_%s_%s_%s_%s",name,tag,r,g,b,size)
local char = cache[hash]
if not char then
char = {
@@ -175,7 +172,7 @@ local function addmissingsymbols(tfmdata) -- we can have an alternative with rul
height = size*fake.height,
depth = size*fake.depth,
-- bah .. low level pdf ... should be a rule or plugged in
- commands = { { "special", formatters[pdf_blob](scale,scale,r,g,b,r,g,b,fake.code) } }
+ commands = { { "special", "pdf: " .. format(package,scale,scale,r,g,b,r,g,b,fake.code) } }
}
cache[hash] = char
end
@@ -200,7 +197,7 @@ fonts.loggers.category_to_placeholder = mapping
function commands.getplaceholderchar(name)
local id = font.current()
addmissingsymbols(fontdata[id])
- context(helpers.getprivatenode(fontdata[id],name))
+ context(fonts.helpers.getprivatenode(fontdata[id],name))
end
function checkers.missing(head)
@@ -210,7 +207,6 @@ function checkers.missing(head)
local char = n.char
if font ~= lastfont then
characters = fontcharacters[font]
- lastfont = font
end
if not characters[char] and is_character[chardata[char].category] then
if action == "remove" then
@@ -361,35 +357,3 @@ luatex.registerstopactions(function()
end
end
end)
-
--- for the moment here
-
-local function expandglyph(characters,index,done)
- done = done or { }
- if not done[index] then
- local data = characters[index]
- if data then
- done[index] = true
- local d = fastcopy(data)
- local n = d.next
- if n then
- d.next = expandglyph(characters,n,done)
- end
- local h = d.horiz_variants
- if h then
- for i=1,#h do
- h[i].glyph = expandglyph(characters,h[i].glyph,done)
- end
- end
- local v = d.vert_variants
- if v then
- for i=1,#v do
- v[i].glyph = expandglyph(characters,v[i].glyph,done)
- end
- end
- return d
- end
- end
-end
-
-helpers.expandglyph = expandglyph