From 0c75a2acf592eb4360685375904440f5e6b8125a Mon Sep 17 00:00:00 2001 From: Hans Hagen Date: Tue, 12 Nov 2019 19:54:50 +0100 Subject: 2019-11-12 18:53:00 --- tex/context/base/mkiv/typo-tal.lua | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) (limited to 'tex/context/base/mkiv/typo-tal.lua') diff --git a/tex/context/base/mkiv/typo-tal.lua b/tex/context/base/mkiv/typo-tal.lua index 8cf298329..ff10fb121 100644 --- a/tex/context/base/mkiv/typo-tal.lua +++ b/tex/context/base/mkiv/typo-tal.lua @@ -205,6 +205,24 @@ function characteralign.handler(head,where) local method = dataset.method -- we can think of constraints if method == v_number then + + local function bothdigit(current) -- this could become a helper + local prev, next = getboth(current) + if next and prev and getid(next) == glyph_code and getid(prev) == glyph_code then + local pchar = getchar(prev) + local nchar = getchar(next) + local pdata = fontcharacters[getfont(prev)][pchar] + local ndata = fontcharacters[getfont(next)][nchar] + local punicode = pdata and pdata.unicode or pchar -- we ignore tables + local nunicode = ndata and ndata.unicode or nchar -- we ignore tables + if punicode and nunicode and categories[punicode] == "nd" and categories[nunicode] == "nd" then + return true + else + return false + end + end + end + while current do local char, id = isglyph(current) if char then @@ -266,10 +284,9 @@ function characteralign.handler(head,where) elseif (b_start or a_start) and id == glue_code then -- maybe only in number mode -- somewhat inefficient - local prev, next = getboth(current) - if next and prev and getid(next) == glyph_code and getid(prev) == glyph_code then -- too much checking + if bothdigit(current) then local width = fontcharacters[getfont(b_start or a_start)][separator or period].width - setglue(current,width) + setglue(current,width,0,0) setattr(current,a_character,punctuationspace) if a_start then a_stop = current -- cgit v1.2.3