[NTG-context] Bug in verbatim wrapping examples on wiki
Pablo Rodriguez
oinos at gmx.es
Sun Feb 5 16:52:18 CET 2023
On 2/5/23 13:13, Hans Hagen via ntg-context wrote:
> On 2/5/2023 12:32 PM, Pablo Rodriguez via ntg-context wrote:
>> [...]
>> Are we missing something or is this a bug?
> what do you expect as result? (maybe try \righthyphenmin=1)
Line breaks are removing characters.
In the sample below, output from
\hsize\zeropoint
\sha{a1b2c3d4}
reads:
a
_
_
_
_
3d4
Iâm afraid \righthyphenmin=-1 prevents hyphenation (it seems to do it
everywhere).
Sorry, but I donât get what is wrong here.
Many thanks for your help,
Pablo
\startluacode
function document.addfunnyhyphen(tfmdata)
local underscore = utf.byte("_")
local char = tfmdata.characters[underscore]
if not char then return end
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")
local shared = {
start = 1,
length = 1,
before = utf.char(0xFE000),
after = nil,
left = false,
right = false,
}
local all = table.setmetatableindex({ }, function(t,k)
return shared
end)
languages.hyphenators.traditional.installmethod("sha",
function(dictionary,word,n)
return all
end
)
\stopluacode
\definehyphenationfeatures
[sha]
[characters=all,
alternative=sha,
righthyphenchar="FE000]
\unexpanded\def\sha#1%
{\begingroup\tt
\righthyphenmin=-1
\sethyphenationfeatures[sha]%
\setuphyphenation[method=traditional]%
#1%
\endgroup}
\starttext
\startTEXpage[width=6em, offset=.25em]
\hsize\zeropoint
\sha{a1b2c3d4}
extraordinary linguistics
\righthyphenmin=-1
extraordinary linguistics
\stopTEXpage
\stoptext
More information about the ntg-context
mailing list