[NTG-context] underscore hyphenation

Pablo Rodriguez oinos at gmx.es
Thu Dec 11 18:15:36 CET 2014


On 12/10/2014 10:58 PM, Hans Hagen wrote:
> On 12/10/2014 9:03 PM, Pablo Rodriguez wrote:
>> Hans,
>>
>> the sample below hyphenates right what comes before \TexC in the
>> paragraph. Also the contents of \TexC are hyphenated right.
>>
>> But hyphen is removed from standard text after the last \TexC command in
>> the paragraph.
> 
> Fixed, thanks for noticing, it had to do with picking up the right 
> settings after a change in alternative (we operate on several axis: 
> language, glyph and hyphenation properties).

Many thanks for having fixed it, Hans.


Pablo



>> \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
>>
>> \definefontfamily[mainface][serif][GaramondNo8]
>> \definefontfamily[mainface][mono][Mechanica]
>> \setupbodyfont[mainface, 14pt]
>>
>> \definetype
>>        [TeXcode]
>>        [option=TEX,
>>         compact=absolute,
>>         lines=hyphenated]
>>
>> \definehyphenationfeatures
>>        [whatever]
>>        [righthyphenchar="FE000]
>>
>> \setuphyphenation[method=traditional]
>> \sethyphenationfeatures[strict]
>>
>> \unexpanded\def\TexC#1%
>>        {\dontleavehmode\begingroup
>>         \sethyphenationfeatures[whatever]%
>>         \normalexpanded{\TeXcode{\letterbackslash#1}}%
>>         \endgroup}
>>
>> \starttext
>>          \hsize\zeropoint
>>          newlargewordwithhyphen
>>          \TexC{definebodyfont}
>>          newlargewordwithnohyphen
>> \stoptext
>>
> 
> 


-- 
http://www.ousia.tk


More information about the ntg-context mailing list