From 7341dd5fc63fe026f767b8d95116ff8cc035beed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcel=20Fabian=20Kr=C3=BCger?= Date: Wed, 27 Dec 2023 18:14:46 +0100 Subject: [PATCH] Improve detection --- luamml-convert.lua | 2 +- luamml-tex.lua | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/luamml-convert.lua b/luamml-convert.lua index bdd4684..51996d2 100644 --- a/luamml-convert.lua +++ b/luamml-convert.lua @@ -273,7 +273,7 @@ local function noad_to_table(noad, sub, cur_style, joining, bin_replacements, te end if nucleus == core and #core == 1 then if joining and joining[0] == 'mn' and core[0] == 'mi' and (core[1] == '.' or core[1] == ',') and maybe_to_mn(noad, core) - or core[0] == 'mn' or text_families[core['tex:family']] then + or core[0] == 'mn' or text_families[core['tex:family'] or 0] then if joining and core[0] == joining[0] and core['tex:family'] == joining['tex:family'] then joining[#joining+1] = core[1] local cnodes = core[':nodes'] diff --git a/luamml-tex.lua b/luamml-tex.lua index a399db4..d6cee83 100644 --- a/luamml-tex.lua +++ b/luamml-tex.lua @@ -24,7 +24,7 @@ local text_families_meta = {__index = function(t, fam) -- FIXME(?): If there is no font... error'Please load your fonts?!?' end - assignment = not fontdir.MathConstants + assignment = not (fontdir.MathConstants and next(fontdir.MathConstants)) end t[fam] = assignment return assignment @@ -50,6 +50,9 @@ lua.get_functions_table()[funcid] = function() local mapping = token.scan_string() if mappings[mapping] then register_family(fam, mappings[mapping]) + if global_text_families[fam] == nil then + global_text_families[fam] = false + end else tex.error(string.format('Unknown font mapping %q', mapping)) end