summaryrefslogtreecommitdiff
path: root/tex/context/base/mkiv/font-ocl.lua
diff options
context:
space:
mode:
authorContext Git Mirror Bot <phg42.2a@gmail.com>2016-09-24 13:11:46 +0200
committerContext Git Mirror Bot <phg42.2a@gmail.com>2016-09-24 13:11:46 +0200
commit236690a6367b25187d37013e1e7fc196c5c44eb8 (patch)
treea1c9520899dc817b2cf492750c10a1990331c273 /tex/context/base/mkiv/font-ocl.lua
parent9858ddd23d54c56b2ce9e1f5580190d3210d18ed (diff)
downloadcontext-236690a6367b25187d37013e1e7fc196c5c44eb8.tar.gz
2016-09-24 12:45:00
Diffstat (limited to 'tex/context/base/mkiv/font-ocl.lua')
-rw-r--r--tex/context/base/mkiv/font-ocl.lua60
1 files changed, 39 insertions, 21 deletions
diff --git a/tex/context/base/mkiv/font-ocl.lua b/tex/context/base/mkiv/font-ocl.lua
index 0e415d76a..65a1c6342 100644
--- a/tex/context/base/mkiv/font-ocl.lua
+++ b/tex/context/base/mkiv/font-ocl.lua
@@ -14,9 +14,6 @@ local round, max = math.round, math.round
local formatters = string.formatters
local tounicode = fonts.mappings.tounicode
-local graytorgb = attributes.colors.graytorgb
-local cmyktorgb = attributes.colors.cmyktorgb
-
local otf = fonts.handlers.otf
local f_color = formatters["pdf:direct:%f %f %f rg"]
@@ -50,28 +47,49 @@ end
local sharedpalettes = { }
-function otf.registerpalette(name,values)
- sharedpalettes[name] = values
- for i=1,#values do
- local v = values[i]
- local r, g, b
- local s = v.s
- if s then
- r, g, b = graytorgb(s)
- else
- local c, m, y, k = v.c, v.m, v.y, v.k
- if c or m or y or k then
- r, g, b = cmyktorgb(c or 0,m or 0,y or 0,k or 0)
+if context then
+
+ local graytorgb = attributes.colors.graytorgb
+ local cmyktorgb = attributes.colors.cmyktorgb
+
+ function otf.registerpalette(name,values)
+ sharedpalettes[name] = values
+ for i=1,#values do
+ local v = values[i]
+ local r, g, b
+ local s = v.s
+ if s then
+ r, g, b = graytorgb(s)
else
- r, g, b = v.r, v.g, v.b
+ local c, m, y, k = v.c, v.m, v.y, v.k
+ if c or m or y or k then
+ r, g, b = cmyktorgb(c or 0,m or 0,y or 0,k or 0)
+ else
+ r, g, b = v.r, v.g, v.b
+ end
end
+ values[i] = {
+ max(r and round(r*255) or 0,255),
+ max(g and round(g*255) or 0,255),
+ max(b and round(b*255) or 0,255)
+ }
end
- values[i] = {
- max(r and round(r*255) or 0,255),
- max(g and round(g*255) or 0,255),
- max(b and round(b*255) or 0,255)
- }
end
+
+else -- for generic
+
+ function otf.registerpalette(name,values)
+ sharedpalettes[name] = values
+ for i=1,#values do
+ local v = values[i]
+ values[i] = {
+ max(round((v.r or 0)*255),255),
+ max(round((v.g or 0)*255),255),
+ max(round((v.b or 0)*255),255)
+ }
+ end
+ end
+
end
local function initializecolr(tfmdata,kind,value) -- hm, always value