From 0189223a1a40debb4cb3b146ce182eb806cd28f2 Mon Sep 17 00:00:00 2001 From: Hans Hagen Date: Fri, 26 Apr 2019 00:56:11 +0200 Subject: 2019-04-25 10:44:00 --- tex/context/base/mkiv/font-imp-quality.lua | 49 +++++++++++++++++++++--------- 1 file changed, 34 insertions(+), 15 deletions(-) (limited to 'tex/context/base/mkiv/font-imp-quality.lua') diff --git a/tex/context/base/mkiv/font-imp-quality.lua b/tex/context/base/mkiv/font-imp-quality.lua index 01f0afe63..56e91df99 100644 --- a/tex/context/base/mkiv/font-imp-quality.lua +++ b/tex/context/base/mkiv/font-imp-quality.lua @@ -153,15 +153,11 @@ registerafmfeature(specification) fonts.goodies.register("expansions", function(...) return fonts.goodies.report("expansions", trace_expansion, ...) end) -if context then - - implement { - name = "setupfontexpansion", - arguments = "2 strings", - actions = function(class,settings) getparameters(classes,class,'preset',settings) end - } - -end +implement { + name = "setupfontexpansion", + arguments = "2 strings", + actions = function(class,settings) getparameters(classes,class,'preset',settings) end +} -- -- -- -- -- -- -- protrusion @@ -516,12 +512,35 @@ registerafmfeature(specification) fonts.goodies.register("protrusions", function(...) return fonts.goodies.report("protrusions", trace_protrusion, ...) end) -if context then +implement { + name = "setupfontprotrusion", + arguments = "2 strings", + actions = function(class,settings) getparameters(classes,class,'preset',settings) end +} + +local function initialize(tfmdata,value) + local properties = tfmdata.properties + if properties then + value = tonumber(value) + if value then + if value < 5 then + value = 5 + elseif value > 100 then + value = 100 + end + end + properties.threshold = value or nil -- nil enforces default + end +end - implement { - name = "setupfontprotrusion", - arguments = "2 strings", - actions = function(class,settings) getparameters(classes,class,'preset',settings) end +local specification = { + name = "threshold", + description = "threshold for quality features", + initializers = { + base = initialize, + node = initialize, } +} -end +registerotffeature(specification) +registerafmfeature(specification) -- cgit v1.2.3