summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilipp Gesang <phg42.2a@gmail.com>2013-08-31 03:48:28 -0700
committerPhilipp Gesang <phg42.2a@gmail.com>2013-08-31 03:48:28 -0700
commita047f7b3c164f69b0713ee781aeefd07a27e8c61 (patch)
tree8cadd00504e69e265520f576f55da2c9e7ecfba4
parenta02c539db15612e87b095c3665f56d9436e669fb (diff)
parent9aec66e141e10d698e255c1303063e3a1236c278 (diff)
downloadluaotfload-a047f7b3c164f69b0713ee781aeefd07a27e8c61.tar.gz
Merge pull request #131 from phi-gamma/master
improve letterspacing
-rw-r--r--luaotfload-extralibs.lua16
-rw-r--r--luaotfload-letterspace.lua8
-rwxr-xr-xmktests48
3 files changed, 51 insertions, 21 deletions
diff --git a/luaotfload-extralibs.lua b/luaotfload-extralibs.lua
index 3769e06..d04ba5b 100644
--- a/luaotfload-extralibs.lua
+++ b/luaotfload-extralibs.lua
@@ -211,7 +211,12 @@ if not markdata then
if k == true then
return marks[currentfont()]
else
- local resources = identifiers[k].resources or { }
+ local resources = { }
+
+ if identifiers[k] then
+ resources = identifiers[k].resources or { }
+ end
+
local marks = resources.marks or { }
t[k] = marks
return marks
@@ -369,11 +374,10 @@ kerns.disablecharacterkerning = disablecharacterkerning
--- now for the simplistic variant
--- unit -> bool
local enablefontkerning = function ( )
- return add_processor(
- kernfont.handler,
- "typesetters.kernfont",
- "pre_linebreak_filter", "hpack_filter"
- )
+ return add_processor( kernfont.handler
+ , "typesetters.kernfont"
+ , "pre_linebreak_filter"
+ , "hpack_filter")
end
--- unit -> bool
diff --git a/luaotfload-letterspace.lua b/luaotfload-letterspace.lua
index 3134f22..b8bd36d 100644
--- a/luaotfload-letterspace.lua
+++ b/luaotfload-letterspace.lua
@@ -118,7 +118,10 @@ kerncharacters = function (head)
goto nextnode
elseif firstkern then
firstkern = false
- goto nextnode
+ if (id ~= disc_code) and (not start.components) then
+ --- not a ligature, skip node
+ goto nextnode
+ end
end
end
@@ -133,11 +136,12 @@ kerncharacters = function (head)
--- 2) resolve ligatures
local c = start.components
+
if c then
if keepligature and keepligature(start) then
-- keep 'm
else
- c = kerncharacters (c)
+ --- c = kerncharacters (c) --> taken care of after replacing
local s = start
local p, n = s.prev, s.next
local tail = find_node_tail(c)
diff --git a/mktests b/mktests
index 50402cc..cf53626 100755
--- a/mktests
+++ b/mktests
@@ -78,30 +78,51 @@ local infer_regular_style = {
{ "DejaVu Sans", "DejaVuSans.ttf" },
{ "Adobe Garamond Pro", "agaramondpro_regular.otf" },
{ "Garamond Premier Pro", "GaramondPremrPro-Capt.otf" },
+ { "CMU Serif", "cmunrm.otf" },
+ { "CMU Sans Serif", "cmunss.otf" },
}
local choose_optical_size = {
- { { name = "Latin Modern Roman", optsize = 0 }, "lmroman5-regular.otf" },
- { { name = "Latin Modern Roman", optsize = 10 }, "lmroman10-regular.otf" },
- { { name = "Latin Modern Roman", optsize = 12 }, "lmroman12-regular.otf" },
- { { name = "Latin Modern Roman", optsize = 42 }, "lmroman17-regular.otf" },
- { { name = "EB Garamond", optsize = 0 }, "EBGaramond08-Regular.otf" },
- { { name = "EB Garamond", optsize = 8 }, "EBGaramond08-Regular.otf" },
- { { name = "EB Garamond", optsize = 12 }, "EBGaramond12-Regular.otf" },
- { { name = "EB Garamond", optsize = 42 }, "EBGaramond12-Regular.otf" },
+ { { name = "Latin Modern Roman", optsize = 0 }, "lmroman5-regular.otf" },
+ { { name = "Latin Modern Roman", optsize = 10 }, "lmroman10-regular.otf" },
+ { { name = "Latin Modern Roman", optsize = 12 }, "lmroman12-regular.otf" },
+ { { name = "Latin Modern Roman", optsize = 42 }, "lmroman17-regular.otf" },
+ { { name = "EB Garamond", optsize = 0 }, "EBGaramond08-Regular.otf" },
+ { { name = "EB Garamond", optsize = 8 }, "EBGaramond08-Regular.otf" },
+ { { name = "EB Garamond", optsize = 12 }, "EBGaramond12-Regular.otf" },
+ { { name = "EB Garamond", optsize = 42 }, "EBGaramond12-Regular.otf" },
{ { name = "Garamond Premier Pro", optsize = 0 }, "GaramondPremrPro-Capt.otf" },
- { { name = "Garamond Premier Pro", optsize = 10 }, "GaramondPremrPro.otf" },
+ { { name = "Garamond Premier Pro", optsize = 10 }, "GaramondPremrPro.otf" },
{ { name = "Garamond Premier Pro", optsize = 15 }, "GaramondPremrPro-Subh.otf" },
{ { name = "Garamond Premier Pro", optsize = 42 }, "GaramondPremrPro-Disp.otf" },
}
+local choose_style = {
+ { { name = "DejaVu Sans", style = "regular" }, "DejaVuSans.ttf" },
+ { { name = "DejaVu Sans", style = "italic" }, "DejaVuSans-Oblique.ttf" },
+ { { name = "DejaVu Sans", style = "bold" }, "DejaVuSans-Bold.ttf" },
+ { { name = "DejaVu Sans", style = "bolditalic" }, "DejaVuSans-BoldOblique.ttf" },
+ { { name = "Linux Libertine O", style = "regular" }, "LinLibertine_R.otf" },
+ { { name = "Linux Libertine O", style = "italic" }, "LinLibertine_RI.otf" },
+ { { name = "Linux Libertine O", style = "bold" }, "LinLibertine_RB.otf" },
+ { { name = "Linux Libertine O", style = "bolditalic" }, "LinLibertine_RBI.otf" },
+ { { name = "Liberation Serif", style = "regular" }, "LiberationSerif-Regular.ttf" },
+ { { name = "Liberation Serif", style = "italic" }, "LiberationSerif-Italic.ttf" },
+ { { name = "Liberation Serif", style = "bold" }, "LiberationSerif-Bold.ttf" },
+ { { name = "Liberation Serif", style = "bolditalic" }, "LiberationSerif-BoldItalic.ttf" },
+ { { name = "CMU Sans Serif", style = "regular" }, "cmunss.otf" }, -- no “regular” but “medium”
+ { { name = "CMU Sans Serif", style = "italic" }, "cmunsi.otf" }, -- no “italic” but “oblique”
+ { { name = "CMU Sans Serif", style = "bold" }, "cmunsx.otf" },
+ { { name = "CMU Sans Serif", style = "bolditalic" }, "cmunso.otf" },
+}
+
--- this needs a database built with --formats=+pfa,pfb,afm
local resolve_t1_font = {
- { { name = "URW Gothic L", style = "regular" }, "uagk8a.pfb" },
- { { name = "URW Gothic L", style = "italic" }, "uagko8a.pfb" },
- { { name = "URW Gothic L", style = "bold" }, "uagd8a.pfb" },
- { { name = "URW Gothic L", style = "bolditalic" }, "uagdo8a.pfb" },
+ { { name = "URW Gothic L", style = "regular" }, "uagk8a.pfb" },
+ { { name = "URW Gothic L", style = "italic" }, "uagko8a.pfb" },
+ { { name = "URW Gothic L", style = "bold" }, "uagd8a.pfb" },
+ { { name = "URW Gothic L", style = "bolditalic" }, "uagdo8a.pfb" },
{ { name = "Century Schoolbook L", style = "regular" }, "uncr8a.pfb" },
{ { name = "Century Schoolbook L", style = "italic" }, "uncri8a.pfb" },
{ { name = "Century Schoolbook L", style = "bold" }, "uncb8a.pfb" },
@@ -115,6 +136,7 @@ local resolve_t1_font = {
local font_name_tests = {
infer_regular_style,
choose_optical_size,
+ choose_style,
resolve_t1_font,
}