summaryrefslogtreecommitdiff
path: root/macros/luatex/generic/luaotfload/luaotfload-embolden.lua
blob: 8d512499764a661a4a1bda2dbce4941e8dc54b54 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
-----------------------------------------------------------------------
--         FILE:  luaotfload-embolden.lua
--  DESCRIPTION:  part of luaotfload / embolden
-----------------------------------------------------------------------

local ProvidesLuaModule = { 
    name          = "luaotfload-embolden",
    version       = "3.1",       --TAGVERSION
    date          = "2019-11-04", --TAGDATE
    description   = "luaotfload submodule / color",
    license       = "GPL v2.0",
    author        = "Marcel Krüger"
}

if luatexbase and luatexbase.provides_module then
  luatexbase.provides_module (ProvidesLuaModule)
end  

local otffeatures        = fonts.constructors.newfeatures "otf"

local function setembolden(tfmdata, factor)
  tfmdata.embolden = factor
end

local function enableembolden(tfmdata)
  tfmdata.mode, tfmdata.width = 2, tfmdata.size*tfmdata.unscaled.embolden/6578.176
end

otffeatures.register {
  name        = "embolden",
  description = "embolden",
  initializers = {
    base = setembolden,
    node = setembolden,
  },
  manipulators = {
    base = enableembolden,
    node = enableembolden,
  }
}

--- vim:sw=2:ts=2:expandtab:tw=71