Re: [NTG-context] underscore hyphenation and hz

2021-05-17 Thread Pablo Rodriguez
On 5/10/21 3:35 PM, Pablo Rodriguez wrote:
> Hans,
>
> I’m afraid that underscore hyphenation has issues with font expansion:
> [...]

Hans,

many thanks for the fix in current latest (2021.05.15 22:45).

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
___


[NTG-context] underscore hyphenation and hz

2021-05-10 Thread Pablo Rodriguez
Hans,

I’m afraid that underscore hyphenation has issues with font expansion:

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

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

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

  \starttext
\hsize\zeropoint
abcde
  \stoptext

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
___


Re: [NTG-context] underscore hyphenation not working

2021-05-10 Thread Pablo Rodriguez
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
___


Re: [NTG-context] underscore hyphenation not working

2021-05-10 Thread Hans Hagen

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
___


Re: [NTG-context] underscore hyphenation not working

2021-05-10 Thread Pablo Rodriguez
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
___


Re: [NTG-context] underscore hyphenation not working

2021-05-09 Thread Hans Hagen

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
___


Re: [NTG-context] underscore hyphenation not working

2021-05-09 Thread Pablo Rodriguez
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
___


Re: [NTG-context] underscore hyphenation not working

2021-05-09 Thread Hans Hagen

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
___


[NTG-context] underscore hyphenation not working

2021-05-08 Thread Pablo Rodriguez
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
___


Re: [NTG-context] underscore hyphenation in LMTX

2019-05-01 Thread Pablo Rodriguez
On 4/29/19 10:57 AM, Hans Hagen wrote:
> On 4/27/2019 1:51 PM, Pablo Rodriguez wrote:
>> [...]
>> I get the underscore hyphenation with latest ConTeXt beta (LuaTeX-1.10),
>> but not with latest LMTX (LuaTeX-2.0).
>>
>> Am I missing something here?
>
> use slot '0' instead of '1' (i'll catch it anyway)

Hans,

many thanks for the trick and the improved code.

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
___


Re: [NTG-context] underscore hyphenation in LMTX

2019-04-29 Thread Hans Hagen

On 4/27/2019 1:51 PM, Pablo Rodriguez wrote:

Dear list,

I have the following sample:

 \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

 \definehyphenationfeatures
   [whatever]
   [righthyphenchar="FE000]

 \setuphyphenation[method=traditional]
 \sethyphenationfeatures[strict, whatever]

 \setuppapersize[A10, lanscape]

 \starttext
 \startmakeup[standard]
 \hsize\zeropoint
 \tt definebodyfont
 \stopmakeup
 \stoptext

I get the underscore hyphenation with latest ConTeXt beta (LuaTeX-1.10),
but not with latest LMTX (LuaTeX-2.0).

Am I missing something here?


use slot '0' instead of '1' (i'll catch it anyway)

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
___


[NTG-context] underscore hyphenation in LMTX

2019-04-27 Thread Pablo Rodriguez
Dear list,

I have the following sample:

\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

\definehyphenationfeatures
  [whatever]
  [righthyphenchar="FE000]

\setuphyphenation[method=traditional]
\sethyphenationfeatures[strict, whatever]

\setuppapersize[A10, lanscape]

\starttext
\startmakeup[standard]
\hsize\zeropoint
\tt definebodyfont
\stopmakeup
\stoptext

I get the underscore hyphenation with latest ConTeXt beta (LuaTeX-1.10),
but not with latest LMTX (LuaTeX-2.0).

Am I missing something here?

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
___


Re: [NTG-context] underscore hyphenation

2014-12-11 Thread Pablo Rodriguez
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
___

[NTG-context] underscore hyphenation

2014-12-10 Thread Pablo Rodriguez
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
___

Re: [NTG-context] underscore hyphenation

2014-12-10 Thread Hans Hagen

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
___