ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Pablo Rodriguez via ntg-context <ntg-context@ntg.nl>
To: Hans Hagen via ntg-context <ntg-context@ntg.nl>
Cc: Pablo Rodriguez <oinos@gmx.es>
Subject: Re: Bug in verbatim wrapping examples on wiki
Date: Sun, 5 Feb 2023 16:52:18 +0100	[thread overview]
Message-ID: <3d1e9092-91a5-1480-2710-bdd4405b4523@gmx.es> (raw)
In-Reply-To: <a1e56f22-51a6-763b-3425-a72b9945b4b7@freedom.nl>

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

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : https://contextgarden.net
___________________________________________________________________________________

  reply	other threads:[~2023-02-05 15:52 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-04  6:49 Hugo Landau via ntg-context
2023-02-04  9:37 ` Pablo Rodriguez via ntg-context
2023-02-05 11:32   ` Pablo Rodriguez via ntg-context
2023-02-05 11:50     ` Floris van Manen via ntg-context
2023-02-05 12:13     ` Hans Hagen via ntg-context
2023-02-05 15:52       ` Pablo Rodriguez via ntg-context [this message]
2023-02-06 17:59         ` Hans Hagen via ntg-context
2023-02-15 18:35 ` Pablo Rodriguez via ntg-context

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3d1e9092-91a5-1480-2710-bdd4405b4523@gmx.es \
    --to=ntg-context@ntg.nl \
    --cc=oinos@gmx.es \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).