summaryrefslogtreecommitdiff
path: root/src/fontloader/misc/fontloader-fonts-demo-vf-1.lua
diff options
context:
space:
mode:
authorPhilipp Gesang <phg42.2a@gmail.com>2014-12-14 12:29:58 +0100
committerPhilipp Gesang <phg42.2a@gmail.com>2014-12-14 12:29:58 +0100
commitc029158f450cd96f71db2f2a4da72a5c946089c0 (patch)
tree1c5d30d6853f6deb57cc9818b8739106a2d5e03f /src/fontloader/misc/fontloader-fonts-demo-vf-1.lua
parentea148be27d5a79fd11759856e0ab4033f328ce5a (diff)
parentca673f7b14af906606a188fd98978d3501842f63 (diff)
downloadluaotfload-c029158f450cd96f71db2f2a4da72a5c946089c0.tar.gz
Merge pull request #260 from phi-gamma/master
add import helper, new directory layout, revised letterspacing, fontloader gone nuts
Diffstat (limited to 'src/fontloader/misc/fontloader-fonts-demo-vf-1.lua')
-rw-r--r--src/fontloader/misc/fontloader-fonts-demo-vf-1.lua38
1 files changed, 38 insertions, 0 deletions
diff --git a/src/fontloader/misc/fontloader-fonts-demo-vf-1.lua b/src/fontloader/misc/fontloader-fonts-demo-vf-1.lua
new file mode 100644
index 0000000..3878ae6
--- /dev/null
+++ b/src/fontloader/misc/fontloader-fonts-demo-vf-1.lua
@@ -0,0 +1,38 @@
+local identifiers = fonts.hashes.identifiers
+
+return function(specification)
+ local f1, id1 = fonts.constructors.readanddefine('lmroman10-regular', specification.size)
+ local f2, id2 = fonts.constructors.readanddefine('lmsans10-regular', specification.size)
+ local f3, id3 = fonts.constructors.readanddefine('lmtypewriter10-regular',specification.size)
+ if f1 and f2 and f3 then
+ f1.properties.name = specification.name
+ f1.properties.virtualized = true
+ f1.fonts = {
+ { id = id1 },
+ { id = id2 },
+ { id = id3 },
+ }
+ local color = { [0] =
+ { "special", "pdf:0 g" },
+ { "special", "pdf:1 0 0 rg" },
+ { "special", "pdf:0 1 0 rg" },
+ { "special", "pdf:0 0 1 rg" },
+ }
+ local chars = {
+ identifiers[id1].characters,
+ identifiers[id2].characters,
+ identifiers[id3].characters,
+ }
+ for u, v in next, f1.characters do
+ local n = math.floor(math.random(1,3)+0.5)
+ local c = chars[n][u] or v
+ v.commands = { color[n], { 'slot', n, u }, color[0] }
+ v.kerns = nil
+ v.width = c.width
+ v.height = c.height
+ v.depth = c.depth
+ v.italic = nil
+ end
+ end
+ return f1
+end