summaryrefslogtreecommitdiff
path: root/tex/context/base/math-act.lua
diff options
context:
space:
mode:
authorMarius <mariausol@gmail.com>2013-08-30 03:20:26 +0300
committerMarius <mariausol@gmail.com>2013-08-30 03:20:26 +0300
commitc527fe668029f6e8a71751cca9b88d756c3bc77f (patch)
treecb473094565098ebad7b3f79261327ae8dfce94f /tex/context/base/math-act.lua
parenta35bf56b12f96b1ecc9fd92726a4232b6a966dd3 (diff)
downloadcontext-c527fe668029f6e8a71751cca9b88d756c3bc77f.tar.gz
beta 2013.08.30 02:05
Diffstat (limited to 'tex/context/base/math-act.lua')
-rw-r--r--tex/context/base/math-act.lua112
1 files changed, 59 insertions, 53 deletions
diff --git a/tex/context/base/math-act.lua b/tex/context/base/math-act.lua
index d7b39b4c5..4a26d0192 100644
--- a/tex/context/base/math-act.lua
+++ b/tex/context/base/math-act.lua
@@ -605,62 +605,68 @@ blocks["digitsextendedarabicindic"] = { first = 0x006F0, last = 0x006F
-- todo: tounicode
function mathematics.injectfallbacks(target,original)
- local specification = target.specification
- if specification then
- local fallbacks = specification.fallbacks
- if fallbacks then
- local definitions = fonts.collections.definitions[fallbacks]
- if definitions then
- local definedfont = fonts.definers.internal
- local copiedglyph = fonts.handlers.vf.math.copy_glyph
- local fonts = target.fonts
- local size = specification.size -- target.size
- local characters = target.characters
- if not fonts then
- fonts = { }
- target.fonts = fonts
- target.type = "virtual"
- target.properties.virtualized = true
- end
- if #fonts == 0 then
- fonts[1] = { id = 0, size = size } -- sel, will be resolved later
- end
- local done = { }
- for i=1,#definitions do
- local definition = definitions[i]
- local name = definition.font
- local start = definition.start
- local stop = definition.stop
- local check = definition.check
- local force = definition.force
- local rscale = definition.rscale or 1
- local offset = definition.offset or start
- local id = definedfont { name = name, size = size * rscale }
- local index = #fonts + 1
- fonts[index] = { id = id, size = size }
- local chars = fontchars[id]
- if check then
- for unicode = start, stop do
- local unic = unicode + offset - start
- if not chars[unicode] then
- -- not in font
- elseif force or (not done[unic] and not characters[unic]) then
- if trace_collecting then
- report_math("remapping math character, vector %a, font %a, character %C, %s",fallbacks,name,unic,"checked")
+ local properties = original.properties
+ if properties and properties.hasmath then
+ local specification = target.specification
+ if specification then
+ local fallbacks = specification.fallbacks
+ if fallbacks then
+ local definitions = fonts.collections.definitions[fallbacks]
+ if definitions then
+ if trace_collecting then
+ report_math("adding fallback characters to font %a",specification.hash)
+ end
+ local definedfont = fonts.definers.internal
+ local copiedglyph = fonts.handlers.vf.math.copy_glyph
+ local fonts = target.fonts
+ local size = specification.size -- target.size
+ local characters = target.characters
+ if not fonts then
+ fonts = { }
+ target.fonts = fonts
+ target.type = "virtual"
+ target.properties.virtualized = true
+ end
+ if #fonts == 0 then
+ fonts[1] = { id = 0, size = size } -- sel, will be resolved later
+ end
+ local done = { }
+ for i=1,#definitions do
+ local definition = definitions[i]
+ local name = definition.font
+ local start = definition.start
+ local stop = definition.stop
+ local check = definition.check
+ local force = definition.force
+ local rscale = definition.rscale or 1
+ local offset = definition.offset or start
+ local id = definedfont { name = name, size = size * rscale }
+ local index = #fonts + 1
+ fonts[index] = { id = id, size = size }
+ local chars = fontchars[id]
+ if check then
+ for unicode = start, stop do
+ local unic = unicode + offset - start
+ if not chars[unicode] then
+ -- not in font
+ elseif force or (not done[unic] and not characters[unic]) then
+ if trace_collecting then
+ report_math("remapping math character, vector %a, font %a, character %C, %s",fallbacks,name,unic,"checked")
+ end
+ characters[unic] = copiedglyph(target,characters,chars,unicode,index)
+ done[unic] = true
end
- characters[unic] = copiedglyph(target,characters,chars,unicode,index)
- done[unic] = true
end
- end
- else
- for unicode = start, stop do
- local unic = unicode + offset - start
- if force or (not done[unic] and not characters[unic]) then
- if trace_collecting then
- report_math("remapping math character, vector %a, font %a, character %C, %s",fallbacks,name,unic,"unchecked")
+ else
+ for unicode = start, stop do
+ local unic = unicode + offset - start
+ if force or (not done[unic] and not characters[unic]) then
+ if trace_collecting then
+ report_math("remapping math character, vector %a, font %a, character %C, %s",fallbacks,name,unic,"unchecked")
+ end
+ characters[unic] = copiedglyph(target,characters,chars,unicode,index)
+ done[unic] = true
end
- characters[unic] = copiedglyph(target,characters,chars,unicode,index)
- done[unic] = true
end
end
end