From 451bec66e177935ef906e8c530de8dc4ad6bd9c8 Mon Sep 17 00:00:00 2001
From: Philipp Gesang <phg@phi-gamma.net>
Date: Fri, 23 Sep 2016 22:51:34 +0200
Subject: [fontloader] patch basics-gen to include missing converters
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Fontloader crashes during loading. Hans is notified, let’s wait for him
to fix it properly.
---
 src/fontloader/runtime/fontloader-basics-gen.lua | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

(limited to 'src')

diff --git a/src/fontloader/runtime/fontloader-basics-gen.lua b/src/fontloader/runtime/fontloader-basics-gen.lua
index 2be55cc..6aec915 100644
--- a/src/fontloader/runtime/fontloader-basics-gen.lua
+++ b/src/fontloader/runtime/fontloader-basics-gen.lua
@@ -434,3 +434,23 @@ if arg then
         end
     end
 end
+
+--- PHG: HACK HACK HACK HACK HACK HACK HACK HACK HACK HACK HACK
+--- 	 certain values are missing from attr-col.lua.
+local function cmyktorgb(c,m,y,k)
+    if not c then
+        return 0, 0, 0, 1
+    else
+        return 1.0 - min(1.0,c+k), 1.0 - min(1.0,m+k), 1.0 - min(1.0,y+k)
+    end
+end
+
+local function graytorgb(s) -- unweighted
+   return 1-s, 1-s, 1-s
+end
+
+attributes                  = attributes or { }
+attributes.colors           = attributes.colors or { }
+attributes.colors.cmyktorgb = cmyktorgb
+attributes.colors.graytorgb = graytorgb
+
-- 
cgit v1.2.3