summaryrefslogtreecommitdiff
path: root/tex/context/base/mkxl/font-ogr.lmt
diff options
context:
space:
mode:
Diffstat (limited to 'tex/context/base/mkxl/font-ogr.lmt')
-rw-r--r--tex/context/base/mkxl/font-ogr.lmt152
1 files changed, 60 insertions, 92 deletions
diff --git a/tex/context/base/mkxl/font-ogr.lmt b/tex/context/base/mkxl/font-ogr.lmt
index 698593ac7..1f930c78d 100644
--- a/tex/context/base/mkxl/font-ogr.lmt
+++ b/tex/context/base/mkxl/font-ogr.lmt
@@ -474,7 +474,7 @@ do -- this will move to its own module
end
--- This sits here for historcal reasons so for now we keep it here.
+-- This sits here for historical reasons so for now we keep it here.
local startactualtext = nil
local stopactualtext = nil
@@ -487,20 +487,8 @@ function otf.getactualtext(s)
return startactualtext(s), stopactualtext()
end
--- This is also somewhat specific.
-
-local color_direct = function() return false end
-local color_indirect = color_direct
-
-updaters.register("backend.update",function()
- color_direct = lpdf.fonts.color_direct
- color_indirect = lpdf.fonts.color_indirect
-end)
-
local sharedpalettes = { } do
- local register = attributes.colors.register
-
local colors = attributes.list[attributes.private('color')] or { }
local transparencies = attributes.list[attributes.private('transparency')] or { }
@@ -510,20 +498,10 @@ local sharedpalettes = { } do
local v = values[i]
if v == "textcolor" then
values[i] = false
- else
- local c = nil
- local t = nil
- if type(v) == "table" then
- c = register(name,"rgb",
- max(round((v.r or 0)*255),255)/255,
- max(round((v.g or 0)*255),255)/255,
- max(round((v.b or 0)*255),255)/255
- )
- else
- c = colors[v]
- t = transparencies[v]
- end
- values[i] = color_indirect(c,t)
+ elseif type(v) == "table" then
+ values[i] = { kind = "values", data = v }
+ else -- freezing
+ values[i] = { kind = "attributes", color = colors[v], transparency = transparencies[v] }
end
end
end
@@ -532,83 +510,73 @@ end
local initializeoverlay do
- local function autoconvert(t,k)
- local v = { }
- for i=1,#k do
- local p = k[i]
- v[i] = color_direct(p[1]/255, p[2]/255, p[3]/255)
- end
- t[k] = v
- return v
- end
-
initializeoverlay = function(tfmdata,kind,value) -- we really need the id ... todo
if value then
local resources = tfmdata.resources
local palettes = resources.colorpalettes
if palettes then
- --
- local converted = resources.converted
- if not converted then
- converted = setmetatableindex(autoconvert)
- resources.converted = converted
- end
- local colorvalues = sharedpalettes[value]
- local default = false -- so the text color (bad for icon overloads)
- if colorvalues then
- default = colorvalues[#colorvalues]
+ local colorvalues = false
+ local colordata = sharedpalettes[value]
+ if colordata and #colordata > 0 then
+ colorvalues = {
+ kind = "user",
+ data = colordata,
+ }
else
- colorvalues = converted[palettes[tonumber(value) or 1] or palettes[1]] or { }
- end
- local classes = #colorvalues
- if classes == 0 then
- return
+ colordata = palettes[tonumber(value) or 1] or palettes[1]
+ if colordata and #colordata > 0 then
+ colorvalues = {
+ kind = "font",
+ data = colordata,
+ }
+ end
end
- --
- local characters = tfmdata.characters
- local descriptions = tfmdata.descriptions
- local droppedin, tfmdrop, dropchars, dropdescs, colrshapes
- local idx = 255
- local slot = 0
- --
- -- maybe delay in which case we have less fonts as we can be sparse
- --
- for k, v in next, characters do
- local index = v.index
- if index then
- local description = descriptions[k]
- if description then
- local colorlist = description.colors
- if colorlist then
- if idx >= 255 then
- idx = 1
- colrshapes = { }
- slot, droppedin, tfmdrop = fonts.dropins.provide("color",tfmdata,colrshapes,colorvalues)
- dropchars = tfmdrop.characters
- dropdescs = tfmdrop.descriptions
- else
- idx = idx + 1
- end
- --
- colrshapes[idx] = description
- -- todo: use extender
- local u = { "use", 0 }
- for i=1,#colorlist do
- u[i+2] = colorlist[i].slot
+ if colorvalues then
+ local characters = tfmdata.characters
+ local descriptions = tfmdata.descriptions
+ local droppedin, tfmdrop, dropchars, dropdescs, colrshapes
+ local idx = 255
+ local slot = 0
+ --
+ -- maybe delay in which case we have less fonts as we can be sparse
+ --
+ for k, v in next, characters do
+ local index = v.index
+ if index then
+ local description = descriptions[k]
+ if description then
+ local colorlist = description.colors
+ if colorlist then
+ if idx >= 255 then
+ idx = 1
+ colrshapes = { }
+ slot, droppedin, tfmdrop = fonts.dropins.provide("color",tfmdata,colrshapes,colorvalues)
+ dropchars = tfmdrop.characters
+ dropdescs = tfmdrop.descriptions
+ else
+ idx = idx + 1
+ end
+ --
+ colrshapes[idx] = description
+ -- todo: use extender
+ local u = { "use", 0 }
+ for i=1,#colorlist do
+ u[i+2] = colorlist[i].slot
+ end
+ v.commands = { u, { "slot", slot, idx } }
+ -- hack to prevent that type 3 also gets 'use' flags .. todo
+ local c = { commands = false, index = idx, dropin = tfmdata }
+ local d = { } -- index = idx, dropin = tfmdrop
+ setmetatableindex(c,v)
+ setmetatableindex(d,description)
+ dropchars[idx] = c
+ dropdescs[idx] = d -- not needed
end
- v.commands = { u, { "slot", slot, idx } }
- -- hack to prevent that type 3 also gets 'use' flags .. todo
- local c = { commands = false, index = idx, dropin = tfmdata }
- local d = { } -- index = idx, dropin = tfmdrop
- setmetatableindex(c,v)
- setmetatableindex(d,description)
- dropchars[idx] = c
- dropdescs[idx] = d -- not needed
end
end
end
+ return true
end
- return true
end
end
end