ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* underscore hyphenation not working
@ 2021-05-08 17:55 Pablo Rodriguez
  2021-05-09 14:40 ` Hans Hagen
  0 siblings, 1 reply; 7+ messages in thread
From: Pablo Rodriguez @ 2021-05-08 17:55 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Hans,

some time ago, you provided me with the following code to hyphenate sha
with underscore:

  \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]

      \sethyphenationfeatures[sha]%
      \setuphyphenation[method=traditional]%

  \starttext
  \hsize\zeropoint
  \tt abcde
  \stoptext

I’m afraid that it isn’t working as expected with current latest from
2021.05.06 23:35.

I wonder whether this might be caused by a bug or the code should be
adapted to current latest.

Many thanks for your help,

Pablo
--
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: underscore hyphenation not working
  2021-05-08 17:55 underscore hyphenation not working Pablo Rodriguez
@ 2021-05-09 14:40 ` Hans Hagen
  2021-05-09 16:09   ` Pablo Rodriguez
  0 siblings, 1 reply; 7+ messages in thread
From: Hans Hagen @ 2021-05-09 14:40 UTC (permalink / raw)
  To: mailing list for ConTeXt users, Pablo Rodriguez

On 5/8/2021 7:55 PM, Pablo Rodriguez wrote:

> I wonder whether this might be caused by a bug or the code should be
> adapted to current latest.
hm, i'll check it ... looks like some lua closure side effect

Hans

-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
        tel: 038 477 53 69 | www.pragma-ade.nl | 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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: underscore hyphenation not working
  2021-05-09 14:40 ` Hans Hagen
@ 2021-05-09 16:09   ` Pablo Rodriguez
  2021-05-09 17:46     ` Hans Hagen
  0 siblings, 1 reply; 7+ messages in thread
From: Pablo Rodriguez @ 2021-05-09 16:09 UTC (permalink / raw)
  To: ntg-context

On 5/9/21 4:40 PM, Hans Hagen wrote:
> On 5/8/2021 7:55 PM, Pablo Rodriguez wrote:
>
>> I wonder whether this might be caused by a bug or the code should be
>> adapted to current latest.
> hm, i'll check it ... looks like some lua closure side effect

Many thanks for your ultra-fast fix, Hans.

Current latest from 2021.05.09 17:14 fixes the issue.

Many thanks for your help,

Pablo
--
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: underscore hyphenation not working
  2021-05-09 16:09   ` Pablo Rodriguez
@ 2021-05-09 17:46     ` Hans Hagen
  2021-05-10  6:42       ` Pablo Rodriguez
  0 siblings, 1 reply; 7+ messages in thread
From: Hans Hagen @ 2021-05-09 17:46 UTC (permalink / raw)
  To: mailing list for ConTeXt users, Pablo Rodriguez

On 5/9/2021 6:09 PM, Pablo Rodriguez wrote:
> On 5/9/21 4:40 PM, Hans Hagen wrote:
>> On 5/8/2021 7:55 PM, Pablo Rodriguez wrote:
>>
>>> I wonder whether this might be caused by a bug or the code should be
>>> adapted to current latest.
>> hm, i'll check it ... looks like some lua closure side effect
> 
> Many thanks for your ultra-fast fix, Hans.
> 
> Current latest from 2021.05.09 17:14 fixes the issue.
> 
> Many thanks for your help,
you can also retest the advance

Hans

-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
        tel: 038 477 53 69 | www.pragma-ade.nl | 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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: underscore hyphenation not working
  2021-05-09 17:46     ` Hans Hagen
@ 2021-05-10  6:42       ` Pablo Rodriguez
  2021-05-10  7:36         ` Hans Hagen
  0 siblings, 1 reply; 7+ messages in thread
From: Pablo Rodriguez @ 2021-05-10  6:42 UTC (permalink / raw)
  To: ntg-context

On 5/9/21 7:46 PM, Hans Hagen wrote:
> [...]
> you can also retest the advance

It works fine now.

A minor issue happens with SumatraPDF-3.1.2 (aside from font advance):

  \setuppapersize[A6]
  \definefontfamily[mainface][rm]
      [TeX Gyre Pagella]
  \setupbodyfont[mainface]
  \starttext
    \input zapf
  \stoptext

