summaryrefslogtreecommitdiff
path: root/tex/context/base/mkiv/font-sel.lua
diff options
context:
space:
mode:
authorContext Git Mirror Bot <phg42.2a@gmail.com>2016-08-08 21:30:04 +0200
committerContext Git Mirror Bot <phg42.2a@gmail.com>2016-08-08 21:30:04 +0200
commit0e99988c85616897aa99e28c4f00d596d677f5ab (patch)
tree743d9039ab43aab9ad4e2881b47ce9e854986567 /tex/context/base/mkiv/font-sel.lua
parent96f283b0d4f0259b7d7d1c64d1d078c519fc84a6 (diff)
downloadcontext-0e99988c85616897aa99e28c4f00d596d677f5ab.tar.gz
2016-08-08 21:06:00
Diffstat (limited to 'tex/context/base/mkiv/font-sel.lua')
-rw-r--r--tex/context/base/mkiv/font-sel.lua56
1 files changed, 37 insertions, 19 deletions
diff --git a/tex/context/base/mkiv/font-sel.lua b/tex/context/base/mkiv/font-sel.lua
index d5bb754f7..003b708c6 100644
--- a/tex/context/base/mkiv/font-sel.lua
+++ b/tex/context/base/mkiv/font-sel.lua
@@ -17,39 +17,39 @@ local splitat, lpegmatch = lpeg.splitat, lpeg.match
local formatters = string.formatters
local settings_to_array = utilities.parsers.settings_to_array
local settings_to_hash = utilities.parsers.settings_to_hash
-
+
local v_default = interfaces.variables.default
-
+
local implement = interfaces.implement
-
+
local selectfont = fonts.select or { }
fonts.select = selectfont
-
+
local data = selectfont.data or { }
selectfont.data = data
-
+
local fallbacks = selectfont.fallbacks or { }
selectfont.fallbacks = fallbacks
-
+
local methods = selectfont.methods or { }
selectfont.methods = methods
-
+
local extras = selectfont.extras or { }
selectfont.extras = extras
-
+
local alternatives = selectfont.alternatives or { }
selectfont.alternatives = alternatives
-
+
local presets = selectfont.presets or { }
selectfont.presets = presets
-
+
local defaults = selectfont.defaults or { }
selectfont.defaults = defaults
local getlookups = fonts.names.getlookups
local registerdesignsizes = fonts.goodies.designsizes.register
local bodyfontsizes = storage.shared.bodyfontsizes
-
+
local ctx_definefontsynonym = context.definefontsynonym
local ctx_resetfontfallback = context.resetfontfallback
local ctx_startfontclass = context.startfontclass
@@ -82,6 +82,7 @@ defaults["dejavumath"] = { options = { extras = "dejavu",
defaults["neoeuler"] = { options = { extras = "euler-math", features = "math\\mathsizesuffix" } }
defaults["latinmodernmath"] = { options = { extras = "lm,lm-math", features = "math\\mathsizesuffix,lm-math", goodies = "lm" } }
defaults["lucidabrightmathot"] = { options = { extras = "lucida-opentype-math", features = "math\\mathsizesuffix", goodies = "lucida-opentype-math" } }
+defaults["minionmath"] = { options = { extras = "minion-math", features = "math\\mathsizesuffix", goodies = "minion-math" } }
defaults["texgyredejavumath"] = { options = { extras = "dejavu", features = "math\\mathsizesuffix" } }
defaults["texgyrepagellamath"] = { options = { extras = "texgyre", features = "math\\mathsizesuffix" } }
defaults["texgyrebonummath"] = { options = { extras = "texgyre", features = "math\\mathsizesuffix" } }
@@ -227,7 +228,7 @@ local m_alternative = {
["sl"] = "italic",
["bi"] = "bolditalic",
["bs"] = "bolditalic",
- ["sc"] = "regular"
+ ["sc"] = "smallcaps"
}
--~ methods["style"] = function(data,alternative,style)
@@ -294,6 +295,18 @@ local function m_style_family(family)
end
end
+local function m_style_subfamily(entries,style,family)
+ local t = { }
+ for index, entry in next, entries do
+ if entry["familyname"] == family and entry["subfamilyname"] == style then -- familyname + subfamilyname
+ t[#t+1] = entry
+ elseif entry["family"] == family and entry["subfamily"] == style then -- family + subfamily
+ t[#t+1] = entry
+ end
+ end
+ return #t ~= 0 and t or nil
+end
+
local function m_style_weight(entries,style)
local t = { }
local weight = m_name[style] and m_name[style]["weight"] or "regular"
@@ -396,13 +409,18 @@ methods["style"] = function(data,alternative,style)
local fontstyle = m_alternative[style] or style
local entries = m_style_family(fontfamily)
if entries then
- entries = m_style_weight(entries,fontstyle)
- if entries then
- entries = m_style_style(entries,fontstyle)
+ local subfamily = m_style_subfamily(entries,fontstyle,fontfamily)
+ if subfamily then
+ entries = subfamily
+ else
+ entries = m_style_weight(entries,fontstyle)
if entries then
- entries = m_style_variant(entries,fontstyle)
- if entries and #entries > 1 and designsize == "default" then
- entries = m_style_width(entries,fontstyle)
+ entries = m_style_style(entries,fontstyle)
+ if entries then
+ entries = m_style_variant(entries,fontstyle)
+ if entries and #entries > 1 and designsize == "default" then
+ entries = m_style_width(entries,fontstyle)
+ end
end
end
end
@@ -923,4 +941,4 @@ implement {
name = "definefontfamilypreset",
actions = selectfont.definefontfamilypreset,
arguments = { "string", "string" }
-}
+} \ No newline at end of file