Re: [NTG-context] two issues with new hyphenator
On 12/10/2014 10:58 PM, Hans Hagen wrote: > On 12/10/2014 8:15 PM, Pablo Rodriguez wrote: >> On 12/09/2014 12:07 AM, Hans Hagen wrote: >>> On 12/8/2014 5:47 PM, Pablo Rodriguez wrote: [..] And sorry for asking this again, but I need underscore hyphenation with the underscore character from the font and only for the \tex and \hyphenatedurl commands (not for the rest of the text). [...] >>> >>> just a variant of the addfunyhyphen: >> >> Many thanks for your sample, Hans. >> >> It really works great. >> >> Sorry for asking this again: would it be possible to add this feature >> also to \hyphenatedurl. >> >> I’m composing a book on A6 and it is really hard to add some urls. > > some code from an upcoming manual: Many thanks for the sample, Hans. For some strange reason, the line: ["/"] = "before", ["\\"] = "before", removes the backslashes in your sample. Setting \hsize to \zeropoint or other length seems to avoid the problem. What I had in mind is something different. Sorry for not having explained in a more accurate manner before. The current line breaking (without hyphenation) in \hyphenatedurl is fine for me. The issue is that there are some urls that contain long words inside. Here is one of them: http://www.nietzschesource.org/#eKGWB/GD-Sprueche-12. And only for those words underscore hyphenation is required. They should be hyphenated as any other word, only using the underscore hyphen. This would mean that urls would have two line breaks: one without hyphen (as it was before) and another extra with underscore. Many thanks for your help, Pablo > \startluacode > local specials = { > ["!"] = "before", ["?"] = "before", > ['"'] = "before", ["'"] = "before", > ["/"] = "before", ["\\"] = "before", > ["#"] = "before", > ["$"] = "before", > ["%"] = "before", > ["&"] = "before", > ["*"] = "before", > ["+"] = "before", ["-"] = "before", > [","] = "before", ["."] = "before", > [":"] = "before", [";"] = "before", > ["<"] = "before", [">"] = "before", > ["="] = "before", > ["@"] = "before", > ["("] = "before", > ["["] = "before", > ["{"] = "before", > ["^"] = "before", ["_"] = "before", > ["`"] = "before", > ["|"] = "before", > ["~"] = "before", > -- > [")"] = "after", > ["]"] = "after", > ["}"] = "after", > } > > languages.hyphenators.traditional.installmethod("url", > function(dictionary,word,n) > local t = { } > for i=1,#word do > local w = word[i] > local s = specials[w] > if s == "after" then > s = { > start = 1, > length = 1, > after = w, > left = false, > right = false, > } > specials[w] = s > elseif s == "before" then > s = { > start = 1, > length = 1, > before = w, > left = false, > -- right = false, > } > specials[w] = s > end > t[i] = s or false > end > return t > end > ) > \stopluacode > > \startluacode > > function document.addfunnyhyphen(tfmdata) > local underscore = utf.byte("_") > local char = tfmdata.characters[underscore] > tfmdata.characters[0xFE000] = { > width= 0, > height = 0, > depth= 0, > commands = { > { "right", -char.width }, > { "down", char.depth }, > { "slot", 1, underscore }, > } > } > end > > > utilities.sequencers.appendaction("aftercopyingcharacters","after","document.addfunnyhyphen") > > \stopluacode > > \definehyphenationfeatures >[url] >[characters=all, > righthyphenchar="FE000, > alternative=url] > > \setuphyphenation[method=traditional] > > \unexpanded\def\hyphenatedurl#1% >{\dontleavehmode > \begingroup > \tt > \sethyphenationfeatures[url]% > #1% > \endgroup} > > \starttext > > \hsize5mm > \hyphenatedurl{http://www.pragma-ade.nl} > > \stoptext -- 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://tex.aanhet.net arch
Re: [NTG-context] two issues with new hyphenator
On 12/10/2014 8:15 PM, Pablo Rodriguez wrote: On 12/09/2014 12:07 AM, Hans Hagen wrote: On 12/8/2014 5:47 PM, Pablo Rodriguez wrote: [..] And sorry for asking this again, but I need underscore hyphenation with the underscore character from the font and only for the \tex and \hyphenatedurl commands (not for the rest of the text). [...] just a variant of the addfunyhyphen: Many thanks for your sample, Hans. It really works great. Sorry for asking this again: would it be possible to add this feature also to \hyphenatedurl. I’m composing a book on A6 and it is really hard to add some urls. some code from an upcoming manual: \startluacode local specials = { ["!"] = "before", ["?"] = "before", ['"'] = "before", ["'"] = "before", ["/"] = "before", ["\\"] = "before", ["#"] = "before", ["$"] = "before", ["%"] = "before", ["&"] = "before", ["*"] = "before", ["+"] = "before", ["-"] = "before", [","] = "before", ["."] = "before", [":"] = "before", [";"] = "before", ["<"] = "before", [">"] = "before", ["="] = "before", ["@"] = "before", ["("] = "before", ["["] = "before", ["{"] = "before", ["^"] = "before", ["_"] = "before", ["`"] = "before", ["|"] = "before", ["~"] = "before", -- [")"] = "after", ["]"] = "after", ["}"] = "after", } languages.hyphenators.traditional.installmethod("url", function(dictionary,word,n) local t = { } for i=1,#word do local w = word[i] local s = specials[w] if s == "after" then s = { start = 1, length = 1, after = w, left = false, right = false, } specials[w] = s elseif s == "before" then s = { start = 1, length = 1, before = w, left = false, -- right = false, } specials[w] = s end t[i] = s or false end return t end ) \stopluacode \startluacode function document.addfunnyhyphen(tfmdata) local underscore = utf.byte("_") local char = tfmdata.characters[underscore] tfmdata.characters[0xFE000] = { width= 0, height = 0, depth= 0, commands = { { "right", -char.width }, { "down", char.depth }, { "slot", 1, underscore }, } } end utilities.sequencers.appendaction("aftercopyingcharacters","after","document.addfunnyhyphen") \stopluacode \definehyphenationfeatures [url] [characters=all, righthyphenchar="FE000, alternative=url] \setuphyphenation[method=traditional] \unexpanded\def\hyphenatedurl#1% {\dontleavehmode \begingroup \tt \sethyphenationfeatures[url]% #1% \endgroup} \starttext \hsize5mm \hyphenatedurl{http://www.pragma-ade.nl} \stoptext Many thanks for your help again, Pablo \startluacode function document.addfunnyhyphen(tfmdata) local underscore = utf.byte("_") local char = tfmdata.characters[underscore] -- logs.report("fonts","adding funny hyphen to font %a",tfmdata.properties.fontname) tfmdata.characters[0xFE000] = { width= 0, height = 0, depth= 0, commands = { { "right", -char.width }, { "down", char.depth }, { "slot", 1, underscore }, } } end utilities.sequencers.appendaction("aftercopyingcharacters","after","document.addfunnyhyphen") \stopluacode \definefontfeature[default][default][funnyhyphen=yes] \definefontfeature[always] [always] [funnyhyphen=yes] \definefontfeature[none] [none] [funnyhyphen=yes] \definetype [TeXcode] [option=TEX, compact=absolute, lines=hyphenated] \definehyphenationfeatures [whatever] [righthyphenchar="FE000] \setuphyphenation [method=traditional] \unexpanded\def\TexC#1% {\dontleavehmode\begingroup \sethyphenationfeatures[whatever]% % \prehyphenchar"FE000 \normalexpanded{\TeXcode{\letterbackslash#1}}% \endgroup} \starttext \input tufte \dorecurse{100}{\TexC{definebodyfont} } \input tufte \stoptext we can add some of them but first i need to think about what slots to use (shouldn't conflict with other private slots) -- -
Re: [NTG-context] two issues with new hyphenator
On 12/09/2014 12:07 AM, Hans Hagen wrote: > On 12/8/2014 5:47 PM, Pablo Rodriguez wrote: >> [..] >> And sorry for asking this again, but I need underscore hyphenation with >> the underscore character from the font and only for the \tex and >> \hyphenatedurl commands (not for the rest of the text). >> [...] > > just a variant of the addfunyhyphen: Many thanks for your sample, Hans. It really works great. Sorry for asking this again: would it be possible to add this feature also to \hyphenatedurl. I’m composing a book on A6 and it is really hard to add some urls. Many thanks for your help again, Pablo > \startluacode > > function document.addfunnyhyphen(tfmdata) > local underscore = utf.byte("_") > local char = tfmdata.characters[underscore] >-- logs.report("fonts","adding funny hyphen to font > %a",tfmdata.properties.fontname) > tfmdata.characters[0xFE000] = { > width= 0, > height = 0, > depth= 0, > commands = { > { "right", -char.width }, > { "down", char.depth }, > { "slot", 1, underscore }, > } > } > end > > > utilities.sequencers.appendaction("aftercopyingcharacters","after","document.addfunnyhyphen") > > \stopluacode > > \definefontfeature[default][default][funnyhyphen=yes] > \definefontfeature[always] [always] [funnyhyphen=yes] > \definefontfeature[none] [none] [funnyhyphen=yes] > > \definetype > [TeXcode] > [option=TEX, >compact=absolute, >lines=hyphenated] > > \definehyphenationfeatures > [whatever] > [righthyphenchar="FE000] > > \setuphyphenation > [method=traditional] > > \unexpanded\def\TexC#1% > {\dontleavehmode\begingroup >\sethyphenationfeatures[whatever]% > % \prehyphenchar"FE000 >\normalexpanded{\TeXcode{\letterbackslash#1}}% >\endgroup} > > \starttext > \input tufte > \dorecurse{100}{\TexC{definebodyfont} } > \input tufte > \stoptext > > we can add some of them but first i need to think about what slots to > use (shouldn't conflict with other private slots) -- 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://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] two issues with new hyphenator
On 12/8/2014 5:47 PM, Pablo Rodriguez wrote: On 12/06/2014 01:09 PM, Hans Hagen wrote: On 12/6/2014 12:40 PM, Pablo Rodriguez wrote: On 12/06/2014 12:20 AM, Hans Hagen wrote: On 12/5/2014 8:11 PM, Pablo Rodriguez wrote: [...] BTW, in your sample below, how can I get the underscore under the previous character? (Otherwise, the underscore has no use.) Hm, that was the idea of the example i sent earlier. [...] Hans, many thanks for having fixed the issue with zeros and the new hyphenator. I have discovered that \registerhyphenationexception doesn’t allow names with first letter in capitals (only \registerhyphenationexception[Nietz-sche] will work). This differs from the \hyphenation command. Is this intended? And sorry for asking this again, but I need underscore hyphenation with the underscore character from the font and only for the \tex and \hyphenatedurl commands (not for the rest of the text). How could it be implemented in the following sample? \setupcolor[state=start] \setuplayout[backspace=95mm, width=middle] \definetype[TeXcode][option=TEX, compact=absolute] \unexpanded\def\tex#1{\normalexpanded{\TeXcode{\letterbackslash#1}}} \starttext \tex{thisisaverylongcommand} \hyphenatedurl{http://optimisticwayofthinking.optimist} \input knuth \stoptext Many thanks for your help again, just a variant of the addfunyhyphen: \startluacode function document.addfunnyhyphen(tfmdata) local underscore = utf.byte("_") local char = tfmdata.characters[underscore] -- logs.report("fonts","adding funny hyphen to font %a",tfmdata.properties.fontname) tfmdata.characters[0xFE000] = { width= 0, height = 0, depth= 0, commands = { { "right", -char.width }, { "down", char.depth }, { "slot", 1, underscore }, } } end utilities.sequencers.appendaction("aftercopyingcharacters","after","document.addfunnyhyphen") \stopluacode \definefontfeature[default][default][funnyhyphen=yes] \definefontfeature[always] [always] [funnyhyphen=yes] \definefontfeature[none] [none] [funnyhyphen=yes] \definetype [TeXcode] [option=TEX, compact=absolute, lines=hyphenated] \definehyphenationfeatures [whatever] [righthyphenchar="FE000] \setuphyphenation [method=traditional] \unexpanded\def\TexC#1% {\dontleavehmode\begingroup \sethyphenationfeatures[whatever]% % \prehyphenchar"FE000 \normalexpanded{\TeXcode{\letterbackslash#1}}% \endgroup} \starttext \input tufte \dorecurse{100}{\TexC{definebodyfont} } \input tufte \stoptext we can add some of them but first i need to think about what slots to use (shouldn't conflict with other private slots) Pablo \startluacode local function addfunnyhyphen(tfmdata) local exheight = tfmdata.parameters.xheight local emwidth = tfmdata.parameters.quad local width= emwidth local height = exheight / 10 local depth= exheight / 2 tfmdata.characters[0xFE000] = { width= 0, height = 0, depth= 0, commands = { { "right", -width }, { "down", depth }, { "rule", height, width }, } } end fonts.constructors.newfeatures("otf").register { name= "funnyhyphen", description = "funny hyphen", manipulators = { base = addfunnyhyphen, node = addfunnyhyphen, } } \stopluacode \definefontfeature[default][default][funnyhyphen=yes] \starttext \prehyphenchar"FE000 \hsize 1mm averylongword \stoptext Many thanks for your help, Pablo \definetype [TeXcode] [option=TEX, compact=absolute, lines=hyphenated] \definehyphenationfeatures [whatever] [righthyphenchar=_] \setuphyphenation [method=traditional] \unexpanded\def\TexC#1% {\dontleavehmode\begingroup \sethyphenationfeatures[whatever]% \normalexpanded{\TeXcode{\letterbackslash#1}}% \endgroup} \starttext \input tufte \dorecurse{100}{\TexC{definebodyfont} } \input tufte \stoptext -- - Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com | www.pragma-pod.nl - ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@nt
Re: [NTG-context] two issues with new hyphenator
On 12/06/2014 01:09 PM, Hans Hagen wrote: > On 12/6/2014 12:40 PM, Pablo Rodriguez wrote: >> On 12/06/2014 12:20 AM, Hans Hagen wrote: >>> On 12/5/2014 8:11 PM, Pablo Rodriguez wrote: [...] BTW, in your sample below, how can I get the underscore under the previous character? (Otherwise, the underscore has no use.) >>> >>> Hm, that was the idea of the example i sent earlier. > [...] Hans, many thanks for having fixed the issue with zeros and the new hyphenator. I have discovered that \registerhyphenationexception doesn’t allow names with first letter in capitals (only \registerhyphenationexception[Nietz-sche] will work). This differs from the \hyphenation command. Is this intended? And sorry for asking this again, but I need underscore hyphenation with the underscore character from the font and only for the \tex and \hyphenatedurl commands (not for the rest of the text). How could it be implemented in the following sample? \setupcolor[state=start] \setuplayout[backspace=95mm, width=middle] \definetype[TeXcode][option=TEX, compact=absolute] \unexpanded\def\tex#1{\normalexpanded{\TeXcode{\letterbackslash#1}}} \starttext \tex{thisisaverylongcommand} \hyphenatedurl{http://optimisticwayofthinking.optimist} \input knuth \stoptext Many thanks for your help again, Pablo > \startluacode > > local function addfunnyhyphen(tfmdata) > local exheight = tfmdata.parameters.xheight > local emwidth = tfmdata.parameters.quad > local width= emwidth > local height = exheight / 10 > local depth= exheight / 2 > tfmdata.characters[0xFE000] = { > width= 0, > height = 0, > depth= 0, > commands = { > { "right", -width }, > { "down", depth }, > { "rule", height, width }, > } > } > end > > fonts.constructors.newfeatures("otf").register { > name= "funnyhyphen", > description = "funny hyphen", > manipulators = { > base = addfunnyhyphen, > node = addfunnyhyphen, > } > } > > \stopluacode > > \definefontfeature[default][default][funnyhyphen=yes] > > \starttext > > \prehyphenchar"FE000 > > \hsize 1mm > > averylongword > > \stoptext > >> Many thanks for your help, >> >> >> Pablo >> >> > \definetype > [TeXcode] > [option=TEX, > compact=absolute, > lines=hyphenated] > > \definehyphenationfeatures > [whatever] > [righthyphenchar=_] > > \setuphyphenation > [method=traditional] > > \unexpanded\def\TexC#1% > {\dontleavehmode\begingroup > \sethyphenationfeatures[whatever]% > \normalexpanded{\TeXcode{\letterbackslash#1}}% > \endgroup} > > \starttext >\input tufte >\dorecurse{100}{\TexC{definebodyfont} } >\input tufte > \stoptext -- 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://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] two issues with new hyphenator
On 12/6/2014 12:40 PM, Pablo Rodriguez wrote: On 12/06/2014 12:20 AM, Hans Hagen wrote: On 12/5/2014 8:11 PM, Pablo Rodriguez wrote: I’m afraid that I get a zero in the next line after the underscore. i'll fix it Many thanks for the fix, Hans. BTW, in your sample below, how can I get the underscore under the previous character? (Otherwise, the underscore has no use.) Hm, that was the idea of the example i sent earlier. Excuse me, if I’m plainly mistaken, but from what I understand from the sample below, I’m afraid I cannot find the code to get the underscore under the previous character. \startluacode local function addfunnyhyphen(tfmdata) local exheight = tfmdata.parameters.xheight local emwidth = tfmdata.parameters.quad local width= emwidth local height = exheight / 10 local depth= exheight / 2 tfmdata.characters[0xFE000] = { width= 0, height = 0, depth= 0, commands = { { "right", -width }, { "down", depth }, { "rule", height, width }, } } end fonts.constructors.newfeatures("otf").register { name= "funnyhyphen", description = "funny hyphen", manipulators = { base = addfunnyhyphen, node = addfunnyhyphen, } } \stopluacode \definefontfeature[default][default][funnyhyphen=yes] \starttext \prehyphenchar"FE000 \hsize 1mm averylongword \stoptext Many thanks for your help, Pablo \definetype [TeXcode] [option=TEX, compact=absolute, lines=hyphenated] \definehyphenationfeatures [whatever] [righthyphenchar=_] \setuphyphenation [method=traditional] \unexpanded\def\TexC#1% {\dontleavehmode\begingroup \sethyphenationfeatures[whatever]% \normalexpanded{\TeXcode{\letterbackslash#1}}% \endgroup} \starttext \input tufte \dorecurse{100}{\TexC{definebodyfont} } \input tufte \stoptext i'll upload a beta (making one now) -- - Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com | 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://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] two issues with new hyphenator
On 12/06/2014 12:20 AM, Hans Hagen wrote: > On 12/5/2014 8:11 PM, Pablo Rodriguez wrote: >> I’m afraid that I get a zero in the next line after the underscore. > > i'll fix it Many thanks for the fix, Hans. >> BTW, in your sample below, how can I get the underscore under the >> previous character? (Otherwise, the underscore has no use.) > > Hm, that was the idea of the example i sent earlier. Excuse me, if I’m plainly mistaken, but from what I understand from the sample below, I’m afraid I cannot find the code to get the underscore under the previous character. Many thanks for your help, Pablo >>> \definetype >>> [TeXcode] >>> [option=TEX, >>> compact=absolute, >>> lines=hyphenated] >>> >>> \definehyphenationfeatures >>> [whatever] >>> [righthyphenchar=_] >>> >>> \setuphyphenation >>> [method=traditional] >>> >>> \unexpanded\def\TexC#1% >>> {\dontleavehmode\begingroup >>> \sethyphenationfeatures[whatever]% >>> \normalexpanded{\TeXcode{\letterbackslash#1}}% >>> \endgroup} >>> >>> \starttext >>> \input tufte >>> \dorecurse{100}{\TexC{definebodyfont} } >>> \input tufte >>> \stoptext >>> >>> i'll upload a beta (making one now) -- 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://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] two issues with new hyphenator
On 12/5/2014 8:11 PM, Pablo Rodriguez wrote: On 12/04/2014 10:00 PM, Hans Hagen wrote: On 12/4/2014 8:21 PM, Pablo Rodriguez wrote: [...] The text from Knuth needs to have the standard hyphenation character, although the other two commands need to have underscore hyphenation. Which is the best way to do it? it's no big deal to extend the mechanism to support this ... Many thanks for your help, Hans. I’m afraid that I get a zero in the next line after the underscore. i'll fix it And I get two zeros (one at the end and one at the begining) with strict hyphenation: \setuphyphenation[method=traditional] \sethyphenationfeatures[strict] \starttext \input knuth \stoptext BTW, in your sample below, how can I get the underscore under the previous character? (Otherwise, the underscore has no use.) Hm, that was the idea of the example i sent earlier. Many thanks for your help again, Pablo \definetype [TeXcode] [option=TEX, compact=absolute, lines=hyphenated] \definehyphenationfeatures [whatever] [righthyphenchar=_] \setuphyphenation [method=traditional] \unexpanded\def\TexC#1% {\dontleavehmode\begingroup \sethyphenationfeatures[whatever]% \normalexpanded{\TeXcode{\letterbackslash#1}}% \endgroup} \starttext \input tufte \dorecurse{100}{\TexC{definebodyfont} } \input tufte \stoptext i'll upload a beta (making one now) -- - Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com | 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://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] two issues with new hyphenator
On 12/04/2014 10:00 PM, Hans Hagen wrote: > On 12/4/2014 8:21 PM, Pablo Rodriguez wrote: >> [...] >> The text from Knuth needs to have the standard hyphenation character, >> although the other two commands need to have underscore hyphenation. >> >> Which is the best way to do it? > > it's no big deal to extend the mechanism to support this ... Many thanks for your help, Hans. I’m afraid that I get a zero in the next line after the underscore. And I get two zeros (one at the end and one at the begining) with strict hyphenation: \setuphyphenation[method=traditional] \sethyphenationfeatures[strict] \starttext \input knuth \stoptext BTW, in your sample below, how can I get the underscore under the previous character? (Otherwise, the underscore has no use.) Many thanks for your help again, Pablo > \definetype >[TeXcode] >[option=TEX, > compact=absolute, > lines=hyphenated] > > \definehyphenationfeatures >[whatever] >[righthyphenchar=_] > > \setuphyphenation >[method=traditional] > > \unexpanded\def\TexC#1% >{\dontleavehmode\begingroup > \sethyphenationfeatures[whatever]% > \normalexpanded{\TeXcode{\letterbackslash#1}}% > \endgroup} > > \starttext > \input tufte > \dorecurse{100}{\TexC{definebodyfont} } > \input tufte > \stoptext > > i'll upload a beta (making one now) -- 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://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] two issues with new hyphenator
On 12/03/2014 09:36 PM, Hans Hagen wrote: > On 12/3/2014 7:48 PM, Pablo Rodriguez wrote: >> >> With the new hyphenator, \hyphenation isn’t honored, such as in this sample: >> [...] >> Has the command been deprecated with the new hyphenator? > > The next version will have: > [...] > (the functionality is already there, this wraps it in a macro) Many thanks for the new beta from today, Hans. I’m afraid I might have hit a bug: \setuphyphenation[method=traditional] \registerhyphenationexception[Nietz-sche Pa-blo pa-lo water a-b a-c] \starttext \hsize 1mm ab ac Nietzsche Pablo water palo \stoptext Some exceptions work and another ones don’t. I cannot say why. Isn’t it a bug? Many thanks for your help, Pablo -- 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://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] two issues with new hyphenator
On 12/4/2014 8:21 PM, Pablo Rodriguez wrote: On 12/03/2014 08:30 PM, Hans Hagen wrote: no need to mess like that: Many thanks for your reply, Hans. Sorry, but the Lua code for the underscore hyphenation is all Greek to me. I need the two following features: use the underscore character from the font and enable it only for certain commands, not for the whole text. Here is a minimal sample: \showframe \setupcolor[state=start] \setuplayout[backspace=95mm, width=middle] \definetype[TeXcode][option=TEX, compact=absolute] \unexpanded\def\tex#1{\normalexpanded{\TeXcode{\letterbackslash#1}}} \starttext \tex{thisisaverylongcommand} \hyphenatedurl{http://optimisticwayofthinking.optimist} \input knuth \stoptext The text from Knuth needs to have the standard hyphenation character, although the other two commands need to have underscore hyphenation. Which is the best way to do it? it's no big deal to extend the mechanism to support this ... \definetype [TeXcode] [option=TEX, compact=absolute, lines=hyphenated] \definehyphenationfeatures [whatever] [righthyphenchar=_] \setuphyphenation [method=traditional] \unexpanded\def\TexC#1% {\dontleavehmode\begingroup \sethyphenationfeatures[whatever]% \normalexpanded{\TeXcode{\letterbackslash#1}}% \endgroup} \starttext \input tufte \dorecurse{100}{\TexC{definebodyfont} } \input tufte \stoptext i'll upload a beta (making one now) Many thanks for your help again, Pablo \startluacode local function addfunnyhyphen(tfmdata) local exheight = tfmdata.parameters.xheight local emwidth = tfmdata.parameters.quad local width= emwidth local height = exheight / 10 local depth= exheight / 2 tfmdata.characters[0xFE000] = { width= 0, height = 0, depth= 0, commands = { { "right", -width }, { "down", depth }, { "rule", height, width }, } } end fonts.constructors.newfeatures("otf").register { name= "funnyhyphen", description = "funny hyphen", manipulators = { base = addfunnyhyphen, node = addfunnyhyphen, } } \stopluacode \definefontfeature[default][default][funnyhyphen=yes] \starttext \prehyphenchar"FE000 \hsize 1mm averylongword \stoptext -- - Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com | 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://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] two issues with new hyphenator
On 12/03/2014 08:30 PM, Hans Hagen wrote: > > no need to mess like that: Many thanks for your reply, Hans. Sorry, but the Lua code for the underscore hyphenation is all Greek to me. I need the two following features: use the underscore character from the font and enable it only for certain commands, not for the whole text. Here is a minimal sample: \showframe \setupcolor[state=start] \setuplayout[backspace=95mm, width=middle] \definetype[TeXcode][option=TEX, compact=absolute] \unexpanded\def\tex#1{\normalexpanded{\TeXcode{\letterbackslash#1}}} \starttext \tex{thisisaverylongcommand} \hyphenatedurl{http://optimisticwayofthinking.optimist} \input knuth \stoptext The text from Knuth needs to have the standard hyphenation character, although the other two commands need to have underscore hyphenation. Which is the best way to do it? Many thanks for your help again, Pablo > \startluacode > > local function addfunnyhyphen(tfmdata) > local exheight = tfmdata.parameters.xheight > local emwidth = tfmdata.parameters.quad > local width= emwidth > local height = exheight / 10 > local depth= exheight / 2 > tfmdata.characters[0xFE000] = { > width= 0, > height = 0, > depth= 0, > commands = { > { "right", -width }, > { "down", depth }, > { "rule", height, width }, > } > } > end > > fonts.constructors.newfeatures("otf").register { > name= "funnyhyphen", > description = "funny hyphen", > manipulators = { > base = addfunnyhyphen, > node = addfunnyhyphen, > } > } > > \stopluacode > > \definefontfeature[default][default][funnyhyphen=yes] > > \starttext > > \prehyphenchar"FE000 > > \hsize 1mm > > averylongword > > \stoptext -- 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://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] two issues with new hyphenator
On 12/3/2014 7:48 PM, Pablo Rodriguez wrote: Many thanks for your new beta, Hans. From the previous beta with the new hyphenator, I have two issues. With the new hyphenator, \hyphenation isn’t honored, such as in this sample: \setuphyphenation[method=traditional] \hyphenation{Nietz-sche} \starttext \hsize\zeropoint Nietzsche \stoptext Has the command been deprecated with the new hyphenator? The next version will have: \starttext \setuphyphenation[method=traditional] \hsize 1mm ab \registerhyphenationexception[a-b] \blank ab \stoptext (the functionality is already there, this wraps it in a macro) The second issue is the ability to enable underscore hyphenation. Is there any way to apply the following definition to \hyphenatedurl? \unexpanded\def\underscorehyphenation#1% {\dontleavehmode \begingroup \prehyphenchar\minusone \localrightbox{\llap{\smash{\lower.1ex\hbox{_% \setbox\scratchbox\hbox{#1}% \prehyphenchar`-\relax \unhbox\scratchbox \endgroup} (This is adapted from the last sample in lang-url.mkiv.) Many thanks for your help, Pablo -- - Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com | 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://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] two issues with new hyphenator
On 12/3/2014 7:48 PM, Pablo Rodriguez wrote: Many thanks for your new beta, Hans. From the previous beta with the new hyphenator, I have two issues. With the new hyphenator, \hyphenation isn’t honored, such as in this sample: \setuphyphenation[method=traditional] \hyphenation{Nietz-sche} \starttext \hsize\zeropoint Nietzsche \stoptext Has the command been deprecated with the new hyphenator? no, on the todo list is a variant (in fact you can add pretty complex patterns in different ways already) The second issue is the ability to enable underscore hyphenation. Is there any way to apply the following definition to \hyphenatedurl? \unexpanded\def\underscorehyphenation#1% {\dontleavehmode \begingroup \prehyphenchar\minusone \localrightbox{\llap{\smash{\lower.1ex\hbox{_% \setbox\scratchbox\hbox{#1}% \prehyphenchar`-\relax \unhbox\scratchbox \endgroup} (This is adapted from the last sample in lang-url.mkiv.) no need to mess like that: \startluacode local function addfunnyhyphen(tfmdata) local exheight = tfmdata.parameters.xheight local emwidth = tfmdata.parameters.quad local width= emwidth local height = exheight / 10 local depth= exheight / 2 tfmdata.characters[0xFE000] = { width= 0, height = 0, depth= 0, commands = { { "right", -width }, { "down", depth }, { "rule", height, width }, } } end fonts.constructors.newfeatures("otf").register { name= "funnyhyphen", description = "funny hyphen", manipulators = { base = addfunnyhyphen, node = addfunnyhyphen, } } \stopluacode \definefontfeature[default][default][funnyhyphen=yes] \starttext \prehyphenchar"FE000 \hsize 1mm averylongword \stoptext - Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com | 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://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
[NTG-context] two issues with new hyphenator
Many thanks for your new beta, Hans. From the previous beta with the new hyphenator, I have two issues. With the new hyphenator, \hyphenation isn’t honored, such as in this sample: \setuphyphenation[method=traditional] \hyphenation{Nietz-sche} \starttext \hsize\zeropoint Nietzsche \stoptext Has the command been deprecated with the new hyphenator? The second issue is the ability to enable underscore hyphenation. Is there any way to apply the following definition to \hyphenatedurl? \unexpanded\def\underscorehyphenation#1% {\dontleavehmode \begingroup \prehyphenchar\minusone \localrightbox{\llap{\smash{\lower.1ex\hbox{_% \setbox\scratchbox\hbox{#1}% \prehyphenchar`-\relax \unhbox\scratchbox \endgroup} (This is adapted from the last sample in lang-url.mkiv.) Many thanks for your help, Pablo -- 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://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___