Lines 3, 7, 10, 12 and 13 lack spaces between words:

  Coming back to the use of typefaces in
  electronic publishing: many of the new
  typographersreceivetheirknowledgeand
  information about the rules of typogra-
  phy from books, from computer maga-
  zines or the instruction manuals which
  theygetwiththepurchaseofaPCorsoft-
  ware. There is not so much basic instruc-
  tion, as of now, as there was in the old
  days,showingthedifferencesbetweengood
  and bad typographic design. Many peo-
  plearejustfascinatedbytheirPC'stricks,
  andthinkthatawidely--praisedprogram,
  called up on the screen, will make every-
  thing automatic from now on.

Although this only happens with SumatraPDF, it would be great to have
standard spacing (otherwise searching is impossible).

Many thanks for your help,

Pablo
--
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: underscore hyphenation not working
  2021-05-10  6:42       ` Pablo Rodriguez
@ 2021-05-10  7:36         ` Hans Hagen
  2021-05-10 13:19           ` Pablo Rodriguez
  0 siblings, 1 reply; 7+ messages in thread
From: Hans Hagen @ 2021-05-10  7:36 UTC (permalink / raw)
  To: mailing list for ConTeXt users, Pablo Rodriguez

On 5/10/2021 8:42 AM, Pablo Rodriguez wrote:
> On 5/9/21 7:46 PM, Hans Hagen wrote:
>> [...]
>> you can also retest the advance
> 
> It works fine now.
> 
> A minor issue happens with SumatraPDF-3.1.2 (aside from font advance):

Works fine with 3.3.13 here. (btw, if after decades of pdf viewers still 
don't handle this well, i suppose it will never be okay, maybe because 
it's not that important to copy/paste)

Coming back to the use of typefaces in
electronic publishing: many of the new
typographers receive their knowledge and
information about the rules of typogra-
phy from books, from computer maga-
zines or the instruction manuals which
they get with the purchase of a PC or soft-
ware. There is not so much basic instruc-
tion, as of now, as there was in the old
days, showing the differences between good
and bad typographic design. Many peo-
ple are just fascinated by their PC's tricks,
and think that a widely--praised program,
called up on the screen, will make every-
thing automatic from now on.

but at the cost of runtime you can try \setupbackend [space=yes]

Hans

-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
        tel: 038 477 53 69 | www.pragma-ade.nl | 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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: underscore hyphenation not working
  2021-05-10  7:36         ` Hans Hagen
@ 2021-05-10 13:19           ` Pablo Rodriguez
  0 siblings, 0 replies; 7+ messages in thread
From: Pablo Rodriguez @ 2021-05-10 13:19 UTC (permalink / raw)
  To: ntg-context

On 5/10/21 9:36 AM, Hans Hagen wrote:
> [...]
> but at the cost of runtime you can try \setupbackend [space=yes]

It works perfectly fine, but not with font expansion:

  \definefontfeature
    [default]
    [default]
    [expansion=quality]
  \setupalign
    [hz]

  \setuppapersize[A6]
  \setupbodyfont[pagella]
  \setupbackend [space=yes]
  \starttext
    \input zapf
  \stoptext

  Com i ng back t o t he use o f ty pe f aces i n
  e l ec tr on i c pub li sh i ng : man y o f t he new
  ty pog r aphe r s r ece iv e t he ir know l edge and
  i n f o r ma ti on abou t t he r u l es o f ty pog r a -
  ph y fr om books , fr om compu t e r maga -
  z i nes o r t he i ns tr uc ti on manua l s wh i ch
  t he y ge t w it h t he pu r chase o f a PC o r so ft-
  wa r e . T he r e i s no t so much bas i c i ns tr uc -
  ti on , as o f now , as t he r e was i n t he o l d
  da y s , show i ng t he d iff e r ences be t ween
  good and bad ty pog r aph i c des i gn . Man y
  peop l e a r e j us t f asc i na t ed b y t he ir PC ' s
  tri cks , and t h i nk t ha t a w i de ly -- p r a i sed
  p r og r am , ca ll ed up on t he sc r een , w ill
  make e v e ryt h i ng au t oma ti c fr om now on .

Pablo
--
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2021-05-10 13:19 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-08 17:55 underscore hyphenation not working Pablo Rodriguez
2021-05-09 14:40 ` Hans Hagen
2021-05-09 16:09   ` Pablo Rodriguez
2021-05-09 17:46     ` Hans Hagen
2021-05-10  6:42       ` Pablo Rodriguez
2021-05-10  7:36         ` Hans Hagen
2021-05-10 13:19           ` 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).