* underscore hyphenation
@ 2014-12-10 20:03 Pablo Rodriguez
2014-12-10 21:58 ` Hans Hagen
0 siblings, 1 reply; 3+ messages in thread
From: Pablo Rodriguez @ 2014-12-10 20:03 UTC (permalink / raw)
To: mailing list for ConTeXt users
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.
I have just accidentally discovered it.
Many thanks for your help,
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
___________________________________________________________________________________
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
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: underscore hyphenation
2014-12-10 20:03 underscore hyphenation Pablo Rodriguez
@ 2014-12-10 21:58 ` Hans Hagen
2014-12-11 17:15 ` Pablo Rodriguez
0 siblings, 1 reply; 3+ messages in thread
From: Hans Hagen @ 2014-12-10 21:58 UTC (permalink / raw)
To: ntg-context
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.
>
> I have just accidentally discovered it.
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 your help,
>
> 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
>
--
-----------------------------------------------------------------
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
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: underscore hyphenation
2014-12-10 21:58 ` Hans Hagen
@ 2014-12-11 17:15 ` Pablo Rodriguez
0 siblings, 0 replies; 3+ messages in thread
From: Pablo Rodriguez @ 2014-12-11 17:15 UTC (permalink / raw)
To: mailing list for ConTeXt users
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
___________________________________________________________________________________
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
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2014-12-11 17:15 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-12-10 20:03 underscore hyphenation Pablo Rodriguez
2014-12-10 21:58 ` Hans Hagen
2014-12-11 17:15 ` Pablo Rodriguez
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).