summaryrefslogtreecommitdiff
path: root/tex/context/base/mkiv/font-ctx.lua
diff options
context:
space:
mode:
authorContext Git Mirror Bot <phg42.2a@gmail.com>2016-06-08 11:39:00 +0200
committerContext Git Mirror Bot <phg42.2a@gmail.com>2016-06-08 11:39:00 +0200
commit641b8d0802ead673334ad7048c701238e6c8c81e (patch)
tree9ab587f935e96f6eb24b739983e319541b983ee5 /tex/context/base/mkiv/font-ctx.lua
parentd78828b55508aae49922032ebd9117804a940f73 (diff)
downloadcontext-641b8d0802ead673334ad7048c701238e6c8c81e.tar.gz
2016-06-08 10:54:00
Diffstat (limited to 'tex/context/base/mkiv/font-ctx.lua')
-rw-r--r--tex/context/base/mkiv/font-ctx.lua25
1 files changed, 23 insertions, 2 deletions
diff --git a/tex/context/base/mkiv/font-ctx.lua b/tex/context/base/mkiv/font-ctx.lua
index 8c09ccc25..32270bf96 100644
--- a/tex/context/base/mkiv/font-ctx.lua
+++ b/tex/context/base/mkiv/font-ctx.lua
@@ -151,7 +151,7 @@ local function getfontname(tfmdata)
return basename(type(tfmdata) == "number" and properties[tfmdata].name or tfmdata.properties.name)
end
-fonts.helpers.name = getfontname
+helpers.name = getfontname
if _LUAVERSION < 5.2 then
@@ -160,7 +160,7 @@ if _LUAVERSION < 5.2 then
else
- utilities.strings.formatters.add(formatters,"font:name", [["'"..fontname(%s).."'"]], { fontname = fonts.helpers.name })
+ utilities.strings.formatters.add(formatters,"font:name", [["'"..fontname(%s).."'"]], { fontname = helpers.name })
utilities.strings.formatters.add(formatters,"font:features",[["'"..sequenced(%s," ",true).."'"]],{ sequenced = table.sequenced })
end
@@ -2498,3 +2498,24 @@ implement {
arguments = "string",
}
+-- an extra helper
+
+function helpers.getcoloredglyphs(tfmdata)
+ if type(tfmdata) == "number" then
+ tfmdata = fontdata[tfmdata]
+ end
+ if not tfmdata then
+ tfmdata = fontdata[true]
+ end
+ local characters = tfmdata.characters
+ local descriptions = tfmdata.descriptions
+ local collected = { }
+ for unicode in next, characters do
+ local description = descriptions[unicode]
+ if description and (description.colors or description.svg) then
+ collected[#collected+1] = unicode
+ end
+ end
+ table.sort(collected)
+ return collected
+end