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
___________________________________________________________________________________

Reply via email to