Re: [NTG-context] modifying kerning breaks opentype ligatures (and other features)
On 12/11/2018 15:54, Rik Kabel wrote: On 12/11/2018 07:06, Hans Hagen wrote: On 12/11/2018 11:34 AM, mf wrote: But i should consider all the text parts with a modified kerning and disable kerning around character sequences like "ff", "ffi", "fl" and so on. Luckily, the XHTML markup "knows" where the kerning is modified: A paragraph with a modified kerning should become A paragraph with a modified kerning Where ... (dk=Disable Kerning) are tags to be inserted automatically before feeding the XHTML into ConTeXt. I'm not very happy or proud about it, but it can be done. Do you think it can be better done inside ConTeXt? I nearly managed to do it in ConTeXt, but I can't create the "" elements right (the "new_dk_element" function is wrong): did you play with \definefontfeature[whatever][keepligatures=auto] \definecharacterkerning [extrakerning] [factor=0.125,features=whatever] \starttext \setcharacterkerning[extrakerning] effe fietsen \stoptext Nice! It recognizes the difference between ccmp and liga, so now we have (almost perfect) support for Sperrdruck! There is a ZWNJ in the following example (between t and z inZeitzone) that gets expanded, leaving an enlarged gap. And I spoke too soon (not unusual, I know). The ſi ligature is not broken up, but it should be. Only ck, ct, ch, and ſt and tz should be preserved. So it looks like manual intervention is still required. (There are a few LaTeX packages that handle this well, chief among the microtype.) -- Rik ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___
[NTG-context] repo.or.cz/context.git
Dear list, There is an online browsable repo with the ConTeXt sources at https://repo.or.cz/context.git It seems to be extremely outdated, the latest commit says beta 2014.02.14 17:07. I know that there is an up-to-date mirror at https://github.com/contextgarden/context-mirror but the Wiki links to the one at repo.or.cz. Could you either update the repo.or.cz mirror or adjust the Wiki to link to GitHub please? Cheers, Henri ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___
Re: [NTG-context] modifying kerning breaks opentype ligatures (and other features)
On 12/11/2018 07:06, Hans Hagen wrote: On 12/11/2018 11:34 AM, mf wrote: But i should consider all the text parts with a modified kerning and disable kerning around character sequences like "ff", "ffi", "fl" and so on. Luckily, the XHTML markup "knows" where the kerning is modified: A paragraph with a modified kerning should become A paragraph with a modified kerning Where ... (dk=Disable Kerning) are tags to be inserted automatically before feeding the XHTML into ConTeXt. I'm not very happy or proud about it, but it can be done. Do you think it can be better done inside ConTeXt? I nearly managed to do it in ConTeXt, but I can't create the "" elements right (the "new_dk_element" function is wrong): did you play with \definefontfeature[whatever][keepligatures=auto] \definecharacterkerning [extrakerning] [factor=0.125,features=whatever] \starttext \setcharacterkerning[extrakerning] effe fietsen \stoptext Nice! It recognizes the difference between ccmp and liga, so now we have (almost perfect) support for Sperrdruck! There is a ZWNJ in the following example (between t and z inZeitzone) that gets expanded, leaving an enlarged gap. \mainlanguage [deo] \definefontfeature[frak][ccmp=yes,liga=yes] \definefont [FrakXIX] [UnifrakturMaguntia19.ttf*frak] \definefontfeature[whatever][keepligatures=auto] \definecharacterkerning [extrakerning] [factor=0.25,features=whatever] \define\Test{{\FrakXIX ſitzen/beſchütze/Zeitzone}} \starttext \tex{setcharacterkerning}\par \Test\par {\setcharacterkerning[extrakerning]\Test}\par \Test\par \blank \tex{kerncharacters}\par \Test\par {\kerncharacters[.25]{\Test}\par \Test\par \stoptext -- Rik ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___
Re: [NTG-context] Monospace fallback kerning
> On 11 Dec 2018, at 21:18, Pablo Rodriguez wrote: > > On 12/11/18 3:05 PM, Hans Åberg wrote: >> In the example below, multiple spaces do not use the spacing of the >> fallback font for multiple spaces, but instead of the main font it >> seems, despite the ASCII U+0020 being in the forced override. So the >> question is how to force ConTeXt to use the fallback font also for >> multiple spaces. > Hi Hans, Hello, > what are you trying to do? Using monospace to make some computer code stand out as such. It would suffice with select portions, though, like some keywords. > Sorry, but I’m afraid that ConTeXt doesn’t spaces as glyphs. Right, but for a monospace font in verbatim mode, one might expect it. Maybe there should be a monospace option for the fallback. > Would it be easier that you use a proper mono font for typing? Do you have any suggestions? —There is no such font covering the several thousands of glyphs used in math, and I am not sure it would help readability. Monospace somehow got popular for code in the ASCII range. ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___
Re: [NTG-context] Monospace fallback kerning
On 12/11/18 3:05 PM, Hans Åberg wrote: > In the example below, multiple spaces do not use the spacing of the > fallback font for multiple spaces, but instead of the main font it > seems, despite the ASCII U+0020 being in the forced override. So the > question is how to force ConTeXt to use the fallback font also for > multiple spaces. Hi Hans, what are you trying to do? Sorry, but I’m afraid that ConTeXt doesn’t spaces as glyphs. Would it be easier that you use a proper mono font for typing? Pablo > — > \definefallbackfamily [mainface] [mono] [courier] > [range={-00FF},force=yes] > > \definefontfamily [mainface][serif][stix] > \definefontfamily [mainface][mono][stix] > \definefontfamily [mainface][math][stix] > > \setupbodyfont[mainface,10pt] > > \starttext > > \starttyping > code code > . code . code > . code code > code > . . code > code > . . . code > code > . . . . code > code > . code > \stoptyping > > \stoptext > — > ___ > If your question is of interest to others as well, please add an entry to the > Wiki! > > maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context > webpage : http://www.pragma-ade.nl / http://context.aanhet.net > archive : https://bitbucket.org/phg/context-mirror/commits/ > wiki : http://contextgarden.net > ___ > -- http://www.ousia.tk ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___
[NTG-context] External Figure add caption or alternative text for tagged pdf/x
Hi All. I am trying to embed an image in a pdf so that when you open the pdf in acrobat or another reader the image is correctly tagged as an image and there is alternative text. So far I am able to export the back end tags so that I can see tags on tables and paragraphs, but the image comes through tagged as a paragraph and I am unable to add any alternative text. This is the code I am using: \setupbackend [format=PDF/X-1a:2001, export=yes] \externalfigure[district.pdf][height=10cm] Does anyone have any idea how I could fix this? Thanks! Claire ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___
[NTG-context] Monospace fallback kerning
In the example below, multiple spaces do not use the spacing of the fallback font for multiple spaces, but instead of the main font it seems, despite the ASCII U+0020 being in the forced override. So the question is how to force ConTeXt to use the fallback font also for multiple spaces. — \definefallbackfamily [mainface] [mono] [courier] [range={-00FF},force=yes] \definefontfamily [mainface][serif][stix] \definefontfamily [mainface][mono][stix] \definefontfamily [mainface][math][stix] \setupbodyfont[mainface,10pt] \starttext \starttyping code code . code . code . code code code . . code code . . . code code . . . . code code . code \stoptyping \stoptext — ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___
Re: [NTG-context] modifying kerning breaks opentype ligatures (and other features)
On 12/11/2018 1:45 PM, mf wrote: hm that is quit emessy yes? I found another solution (that we used once) that I can turn into a helper ... I'll send it off list \startbuffer[test] Some ligatures: float, finance, affine, affluent. Modified kerning: Some ligatures: float, finance, affine, affluent. Some ligatures: float, finance, affine, affluent. \stopbuffer \startluacode >>> -- a lot of lua code messing with xml Hans - Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl - ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___
Re: [NTG-context] modifying kerning breaks opentype ligatures (and other features)
did you play with \definefontfeature[whatever][keepligatures=auto] \definecharacterkerning [extrakerning] [factor=0.125,features=whatever] \starttext \setcharacterkerning[extrakerning] effe fietsen \stoptext Great! Thanks! This now works: \definefontfeature[frac][frac=yes] \definefontfeature[klig][keepligatures=auto] \definecharacterkerning[narrow][factor=-.02,features=klig] \definecharacterkerning[wide][factor=.02,features=klig] \def\Narrow#1{\dontleavehmode\bgroup\setcharacterkerning[narrow]#1\egroup} \def\Wide#1{\dontleavehmode\bgroup\setcharacterkerning[wide]#1\egroup} \def\NoKerning#1{\dontleavehmode\bgroup\resetcharacterkerning #1\egroup} \starttext \feature[+][frac]% Some ligatures: float, finance, affine; a fraction: 1/4. \blank Modified kerning: \Narrow{Some ligatures: float, finance, affine; a fraction: 1/4.} \Wide{Some ligatures: float, finance, affine; a fraction: 1/4.} \stoptext BTW, back to the automatic insertion of tags, how can i create children elements? In other words, how should i rewrite new_dk_element? The problem is this: - you have an element t and t.dt = { "float, finance, affine, affluent" } - t.dt should become = { DK1, "oat", DK2, "nance, a", DK3, "ne, a", DK4, "uent" } - where DK1 ... DK4 are children elements of t with tg="dk" and dt respectively equal to { "fl" }, { "fi" }, { "ffi" }, { "ffl" } My new_dk_element function should create such DKn elements, but they are not created right, because they look ignored by \xmlflush. \startbuffer[test] Some ligatures: float, finance, affine, affluent. Modified kerning: Some ligatures: float, finance, affine, affluent. Some ligatures: float, finance, affine, affluent. \stopbuffer \startluacode local function new_dk_element( parent, text ) return { tag = "dk", ns = "", rn = "", dt = { text }, at = {}, command = "xml:dk", __p__ = parent } --[[ local t = xml.toxml( "" .. text .. "" ) t.__p__ = parent return t ]]-- end local append = table.insert local function saveLigaturesFromKerning( t ) if t and t.dt then local dt = t.dt local t_copy = {} for k,v in pairs( t ) do if k ~= "dt" then t_copy[ k ] = v end end local new_dt = {} local i local child local b, e for i = 1, #dt, 1 do child = dt[ i ] if type( child ) == "string" then local s = child repeat b, e = string.find( s, "f?f[il]" ) if b then if b > 1 then append( new_dt, string.sub( s, 1, b - 1 ) ) end append( new_dt, new_dk_element( t, string.sub( s, b, e ) ) ) -- append( new_dt, "[" .. string.sub( s, b, e ) .. "]" ) s = string.sub( s, e + 1 ) else append( new_dt, s ) end until not b else append( new_dt, child ) end end t.dt = new_dt end return t end function xml.functions.textWithKerning( t ) local kt = saveLigaturesFromKerning( t ) lxml.flush( kt ) end \stopluacode \definecharacterkerning[narrow][factor=-.02] \definecharacterkerning[wide][factor=.02] \def\Narrow#1{\bgroup\setcharacterkerning[narrow]#1\egroup} \def\Wide#1{\bgroup\setcharacterkerning[wide]#1\egroup} \def\NoKerning#1{\bgroup\resetcharacterkerning #1\egroup} \startxmlsetups xml:test \xmlsetsetup{#1}{text|p|dk}{xml:*} \xmlsetsetup{#1}{{p.narrow}}{xml:p:narrow} \xmlsetsetup{#1}{{p.wide}}{xml:p:wide} \stopxmlsetups \xmlregistersetup{xml:test} \startxmlsetups xml:text \xmlflush{#1} \stopxmlsetups \startxmlsetups xml:p \xmlflush{#1}\par \stopxmlsetups \startxmlsetups xml:p:narrow \Narrow{\xmlfunction{#1}{textWithKerning}}\par \stopxmlsetups \startxmlsetups xml:p:wide \Wide{\xmlfunction{#1}{textWithKerning}}\par \stopxmlsetups \startxmlsetups xml:dk \NoKerning{\red\xmlflush{#1}} \stopxmlsetups \starttext \xmlprocessbuffer{xml:test}{test}{} \stoptext ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___
Re: [NTG-context] modifying kerning breaks opentype ligatures (and other features)
On 12/11/2018 11:34 AM, mf wrote: But i should consider all the text parts with a modified kerning and disable kerning around character sequences like "ff", "ffi", "fl" and so on. Luckily, the XHTML markup "knows" where the kerning is modified: A paragraph with a modified kerning should become A paragraph with a modified kerning Where ... (dk=Disable Kerning) are tags to be inserted automatically before feeding the XHTML into ConTeXt. I'm not very happy or proud about it, but it can be done. Do you think it can be better done inside ConTeXt? I nearly managed to do it in ConTeXt, but I can't create the "" elements right (the "new_dk_element" function is wrong): did you play with \definefontfeature[whatever][keepligatures=auto] \definecharacterkerning [extrakerning] [factor=0.125,features=whatever] \starttext \setcharacterkerning[extrakerning] effe fietsen \stoptext \startbuffer[test] Some ligatures: float, finance, affine, affluent. Modified kerning: Some ligatures: float, finance, affine, affluent. Some ligatures: float, finance, affine, affluent. \stopbuffer \startluacode local function new_dk_element( parent, text ) return { tag = "dk", ns = "", rn = "", dt = { text }, at = {}, command = "xml:dk", __p__ = parent } --[[ local t = xml.toxml( "" .. text .. "" ) t.__p__ = parent return t ]]-- end local append = table.insert local function saveLigaturesFromKerning( t ) if t and t.dt then local dt = t.dt local t_copy = {} for k,v in pairs( t ) do if k ~= "dt" then t_copy[ k ] = v end end local new_dt = {} local i local child local b, e for i = 1, #dt, 1 do child = dt[ i ] if type( child ) == "string" then local s = child repeat b, e = string.find( s, "f?f[il]" ) if b then if b > 1 then append( new_dt, string.sub( s, 1, b - 1 ) ) end append( new_dt, new_dk_element( t, string.sub( s, b, e ) ) ) -- append( new_dt, "[" .. string.sub( s, b, e ) .. "]" ) s = string.sub( s, e + 1 ) else append( new_dt, s ) end until not b else append( new_dt, child ) end end t.dt = new_dt end return t end function xml.functions.textWithKerning( t ) local kt = saveLigaturesFromKerning( t ) lxml.flush( kt ) end \stopluacode \definecharacterkerning[narrow][factor=-.02] \definecharacterkerning[wide][factor=.02] \def\Narrow#1{\bgroup\setcharacterkerning[narrow]#1\egroup} \def\Wide#1{\bgroup\setcharacterkerning[wide]#1\egroup} \def\NoKerning#1{\bgroup\resetcharacterkerning #1\egroup} \startxmlsetups xml:test \xmlsetsetup{#1}{text|p|dk}{xml:*} \xmlsetsetup{#1}{{p.narrow}}{xml:p:narrow} \xmlsetsetup{#1}{{p.wide}}{xml:p:wide} \stopxmlsetups \xmlregistersetup{xml:test} \startxmlsetups xml:text \xmlflush{#1} \stopxmlsetups \startxmlsetups xml:p \xmlflush{#1}\par \stopxmlsetups \startxmlsetups xml:p:narrow \Narrow{\xmlfunction{#1}{textWithKerning}}\par \stopxmlsetups \startxmlsetups xml:p:wide \Wide{\xmlfunction{#1}{textWithKerning}}\par \stopxmlsetups \startxmlsetups xml:dk \NoKerning{\red\xmlflush{#1}} \stopxmlsetups \starttext \xmlprocessbuffer{xml:test}{test}{} \stoptext ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___ -- - Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl - ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___
Re: [NTG-context] modifying kerning breaks opentype ligatures (and other features)
But i should consider all the text parts with a modified kerning and disable kerning around character sequences like "ff", "ffi", "fl" and so on. Luckily, the XHTML markup "knows" where the kerning is modified: A paragraph with a modified kerning should become A paragraph with a modified kerning Where ... (dk=Disable Kerning) are tags to be inserted automatically before feeding the XHTML into ConTeXt. I'm not very happy or proud about it, but it can be done. Do you think it can be better done inside ConTeXt? I nearly managed to do it in ConTeXt, but I can't create the "" elements right (the "new_dk_element" function is wrong): \startbuffer[test] Some ligatures: float, finance, affine, affluent. Modified kerning: Some ligatures: float, finance, affine, affluent. Some ligatures: float, finance, affine, affluent. \stopbuffer \startluacode local function new_dk_element( parent, text ) return { tag = "dk", ns = "", rn = "", dt = { text }, at = {}, command = "xml:dk", __p__ = parent } --[[ local t = xml.toxml( "" .. text .. "" ) t.__p__ = parent return t ]]-- end local append = table.insert local function saveLigaturesFromKerning( t ) if t and t.dt then local dt = t.dt local t_copy = {} for k,v in pairs( t ) do if k ~= "dt" then t_copy[ k ] = v end end local new_dt = {} local i local child local b, e for i = 1, #dt, 1 do child = dt[ i ] if type( child ) == "string" then local s = child repeat b, e = string.find( s, "f?f[il]" ) if b then if b > 1 then append( new_dt, string.sub( s, 1, b - 1 ) ) end append( new_dt, new_dk_element( t, string.sub( s, b, e ) ) ) -- append( new_dt, "[" .. string.sub( s, b, e ) .. "]" ) s = string.sub( s, e + 1 ) else append( new_dt, s ) end until not b else append( new_dt, child ) end end t.dt = new_dt end return t end function xml.functions.textWithKerning( t ) local kt = saveLigaturesFromKerning( t ) lxml.flush( kt ) end \stopluacode \definecharacterkerning[narrow][factor=-.02] \definecharacterkerning[wide][factor=.02] \def\Narrow#1{\bgroup\setcharacterkerning[narrow]#1\egroup} \def\Wide#1{\bgroup\setcharacterkerning[wide]#1\egroup} \def\NoKerning#1{\bgroup\resetcharacterkerning #1\egroup} \startxmlsetups xml:test \xmlsetsetup{#1}{text|p|dk}{xml:*} \xmlsetsetup{#1}{{p.narrow}}{xml:p:narrow} \xmlsetsetup{#1}{{p.wide}}{xml:p:wide} \stopxmlsetups \xmlregistersetup{xml:test} \startxmlsetups xml:text \xmlflush{#1} \stopxmlsetups \startxmlsetups xml:p \xmlflush{#1}\par \stopxmlsetups \startxmlsetups xml:p:narrow \Narrow{\xmlfunction{#1}{textWithKerning}}\par \stopxmlsetups \startxmlsetups xml:p:wide \Wide{\xmlfunction{#1}{textWithKerning}}\par \stopxmlsetups \startxmlsetups xml:dk \NoKerning{\red\xmlflush{#1}} \stopxmlsetups \starttext \xmlprocessbuffer{xml:test}{test}{} \stoptext ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___