diff options
author | Hans Hagen <pragma@wxs.nl> | 2013-08-08 18:39:00 +0200 |
---|---|---|
committer | Hans Hagen <pragma@wxs.nl> | 2013-08-08 18:39:00 +0200 |
commit | b7c9a60459b89987576c3aba5b5c9e476275cd7d (patch) | |
tree | bce23153c6680f83a84cb0d53ef4a68dd4260bc5 | |
parent | f6db6e1eedd11bd472f4e8f3d2e44c1c57794a02 (diff) | |
download | context-b7c9a60459b89987576c3aba5b5c9e476275cd7d.tar.gz |
beta 2013.08.08 18:39
-rw-r--r-- | tex/context/base/font-col.lua | 33 | ||||
-rw-r--r-- | tex/context/base/font-con.lua | 1 | ||||
-rw-r--r-- | tex/context/base/font-ctx.lua | 9 | ||||
-rw-r--r-- | tex/context/base/font-odv.lua | 162 | ||||
-rw-r--r-- | tex/context/base/font-pre.mkiv | 8 | ||||
-rw-r--r-- | tex/context/base/math-act.lua | 94 | ||||
-rw-r--r-- | tex/context/base/math-fbk.lua | 55 | ||||
-rw-r--r-- | tex/context/base/math-vfu.lua | 9 | ||||
-rw-r--r-- | tex/context/base/s-math-coverage.lua | 2 | ||||
-rw-r--r-- | tex/context/base/status-files.pdf | bin | 24696 -> 24737 bytes | |||
-rw-r--r-- | tex/context/base/type-imp-euler.mkiv | 56 | ||||
-rw-r--r-- | tex/context/base/type-set.mkiv | 3 | ||||
-rw-r--r-- | tex/generic/context/luatex/luatex-fonts-merged.lua | 3 |
13 files changed, 316 insertions, 119 deletions
diff --git a/tex/context/base/font-col.lua b/tex/context/base/font-col.lua index d461d60b4..853e0f56c 100644 --- a/tex/context/base/font-col.lua +++ b/tex/context/base/font-col.lua @@ -20,7 +20,7 @@ local traverse_id = nodes.traverse_id local settings_to_hash = utilities.parsers.settings_to_hash -local trace_collecting = false trackers.register("fonts.collecting", function(v) trace_collecting = v end) +local trace_collecting = false trackers.register("fonts.collecting", function(v) trace_collecting = v end) local report_fonts = logs.reporter("fonts","collections") @@ -43,7 +43,22 @@ local list = { } local current = 0 local enabled = false --- maybe also a copy +local function checkenabled() + -- a bit ugly but nicer than a fuzzy state while defining math + if next(vectors) then + if not enabled then + nodes.tasks.enableaction("processors","fonts.collections.process") + enabled = true + end + else + if enabled then + nodes.tasks.disableaction("processors","fonts.collections.process") + enabled = false + end + end +end + +collections.checkenabled = checkenabled function collections.reset(name,font) if font and font ~= "" then @@ -149,10 +164,7 @@ function collections.clonevector(name) if trace_collecting then report_fonts("activating collection %a for font %a",name,current) end - if not enabled then - nodes.tasks.enableaction("processors","fonts.collections.process") - enabled = true - end + checkenabled() statistics.stoptiming(fonts) end @@ -163,11 +175,14 @@ end -- -- if lpegmatch(okay,name) then -function collections.prepare(name) +function collections.prepare(name) -- we can do this in lua now current = currentfont() if vectors[current] then return end + if fontdata[current].mathparameters then + return + end local d = definitions[name] if d then if trace_collecting then @@ -213,13 +228,13 @@ function collections.process(head) -- this way we keep feature processing if type(id) == "table" then local newid, newchar = id[1], id[2] if trace_collecting then - report_fonts("remapping character %a in font %a to character %a in font %a",n.char,n.font,newchar,newid) + report_fonts("remapping character %C in font %a to character %C in font %a",getchar(n),getfont(n),newchar,newid) end n.font = newid n.char = newchar else if trace_collecting then - report_fonts("remapping font %a to %a for character %a",n.font,id,n.char) + report_fonts("remapping font %a to %a for character %C",getfont(n),id,getchar(n)) end n.font = id end diff --git a/tex/context/base/font-con.lua b/tex/context/base/font-con.lua index 6a466a027..091058075 100644 --- a/tex/context/base/font-con.lua +++ b/tex/context/base/font-con.lua @@ -307,6 +307,7 @@ function constructors.scale(tfmdata,specification) if tonumber(specification) then specification = { size = specification } end + target.specification = specification -- local scaledpoints = specification.size local relativeid = specification.relativeid diff --git a/tex/context/base/font-ctx.lua b/tex/context/base/font-ctx.lua index 7388a49ca..229915fb8 100644 --- a/tex/context/base/font-ctx.lua +++ b/tex/context/base/font-ctx.lua @@ -1003,6 +1003,7 @@ function commands.definefont_two(global,cs,str,size,inheritancemode,classfeature -- characters[0x2007] = { width = characters[0x0030] and characters[0x0030].width or parameters.space } -- figure -- characters[0x2008] = { width = characters[0x002E] and characters[0x002E].width or parameters.space } -- period -- + constructors.checkvirtualids(tfmdata) -- experiment, will become obsolete when slots can selfreference local id = font.define(tfmdata) csnames[id] = specification.cs tfmdata.properties.id = id @@ -1085,6 +1086,7 @@ function definers.define(specification) end return tfmdata, fontdata[tfmdata] else + constructors.checkvirtualids(tfmdata) -- experiment, will become obsolete when slots can selfreference local id = font.define(tfmdata) tfmdata.properties.id = id definers.register(tfmdata,id) @@ -1613,8 +1615,11 @@ function constructors.checkvirtualids(tfmdata) local selfid = font.nextid() if fonts and #fonts > 0 then for i=1,#fonts do - if fonts[i][2] == 0 then - fonts[i][2] = selfid + local fi = fonts[i] + if fi[2] == 0 then + fi[2] = selfid + elseif fi.id == 0 then + fi.id = selfid end end else diff --git a/tex/context/base/font-odv.lua b/tex/context/base/font-odv.lua index b518fb79c..0abb3be4c 100644 --- a/tex/context/base/font-odv.lua +++ b/tex/context/base/font-odv.lua @@ -131,6 +131,7 @@ local s_pstf = states.pstf -- code points. local consonant = { + -- devanagari [0x0915] = true, [0x0916] = true, [0x0917] = true, [0x0918] = true, [0x0919] = true, [0x091A] = true, [0x091B] = true, [0x091C] = true, [0x091D] = true, [0x091E] = true, [0x091F] = true, [0x0920] = true, @@ -143,9 +144,22 @@ local consonant = { [0x0939] = true, [0x0958] = true, [0x0959] = true, [0x095A] = true, [0x095B] = true, [0x095C] = true, [0x095D] = true, [0x095E] = true, [0x095F] = true, [0x0979] = true, [0x097A] = true, + -- kannada: + [0x0C95] = true, [0x0C96] = true, [0x0C97] = true, [0x0C98] = true, + [0x0C99] = true, [0x0C9A] = true, [0x0C9B] = true, [0x0C9C] = true, + [0x0C9D] = true, [0x0C9E] = true, [0x0C9F] = true, [0x0CA0] = true, + [0x0CA1] = true, [0x0CA2] = true, [0x0CA3] = true, [0x0CA4] = true, + [0x0CA5] = true, [0x0CA6] = true, [0x0CA7] = true, [0x0CA8] = true, + [0x0CA9] = true, [0x0CAA] = true, [0x0CAB] = true, [0x0CAC] = true, + [0x0CAD] = true, [0x0CAE] = true, [0x0CAF] = true, [0x0CB0] = true, + [0x0CB1] = true, [0x0CB2] = true, [0x0CB3] = true, [0x0CB4] = true, + [0x0CB5] = true, [0x0CB6] = true, [0x0CB7] = true, [0x0CB8] = true, + [0x0CB9] = true, + [0x0CDE] = true, -- obsolete } local independent_vowel = { + -- devanagari [0x0904] = true, [0x0905] = true, [0x0906] = true, [0x0907] = true, [0x0908] = true, [0x0909] = true, [0x090A] = true, [0x090B] = true, [0x090C] = true, [0x090D] = true, [0x090E] = true, [0x090F] = true, @@ -153,20 +167,32 @@ local independent_vowel = { [0x0914] = true, [0x0960] = true, [0x0961] = true, [0x0972] = true, [0x0973] = true, [0x0974] = true, [0x0975] = true, [0x0976] = true, [0x0977] = true, + -- kannada: + [0x0C85] = true, [0x0C86] = true, [0x0C87] = true, [0x0C88] = true, + [0x0C89] = true, [0x0C8A] = true, [0x0C8B] = true, [0x0C8C] = true, + [0x0C8D] = true, [0x0C8E] = true, [0x0C8F] = true, [0x0C90] = true, + [0x0C91] = true, [0x0C92] = true, [0x0C93] = true, [0x0C94] = true, } local dependent_vowel = { -- matra + -- devanagari [0x093A] = true, [0x093B] = true, [0x093E] = true, [0x093F] = true, [0x0940] = true, [0x0941] = true, [0x0942] = true, [0x0943] = true, [0x0944] = true, [0x0945] = true, [0x0946] = true, [0x0947] = true, [0x0948] = true, [0x0949] = true, [0x094A] = true, [0x094B] = true, [0x094C] = true, [0x094E] = true, [0x094F] = true, [0x0955] = true, [0x0956] = true, [0x0957] = true, [0x0962] = true, [0x0963] = true, + -- kannada: + [0x0CBE] = true, [0x0CBF] = true, [0x0CC0] = true, [0x0CC1] = true, + [0x0CC2] = true, [0x0CC3] = true, [0x0CC4] = true, [0x0CC5] = true, + [0x0CC6] = true, [0x0CC7] = true, [0x0CC8] = true, [0x0CC9] = true, + [0x0CCA] = true, [0x0CCB] = true, [0x0CCC] = true, } local vowel_modifier = { + -- devanagari [0x0900] = true, [0x0901] = true, [0x0902] = true, [0x0903] = true, - -- A8E0 - A8F1 are cantillation marks for the Samaveda and may not belong here. + -- A8E0 - A8F1 are cantillation marks for the Samaveda and may not belong here. [0xA8E0] = true, [0xA8E1] = true, [0xA8E2] = true, [0xA8E3] = true, [0xA8E4] = true, [0xA8E5] = true, [0xA8E6] = true, [0xA8E7] = true, [0xA8E8] = true, [0xA8E9] = true, [0xA8EA] = true, [0xA8EB] = true, @@ -178,8 +204,20 @@ local stress_tone_mark = { [0x0951] = true, [0x0952] = true, [0x0953] = true, [0x0954] = true, } -local c_nukta = 0x093C -- used to be tables -local c_halant = 0x094D -- used to be tables +local nukta = { + -- devanagari + [0x093C] = true, + -- kannada: + [0x0CBC] = true, +} + +local halant = { + -- devanagari + [0x094D] = true, + -- kannada: + [0x0CCD] = true, +} + local c_ra = 0x0930 -- used to be tables local c_anudatta = 0x0952 -- used to be tables local c_nbsp = 0x00A0 -- used to be tables @@ -191,6 +229,19 @@ local zw_char = { -- could also be inlined [0x200D] = true, } +-- 0C82 anusvara +-- 0C83 visarga +-- 0CBD avagraha +-- 0CD5 length mark +-- 0CD6 ai length mark +-- 0CE0 letter ll +-- 0CE1 letter rr +-- 0CE2 vowel sign l +-- 0CE2 vowel sign ll +-- 0CF1 sign +-- 0CF2 sign +-- OCE6 - OCEF digits + local pre_mark = { [0x093F] = true, [0x094E] = true, } @@ -232,10 +283,11 @@ for k, v in next, below_mark do mark_above_below_post[k] = below_mark end for k, v in next, post_mark do mark_above_below_post[k] = post_mark end -- Again, this table can be extended for other scripts than devanagari. Actually, --- for ConTeXt this kind of dat is kept elsewhere so eventually we might move +-- for ConTeXt this kind of data is kept elsewhere so eventually we might move -- tables to someplace else. local reorder_class = { + -- devanagari [0x0930] = "before postscript", [0x093F] = "before half", [0x0940] = "after subscript", @@ -254,6 +306,20 @@ local reorder_class = { [0x0962] = "after subscript", [0x0963] = "after subscript", [0x093E] = "after subscript", + -- kannada: + [0x0CB0] = "after postscript", -- todo in code below + [0x0CBF] = "before subscript", -- todo in code below + [0x0CC6] = "before subscript", -- todo in code below + [0x0CCC] = "before subscript", -- todo in code below + [0x0CBE] = "before subscript", -- todo in code below + [0x0CE2] = "before subscript", -- todo in code below + [0x0CE3] = "before subscript", -- todo in code below + [0x0CC1] = "before subscript", -- todo in code below + [0x0CC2] = "before subscript", -- todo in code below + [0x0CC3] = "after subscript", + [0x0CC4] = "after subscript", + [0x0CD5] = "after subscript", + [0x0CD6] = "after subscript", } -- We use some pseudo features as we need to manipulate the nodelist based @@ -468,7 +534,7 @@ local function deva_reorder(head,start,stop,font,attr) local lastcons = nil local basefound = false - if start.char == c_ra and n.char == c_halant and reph then + if start.char == c_ra and halant[n.char] and reph then -- if syllable starts with Ra + H and script has 'Reph' then exclude Reph -- from candidates for base consonants if n == stop then @@ -493,13 +559,13 @@ local function deva_reorder(head,start,stop,font,attr) base, firstcons, lastcons = current, current, current current = current.next if current ~= stop then - if current.char == c_nukta then + if nukta[current.char] then current = current.next end if current.char == c_zwj then if current ~= stop then local next = current.next - if next ~= stop and next.char == c_halant then + if next ~= stop and halant[next.char] then current = next next = current.next local tmp = next.next @@ -559,14 +625,14 @@ local function deva_reorder(head,start,stop,font,attr) -- if base consonant is not last one then move halant from base consonant to last one local np = base local n = base.next - if n.char == c_nukta then + if nukta[n.char] then np = n n = n.next end - if n.char == c_halant then + if halant[n.char] then if lastcons ~= stop then local ln = lastcons.next - if ln.char == c_nukta then + if nukta[ln.char] then lastcons = ln end end @@ -588,7 +654,7 @@ local function deva_reorder(head,start,stop,font,attr) end n = start.next - if start.char == c_ra and n.char == c_halant and not (n ~= stop and zw_char[n.next.char]) then + if start.char == c_ra and halant[n.char] and not (n ~= stop and zw_char[n.next.char]) then -- if syllable starts with Ra + H then move this combination so that it follows either: -- the post-base 'matra' (if any) or the base consonant local matra = base @@ -625,7 +691,7 @@ local function deva_reorder(head,start,stop,font,attr) local current = start while current ~= stop do local next = current.next - if next ~= stop and next.char == c_halant and next.next.char == c_zwnj then + if next ~= stop and halant[next.char] and next.next.char == c_zwnj then current[a_state] = unsetvalue end current = next @@ -633,7 +699,7 @@ local function deva_reorder(head,start,stop,font,attr) if base ~= stop and base[a_state] then local next = base.next - if next.char == c_halant and not (next ~= stop and next.next.char == c_zwj) then + if halant[next.char] and not (next ~= stop and next.next.char == c_zwj) then base[a_state] = unsetvalue end end @@ -645,7 +711,7 @@ local function deva_reorder(head,start,stop,font,attr) local current, allreordered, moved = start, false, { [base] = true } local a, b, p, bn = base, base, base, base.next - if base ~= stop and bn.char == c_nukta then + if base ~= stop and nukta[bn.char] then a, b, p = bn, bn, bn end while not allreordered do @@ -654,12 +720,12 @@ local function deva_reorder(head,start,stop,font,attr) local n = current.next local l = nil -- used ? if c ~= stop then - if n.char == c_nukta then + if nukta[n.char] then c = n n = n.next end if c ~= stop then - if n.char == c_halant then + if halant[n.char] then c = n n = n.next end @@ -719,7 +785,7 @@ local function deva_reorder(head,start,stop,font,attr) while current ~= stop do local c = current local n = current.next - if current.char == c_ra and n.char == c_halant then + if current.char == c_ra and halant[n.char] then c = n n = n.next local b, bn = base, base @@ -785,7 +851,7 @@ local function deva_reorder(head,start,stop,font,attr) if consonant[char] or char == c_nbsp then -- maybe combined hash cns = current local next = cns.next - if next.char == c_halant then + if halant[next.char] then cns = next end end @@ -818,7 +884,7 @@ function handlers.devanagari_reorder_matras(head,start,kind,lookupname,replaceme -- can be fast loop while current and current.id == glyph_code and current.subtype<256 and current.font == font and current[a_syllabe] == startattr do local next = current.next - if current.char == c_halant and not current[a_state] then + if halant[current.char] and not current[a_state] then if next and next.id == glyph_code and next.subtype<256 and next.font == font and next[a_syllabe] == startattr and zw_char[next.char] then current = next end @@ -872,7 +938,7 @@ function handlers.devanagari_reorder_reph(head,start,kind,lookupname,replacement local startfont = start.font local startattr = start[a_syllabe] while current and current.id == glyph_code and current.subtype<256 and current.font == startfont and current[a_syllabe] == startattr do --step 2 - if current.char == c_halant and not current[a_state] then + if halant[current.char] and not current[a_state] then local next = current.next if next and next.id == glyph_code and next.subtype<256 and next.font == startfont and next[a_syllabe] == startattr and zw_char[next.char] then current = next @@ -985,7 +1051,7 @@ function handlers.devanagari_reorder_pre_base_reordering_consonants(head,start,k -- can be fast for loop + caching state while current and current.id == glyph_code and current.subtype<256 and current.font == startfont and current[a_syllabe] == startattr do local next = current.next - if current.char == c_halant and not current[a_state] then + if halant[current.char] and not current[a_state] then if next and next.id == glyph_code and next.subtype<256 and next.font == font and next[a_syllabe] == startattr then local char = next.char if char == c_zwnj or char == c_zwj then @@ -1287,13 +1353,13 @@ local function dev2_reorder(head,start,stop,font,attr) -- maybe do a pass over ( current = current.next if current ~= stop then local char = current.char - if char == c_nukta then + if nukta[char] then current = current.next char = current.char end if char == c_zwj then local next = current.next - if current ~= stop and next ~= stop and next.char == c_halant then + if current ~= stop and next ~= stop and halant[next.char] then current = next next = current.next local tmp = next.next @@ -1306,7 +1372,7 @@ local function dev2_reorder(head,start,stop,font,attr) -- maybe do a pass over ( current[a_state] = s_pstf current = processcharacters(current) current[a_state] = unsetvalue - if current.char == c_halant then + if halant[current.char] then current.next.next = tmp local nc = copy_node(current) current.char = dotted_circle @@ -1326,7 +1392,7 @@ local function dev2_reorder(head,start,stop,font,attr) -- maybe do a pass over ( while current ~= last do -- find base consonant local next = current.next if consonant[current.char] then - if not (current ~= stop and next ~= stop and next.char == c_halant and next.next.char == c_zwj) then + if not (current ~= stop and next ~= stop and halant[next.char] and next.next.char == c_zwj) then if not firstcons then firstcons = current end @@ -1450,7 +1516,7 @@ local function dev2_reorder(head,start,stop,font,attr) -- maybe do a pass over ( local current, c = start, nil while current ~= stop do local char = current.char - if char == c_halant or stress_tone_mark[char] then + if halant[char] or stress_tone_mark[char] then if not c then c = current end @@ -1458,7 +1524,7 @@ local function dev2_reorder(head,start,stop,font,attr) -- maybe do a pass over ( c = nil end local next = current.next - if c and next.char == c_nukta then + if c and nukta[next.char] then if head == c then head = next end @@ -1501,8 +1567,8 @@ imerge(separator,dependent_vowel) imerge(separator,vowel_modifier) imerge(separator,stress_tone_mark) -separator[0x093C] = true -- nukta -separator[0x094D] = true -- halant +for k, v in next, nukta do separator[k] = true end +for k, v in next, halant do separator[k] = true end local function analyze_next_chars_one(c,font,variant) -- skip one dependent vowel -- why two variants ... the comment suggests that it's the same ruleset @@ -1512,7 +1578,7 @@ local function analyze_next_chars_one(c,font,variant) -- skip one dependent vowe end if variant == 1 then local v = n.id == glyph_code and n.subtype<256 and n.font == font - if v and n.char == c_nukta then + if v and nukta[n.char] then n = n.next if n then v = n.id == glyph_code and n.subtype<256 and n.font == font @@ -1527,7 +1593,7 @@ local function analyze_next_chars_one(c,font,variant) -- skip one dependent vowe local nnnc = nnn.char if nnc == c_zwj and consonant[nnnc] then c = nnn - elseif (nnc == c_zwnj or nnc == c_zwj) and nnnc == c_halant then + elseif (nnc == c_zwnj or nnc == c_zwj) and halant[nnnc] then local nnnn = nnn.next if nnnn and nnnn.id == glyph_code and consonant[nnnn.char] and nnnn.subtype<256 and nnnn.font == font then c = nnnn @@ -1537,7 +1603,7 @@ local function analyze_next_chars_one(c,font,variant) -- skip one dependent vowe end end elseif variant == 2 then - if n.id == glyph_code and n.char == c_nukta and n.subtype<256 and n.font == font then + if n.id == glyph_code and nukta[n.char] and n.subtype<256 and n.font == font then c = n end n = c.next @@ -1550,7 +1616,7 @@ local function analyze_next_chars_one(c,font,variant) -- skip one dependent vowe nn = nn.next nv = nn.id == glyph_code and nn.subtype<256 and nn.font == font end - if nn and nv and n.char == c_halant and consonant[nn.char] then + if nn and nv and halant[n.char] and consonant[nn.char] then c = nn end end @@ -1578,7 +1644,7 @@ local function analyze_next_chars_one(c,font,variant) -- skip one dependent vowe end char = n.char end - if char == c_nukta then + if nukta[char] then c = c.next n = c.next if not n then @@ -1590,7 +1656,7 @@ local function analyze_next_chars_one(c,font,variant) -- skip one dependent vowe end char = n.char end - if char == c_halant then + if halant[char] then c = c.next n = c.next if not n then @@ -1638,7 +1704,7 @@ local function analyze_next_chars_two(c,font) if not n then return c end - if n.id == glyph_code and n.char == c_nukta and n.subtype<256 and n.font == font then + if n.id == glyph_code and nukta[n.char] and n.subtype<256 and n.font == font then c = n end n = c @@ -1646,7 +1712,7 @@ local function analyze_next_chars_two(c,font) local nn = n.next if nn and nn.id == glyph_code and nn.subtype<256 and nn.font == font then local char = nn.char - if char == c_halant then + if halant[char] then n = nn local nnn = nn.next if nnn and nnn.id == glyph_code and zw_char[nnn.char] and nnn.subtype<256 and nnn.font == font then @@ -1655,7 +1721,7 @@ local function analyze_next_chars_two(c,font) elseif char == c_zwnj or char == c_zwj then -- n = nn -- not here (?) local nnn = nn.next - if nnn and nnn.id == glyph_code and nnn.char == c_halant and nnn.subtype<256 and nnn.font == font then + if nnn and nnn.id == glyph_code and halant[nnn.char] and nnn.subtype<256 and nnn.font == font then n = nnn end else @@ -1665,7 +1731,7 @@ local function analyze_next_chars_two(c,font) if nn and nn.id == glyph_code and consonant[nn.char] and nn.subtype<256 and nn.font == font then n = nn local nnn = nn.next - if nnn and nnn.id == glyph_code and nnn.char == c_nukta and nnn.subtype<256 and nnn.font == font then + if nnn and nnn.id == glyph_code and nukta[nnn.char] and nnn.subtype<256 and nnn.font == font then n = nnn end c = n @@ -1702,7 +1768,7 @@ local function analyze_next_chars_two(c,font) end char = n.char end - if char == c_halant then + if halant[char] then c = c.next n = c.next if not n then @@ -1740,7 +1806,7 @@ local function analyze_next_chars_two(c,font) end char = n.char end - if char == c_nukta then + if nukta[char] then c = c.next n = c.next if not n then @@ -1752,7 +1818,7 @@ local function analyze_next_chars_two(c,font) end char = n.char end - if char == c_halant then + if halant[char] then c = c.next n = c.next if not n then @@ -1819,7 +1885,7 @@ function methods.deva(head,font,attr) local syllableend = nil local c = current local n = c.next - if n and c.char == c_ra and n.id == glyph_code and n.char == c_halant and n.subtype<256 and n.font == font then + if n and c.char == c_ra and n.id == glyph_code and halant[n.char] and n.subtype<256 and n.font == font then local n = n.next if n and n.id == glyph_code and n.subtype<256 and n.font == font then c = n @@ -1864,7 +1930,7 @@ function methods.deva(head,font,attr) break end local c = n.char - if c == c_nukta then + if nukta[c] then n = n.next if not n then break @@ -1875,7 +1941,7 @@ function methods.deva(head,font,attr) end c = n.char end - if c == c_halant then + if halant[c] then n = n.next if not n then break @@ -1903,7 +1969,7 @@ function methods.deva(head,font,attr) end end local n = current.next - if n and n.id == glyph_code and n.char == c_nukta and n.subtype<256 and n.font == font then + if n and n.id == glyph_code and nukta[n.char] and n.subtype<256 and n.font == font then -- nukta (not specified in Microsft Devanagari OpenType specification) current = n n = current.next @@ -1913,7 +1979,7 @@ function methods.deva(head,font,attr) if current then local v = current.id == glyph_code and current.subtype<256 and current.font == font if v then - if current.char == c_halant then + if halant[current.char] then -- syllable containing consonant without vowels: {C + [Nukta] + H} + C + H local n = current.next if n and n.id == glyph_code and zw_char[n.char] and n.subtype<256 and n.font == font then @@ -2010,7 +2076,7 @@ function methods.dev2(head,font,attr) syllablestart = current local c = current local n = current.next - if n and c.char == c_ra and n.id == glyph_code and n.char == c_halant and n.subtype<256 and n.font == font then + if n and c.char == c_ra and n.id == glyph_code and halant[n.char] and n.subtype<256 and n.font == font then local n = n.next if n and n.id == glyph_code and n.subtype<256 and n.font == font then c = n diff --git a/tex/context/base/font-pre.mkiv b/tex/context/base/font-pre.mkiv index 919a40805..4ee410140 100644 --- a/tex/context/base/font-pre.mkiv +++ b/tex/context/base/font-pre.mkiv @@ -212,6 +212,14 @@ [expansion=quality, protrusion=quality] +\definefontfeature + [slanted] + [slant=.2] + +\definefontfeature + [boldened] + [extend=1.2] + %D We define some colors that are used in tracing (for instance \OPENTYPE\ %D features). We cannot yet inherit because no colors are predefined. diff --git a/tex/context/base/math-act.lua b/tex/context/base/math-act.lua index 84549ca52..8cc2c20cc 100644 --- a/tex/context/base/math-act.lua +++ b/tex/context/base/math-act.lua @@ -12,18 +12,22 @@ local type, next = type, next local fastcopy = table.fastcopy local formatters = string.formatters -local trace_defining = false trackers.register("math.defining", function(v) trace_defining = v end) -local report_math = logs.reporter("mathematics","initializing") +local trace_defining = false trackers.register("math.defining", function(v) trace_defining = v end) +local trace_collecting = false trackers.register("math.collecting", function(v) trace_collecting = v end) -local context = context -local commands = commands -local mathematics = mathematics -local texsetdimen = tex.setdimen -local abs = math.abs +local report_math = logs.reporter("mathematics","initializing") -local sequencers = utilities.sequencers -local appendgroup = sequencers.appendgroup -local appendaction = sequencers.appendaction +local context = context +local commands = commands +local mathematics = mathematics +local texsetdimen = tex.setdimen +local abs = math.abs + +local sequencers = utilities.sequencers +local appendgroup = sequencers.appendgroup +local appendaction = sequencers.appendaction + +local fontchars = fonts.hashes.characters local mathfontparameteractions = sequencers.new { name = "mathparameters", @@ -505,3 +509,73 @@ function commands.horizontalcode(family,unicode) texsetdimen("scratchrightoffset",roffset) context(kind) end + +-- experiment + +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 id = definedfont { name = name, size = size } + local index = #fonts + 1 + fonts[index] = { id = id, size = size } + local first = definition.first or definition.start or definition.code + local last = definition.last or definition.stop or first + if first then + local chars = fontchars[id] + local check = toboolean(definition.check or "false",true) + local force = toboolean(definition.force or "true",true) + -- check: when true, only set when present in font + -- force: when false, then not set when already set + if check then + for unicode = first, last do + if chars[unicode] then + -- not in font + elseif force or (not done[unicode] and not characters[unicode]) then + if trace_collecting then + report_math("remapping math character, vector %a, font %a, character %C, %s",fallbacks,name,unicode,"checked") + end + characters[unicode] = copiedglyph(target,characters,chars,unicode,index) + done[unicode] = true + end + end + else + for unicode = first, last do + if force or (not done[unicode] and not characters[unicode]) then + if trace_collecting then + report_math("remapping math character, vector %a, font %a, character %C, %s",fallbacks,name,unicode,"unchecked") + end + characters[unicode] = copiedglyph(target,characters,chars,unicode,index) + done[unicode] = true + end + end + end + end + end + end + end + end +end + +sequencers.appendaction("aftercopyingcharacters", "system","mathematics.injectfallbacks") diff --git a/tex/context/base/math-fbk.lua b/tex/context/base/math-fbk.lua index 96f7be81b..d8eacfb4e 100644 --- a/tex/context/base/math-fbk.lua +++ b/tex/context/base/math-fbk.lua @@ -318,7 +318,7 @@ local function accent_to_extensible(target,newchr,original,oldchr,height,depth,s local characters = target.characters local addprivate = fonts.helpers.addprivate local olddata = characters[oldchr] - if olddata then + if olddata and not olddata.commands then if swap then swap = characters[swap] height = swap.depth @@ -338,21 +338,26 @@ local function accent_to_extensible(target,newchr,original,oldchr,height,depth,s local nextglyph = olddata.next while nextglyph do local oldnextdata = characters[nextglyph] - local newnextdata = { - commands = { correction, { "slot", 1, nextglyph } }, - width = oldnextdata.width, - height = height, - depth = depth, - } - local newnextglyph = addprivate(target,formatters["original-%H"](nextglyph),newnextdata) - newdata.next = newnextglyph - local nextnextglyph = oldnextdata.next - if nextnextglyph == nextglyph then - break + if oldnextdata then + local newnextdata = { + commands = { correction, { "slot", 1, nextglyph } }, + width = oldnextdata.width, + height = height, + depth = depth, + } + local newnextglyph = addprivate(target,formatters["M-N-%H"](nextglyph),newnextdata) + newdata.next = newnextglyph + local nextnextglyph = oldnextdata.next + if nextnextglyph == nextglyph then + break + else + olddata = oldnextdata + newdata = newnextdata + nextglyph = nextnextglyph + end else - olddata = oldnextdata - newdata = newnextdata - nextglyph = nextnextglyph + report_fallbacks("error in fallback: no valid next, slot %X",nextglyph) + break end end local hv = olddata.horiz_variants @@ -363,16 +368,22 @@ local function accent_to_extensible(target,newchr,original,oldchr,height,depth,s local hvi = hv[i] local oldglyph = hvi.glyph local olddata = characters[oldglyph] - local newdata = { - commands = { correction, { "slot", 1, oldglyph } }, - width = olddata.width, - height = height, - depth = depth, - } - hvi.glyph = addprivate(target,formatters["original-%H"](oldglyph),newdata) + if olddata then + local newdata = { + commands = { correction, { "slot", 1, oldglyph } }, + width = olddata.width, + height = height, + depth = depth, + } + hvi.glyph = addprivate(target,formatters["M-H-%H"](oldglyph),newdata) + else + report_fallbacks("error in fallback: no valid horiz_variants, slot %X, index %i",oldglyph,i) + end end end return glyphdata + else + return olddata end end diff --git a/tex/context/base/math-vfu.lua b/tex/context/base/math-vfu.lua index cd30ad6b9..6d9a9f903 100644 --- a/tex/context/base/math-vfu.lua +++ b/tex/context/base/math-vfu.lua @@ -605,8 +605,9 @@ local function copy_glyph(main,target,original,unicode,slot) height = oldnextdata.height, depth = oldnextdata.depth, } - local newnextglyph = addprivate(main,formatters["original-%H"](nextglyph),newnextdata) + local newnextglyph = addprivate(main,formatters["M-N-%H"](nextglyph),newnextdata) newdata.next = newnextglyph +-- report_virtual("copied next: %X",newdata.next) local nextnextglyph = oldnextdata.next if nextnextglyph == nextglyph then break @@ -630,7 +631,8 @@ local function copy_glyph(main,target,original,unicode,slot) height = olddata.height, depth = olddata.depth, } - hvi.glyph = addprivate(main,formatters["original-%H"](oldglyph),newdata) + hvi.glyph = addprivate(main,formatters["M-H-%H"](oldglyph),newdata) +-- report_virtual("copied h variant: %X at index %i",hvi.glyph,i) end end local vv = olddata.vert_variants @@ -647,7 +649,8 @@ local function copy_glyph(main,target,original,unicode,slot) height = olddata.height, depth = olddata.depth, } - vvi.glyph = addprivate(main,formatters["original-%H"](oldglyph),newdata) + vvi.glyph = addprivate(main,formatters["M-V-%H"](oldglyph),newdata) +-- report_virtual("copied v variant: %X at index %i",vvi.glyph,i) end end return newdata diff --git a/tex/context/base/s-math-coverage.lua b/tex/context/base/s-math-coverage.lua index 258019c9d..a74e24450 100644 --- a/tex/context/base/s-math-coverage.lua +++ b/tex/context/base/s-math-coverage.lua @@ -77,6 +77,8 @@ local chardata = characters.data local superscripts = characters.superscripts local subscripts = characters.subscripts +context.writestatus("math coverage","underline: not remapped") + function moduledata.math.coverage.showalphabets() context.starttabulate { "|lT|l|Tl|" } for i=1,#styles do diff --git a/tex/context/base/status-files.pdf b/tex/context/base/status-files.pdf Binary files differindex 1587afc41..bf95142de 100644 --- a/tex/context/base/status-files.pdf +++ b/tex/context/base/status-files.pdf diff --git a/tex/context/base/type-imp-euler.mkiv b/tex/context/base/type-imp-euler.mkiv index fc938dea3..34f04634e 100644 --- a/tex/context/base/type-imp-euler.mkiv +++ b/tex/context/base/type-imp-euler.mkiv @@ -12,51 +12,59 @@ %C details. \loadtypescriptfile[texgyre] +\loadtypescriptfile[dejavu] -\resetfontfallback [eulernovum] -\definefontfallback [eulernovum] [\s!file:euler.otf] ["0000-"FFFF] [\s!check=\v!yes,\c!force=\v!yes] +\resetfontfallback [euleroverpagella] +\definefontfallback [euleroverpagella] [\s!file:euler.otf] ["0000-"FFFF] [\s!check=\v!yes,\c!force=\v!yes] + +\resetfontfallback [pagellaovereuler] +\definefontfallback [pagellaovereuler] [texgyrepagella-math] ["0000-"FFFF] [\s!check=\v!yes] \starttypescriptcollection[pagella-eulernova] + \starttypescript [\s!serif] [eulernova] [\s!name] + \setups[\s!font:\s!fallback:\s!serif] + \definefontsynonym [\s!Serif] [\s!file:euler.otf] [\s!features=\s!default] + \stoptypescript + \starttypescript [\s!math] [eulernova] [\s!name] \loadfontgoodies[euler-math] \definefontsynonym [MathRoman] [eulermath@euler-nova] [\s!features=\s!math\mathsizesuffix] \stoptypescript - \starttypescript [\s!serif] [eulernovum] [\s!name] - \definefontsynonym [MathRoman] [texgyrepagella-math] [\s!features=\s!math\mathsizesuffix,\s!fallbacks=eulernovum] - \stoptypescript - - \starttypescript [\s!serif] [eulernova,eulernovum] [\s!name] - \setups[\s!font:\s!fallback:\s!serif] - \definefontsynonym [\s!Serif] [\s!file:euler.otf] [\s!features=\s!default] - \stoptypescript - \starttypescript [pagella-eulernova] \definetypeface [\typescriptone] [\s!rm] [\s!serif] [pagella] [\s!default] - \definetypeface [\typescriptone] [\s!tt] [\s!mono] [modern] [\s!default] + \definetypeface [\typescriptone] [\s!tt] [\s!mono] [dejavu] [\s!default] [\s!rscale=0.9] \definetypeface [\typescriptone] [\s!mm] [\s!math] [eulernova] [\s!default] \quittypescriptscanning \stoptypescript - \starttypescript [pagella-eulernovum] - \definetypeface [\typescriptone] [\s!rm] [\s!serif] [pagella] [\s!default] - \definetypeface [\typescriptone] [\s!tt] [\s!mono] [modern] [\s!default] - \definetypeface [\typescriptone] [\s!mm] [\s!math] [eulernovum] [\s!default] - \quittypescriptscanning - \stoptypescript - \starttypescript [eulernova] \definetypeface [\typescriptone] [\s!rm] [\s!serif] [eulernova] [\s!default] - \definetypeface [\typescriptone] [\s!tt] [\s!mono] [modern] [\s!default] + \definetypeface [\typescriptone] [\s!tt] [\s!mono] [dejavu] [\s!default] [\s!rscale=0.9] \definetypeface [\typescriptone] [\s!mm] [\s!math] [eulernova] [\s!default] \quittypescriptscanning \stoptypescript - \starttypescript [eulernovum] - \definetypeface [\typescriptone] [\s!rm] [\s!serif] [eulernovum] [\s!default] - \definetypeface [\typescriptone] [\s!tt] [\s!mono] [modern] [\s!default] - \definetypeface [\typescriptone] [\s!mm] [\s!math] [eulernovum] [\s!default] + \starttypescript [\s!math] [euleroverpagella] [\s!name] + \definefontsynonym [MathRoman] [texgyrepagella-math] [\s!features=\s!math\mathsizesuffix,\s!fallbacks=euleroverpagella] + \stoptypescript + + \starttypescript [\s!math] [pagellaovereuler] [\s!name] + \definefontsynonym [MathRoman] [\s!file:euler.otf] [\s!features=\s!math\mathsizesuffix,\s!fallbacks=pagellaovereuler] + \stoptypescript + + \starttypescript [pagella-with-euler] + \definetypeface [\typescriptone] [\s!rm] [\s!serif] [pagella] [\s!default] + \definetypeface [\typescriptone] [\s!tt] [\s!mono] [dejavu] [\s!default] [\s!rscale=0.9] + \definetypeface [\typescriptone] [\s!mm] [\s!math] [euleroverpagella] [\s!default] + \quittypescriptscanning + \stoptypescript + + \starttypescript [euler-with-pagella] + \definetypeface [\typescriptone] [\s!rm] [\s!serif] [eulernova] [\s!default] + \definetypeface [\typescriptone] [\s!tt] [\s!mono] [dejavu] [\s!default] [\s!rscale=0.9] + \definetypeface [\typescriptone] [\s!mm] [\s!math] [pagellaovereuler] [\s!default] \quittypescriptscanning \stoptypescript diff --git a/tex/context/base/type-set.mkiv b/tex/context/base/type-set.mkiv index a3e54c3f4..43e561722 100644 --- a/tex/context/base/type-set.mkiv +++ b/tex/context/base/type-set.mkiv @@ -98,4 +98,7 @@ \definefilesynonym [type-imp-eulernovum.mkiv] [type-imp-euler.mkiv] \definefilesynonym [type-imp-eulernova.mkiv] [type-imp-euler.mkiv] +\definefilesynonym [type-imp-euler-with-pagella] [type-imp-euler.mkiv] +\definefilesynonym [type-imp-pagella-with-euler] [type-imp-euler.mkiv] + \protect \endinput diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua index f66bc79cd..62a8ec7b3 100644 --- a/tex/generic/context/luatex/luatex-fonts-merged.lua +++ b/tex/generic/context/luatex/luatex-fonts-merged.lua @@ -1,6 +1,6 @@ -- merged file : luatex-fonts-merged.lua -- parent file : luatex-fonts.lua --- merge date : 08/08/13 10:48:04 +-- merge date : 08/08/13 18:39:36 do -- begin closure to overcome local limits and interference @@ -3676,6 +3676,7 @@ function constructors.scale(tfmdata,specification) if tonumber(specification) then specification={ size=specification } end + target.specification=specification local scaledpoints=specification.size local relativeid=specification.relativeid local properties=tfmdata.properties or {} |