[NTG-context] Index formatting difference LMTX and MkIV

2020-08-26 Thread Rik Kabel

Hello list,

I have an index which uses multilevel indexing (a+b+c) to insert entries 
which contain snips of text. LMTX behaves differently from MkIV when 
trimming that text, resulting in line wrapping which does not happen 
with MKiV. I am not sure when this began -- I just picked up work again 
on this project this week after a hiatus of a couple of months.


This does not occur in every instance, but it happens often enough in 
this 20 page two-column index to add another full page, and it looks 
ugly in comparison (although perhaps no index looks good).


The source is the same for both LMTX and MkIV. There is no explicitly 
conditional coding.


With MkIV, I get:

With LMTX, I get:


I am struggling to prepare a MWE, but will try to do so if there is no 
obvious difference to those who ken the code. The problem may not be 
unique to register creation, but I have not noticed other appearances of 
the issue in the text.


--
Rik


___
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] setuplayout vs Indesign!

2020-08-26 Thread Pablo Rodriguez
On 8/26/20 12:13 PM, jbf wrote:
> [...]
> Maybe, one of these days, someone with experience in both ConTeXt and
> InDesign (since InDesign is used by very many commercial publishers, but
> I am trying to convince one of them of the value of ConTeXt) could offer
> a comparison of the layout terminology/measurements/requirements for
> both. I for one would find that very helpful.

Hi Julian,

https://wiki.contextgarden.net/Layout#Typesetting_areas contains a
graphical description of the areas and
https://wiki.contextgarden.net/Layout#Table_of_Parameters contains a
simple explanation.

I wonder whether this might help you.

Sorry, but I’m afraid I never used InDesign.

Just in case it helps,

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] CFF2 based variable fonts with SubRS

2020-08-26 Thread Hans Hagen

On 8/26/2020 11:01 AM, Marcel Fabian Krüger wrote:

Hi,

I was playing with the variable font support of ConTeXt's font loader
and noticed some issues.

   1. While parsing the LocalSubRS and GlobalSubRS Indices, ConTeXt tries
  to use 16bit count fields as in CFF(1) instead of 32bit fields as in
  CFF2, reducing the number of found subroutines by a factor of 65536.
  Effectivly this suppressed all subroutines in the fonts I tested.

   2. For fonts where the Top DICT does not contain an FDSelect entry,
  ConTeXt tries to read the Private dictionary offset from the Top
  dictionary as in name-keyed CFF1 fonts. This is not the expected
  behavior for CFF2, where the Top dictionary never contains the Privte
  offset.
  Instead, a missing FDSelect means that exactly one entry exists in
  FDArray which should be used for all CIDs. This caused problems
  when ConTeXt tried to find the Private directory in order to find
  local subroutines.

A test font demonstrating both issues is "SourceCode Variable"
https://github.com/adobe-fonts/source-code-pro/releases:

The document

\definefontfeature
   [light]
   [default]
   [axis={weight=200}]

\definefont
   [sourcelight]
   [file:SourceCodeVariable-Roman.otf*light]

\starttext
\sourcelight Hallo
\stoptext


Thanks. I'll check it. (Reminds me to check another issue in a variable 
font that I observed recently, something with accuracy, but of could 
also be a border case in a viewer as acrobat views ok.) I would not be 
surprised of there are more issues because at the time I wrote that code 
there were hardly any valid variable fonts and the specs were just 
showing up. (Most of those variable fonts were showcases.)


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] setuplayout vs Indesign!

2020-08-26 Thread jbf
Thank you. Let's see if the Quality Control person is convinced by what 
she gets with the suggested measurements.


I usually set things up 'as if' they would be on A4, in this case, 
\setuppapersize[ACN][A4] (ACN being the name I give to the 140x216mm 
book in question).


And yes, I have looked carefully at the 'Layout' section of 
Contextgarden, but the difficulty always is marrying its terminology 
with what someone wants who deals only with InDesign. And that causes 
confusion (for me, at least). But it certainly helps me to know that 
'/your left margin is backspace/', since I had been presuming that 
'leftmargin' meant left margin!


Maybe, one of these days, someone with experience in both ConTeXt and 
InDesign (since InDesign is used by very many commercial publishers, but 
I am trying to convince one of them of the value of ConTeXt) could offer 
a comparison of the layout terminology/measurements/requirements for 
both. I for one would find that very helpful.


Julian

On 26/8/20 6:33 pm, Henning Hraban Ramm wrote:



Am 26.08.2020 um 08:44 schrieb jbf :

Severe Covid-19 restrictions locally have left me out on a limb unable to be 
side-byside with people who can set me on track for a few things! Hence the 
bombardment of questions, for which I apologise. But almost there!

The InDesign QC individual (who accepts my ConTeXt-produced pdfs) wants some 
tweaking to my layout, saying, in simple terms: Odd/right pgs left margin 
should be 20mm and right margin 15mm; even/left pgs right margin 20mm and left 
margin 15mm.

I think the difficulty is that what InDesign calls margins might be termed a 
little differently in ConTeXt and I have no experience with InDesign.

My initial setup was as follows for a paper size defined as [width=140mm,height=216mm] 
double-sided setup (in other words a standard 8.5"x5.5" book):

\setuplayout

[backspace=16mm,
 topspace=12mm,
 header=6mm,
 headerdistance=10mm,
 footerdistance=9mm,
 footer=8mm,
 width=fit,
 horoffset=12.7mm,
 location=middle,
 height=198mm,
 marking=on]

There was no mention of 'margins' as such in that layout, and the result is 
close to what is wanted but not quite. Do I solve the problem by adding in: 
leftmargin=20mm,
rightmargin=15mm,

or is it some other item I need to adjust to ensure the 20mm/15mm dimensions 
requested?

If you don’t need marginals, your left margin is backspace, right margin is: 
paper width - width - backspace, i.e. for A4:

\setuplayout[
   backspace=20mm,
   width=175mm
]
\setuppagenumbering[alternative=doublesided] % mirror right and left pages


See also https://wiki.contextgarden.net/Layout

Hraban
___
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
___
___
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] CFF2 based variable fonts with SubRS

2020-08-26 Thread Marcel Fabian Krüger
Hi,

I was playing with the variable font support of ConTeXt's font loader
and noticed some issues.

  1. While parsing the LocalSubRS and GlobalSubRS Indices, ConTeXt tries
 to use 16bit count fields as in CFF(1) instead of 32bit fields as in
 CFF2, reducing the number of found subroutines by a factor of 65536.
 Effectivly this suppressed all subroutines in the fonts I tested.

  2. For fonts where the Top DICT does not contain an FDSelect entry,
 ConTeXt tries to read the Private dictionary offset from the Top
 dictionary as in name-keyed CFF1 fonts. This is not the expected
 behavior for CFF2, where the Top dictionary never contains the Privte
 offset.
 Instead, a missing FDSelect means that exactly one entry exists in
 FDArray which should be used for all CIDs. This caused problems
 when ConTeXt tried to find the Private directory in order to find
 local subroutines.

A test font demonstrating both issues is "SourceCode Variable"
https://github.com/adobe-fonts/source-code-pro/releases:

The document

\definefontfeature
  [light]
  [default]
  [axis={weight=200}]

\definefont
  [sourcelight]
  [file:SourceCodeVariable-Roman.otf*light]

\starttext
\sourcelight Hallo
\stoptext

generates

[...]
otf reader  > cff > unknown local call 14, case 2 : [] n=0
otf reader  > cff > unknown local call 11, case 2 : [] n=0
otf reader  > cff > unknown local call 138, case 2 : [] n=0
otf reader  > cff > unknown local call 314, case 2 : [300 -12] n=2
otf reader  > cff > unknown local call 607, case 2 : [-99 -66 99 174] 
n=4
otf reader  > fatal error in file 'SourceCodeVariable-Roman.otf': 
...e0dde776fb1556f32e/formats/luametatex/font-cff-macro.lua:1517: attempt to 
perform arithmetic on a nil value (local 'v')
stack traceback:
...e0dde776fb1556f32e/formats/luametatex/font-otr-macro.lua:2339: in 
metamethod 'add'
...e0dde776fb1556f32e/formats/luametatex/font-cff-macro.lua:1517: in 
local 'a'
...e0dde776fb1556f32e/formats/luametatex/font-cff-macro.lua:1980: in 
upvalue 'process'
[...]


A possible fix for both issues would be


diff --git a/tex/context/base/mkiv/font-cff.lua 
b/tex/context/base/mkiv/font-cff.lua
index c2cf0e699..d00637b8e 100644
--- a/tex/context/base/mkiv/font-cff.lua
+++ b/tex/context/base/mkiv/font-cff.lua
@@ -2265,8 +2265,8 @@ do
 
 end
 
-local function readglobals(f,data)
-local routines = readlengths(f)
+local function readglobals(f,data,version)
+local routines = readlengths(f,version == "cff2")
 for i=1,#routines do
 routines[i] = readbytetable(f,routines[i])
 end
@@ -2324,14 +2324,14 @@ local function readprivates(f,data)
 end
 end
 
-local function readlocals(f,data,dictionary)
+local function readlocals(f,data,dictionary,version)
 local header  = data.header
 local private = dictionary.private
 if private then
 local subroutineoffset = private.data.subroutines
 if subroutineoffset ~= 0 then
 setposition(f,header.offset+private.offset+subroutineoffset)
-local subroutines = readlengths(f)
+local subroutines = readlengths(f,version=="cff2")
 for i=1,#subroutines do
 subroutines[i] = readbytetable(f,subroutines[i])
 end
@@ -2394,7 +2394,7 @@ readers.parsecharstrings = parsecharstrings -- used in 
font-onr.lua (type 1)
 local function readnoselect(f,fontdata,data,glyphs,doshapes,version,streams)
 local dictionaries = data.dictionaries
 local dictionary   = dictionaries[1]
-readglobals(f,data)
+readglobals(f,data,version)
 readcharstrings(f,data,version)
 if version == "cff2" then
 dictionary.charset = nil
@@ -2402,9 +2402,19 @@ local function 
readnoselect(f,fontdata,data,glyphs,doshapes,version,streams)
 readencodings(f,data)
 readcharsets(f,data,dictionary)
 end
+local cid  = dictionary.cid
+local fdarray  = cid and cid.fdarray
+if fdarray and not dictionary.private then
+setposition(f,data.header.offset+fdarray)
+local dictionaries = readlengths(f,version=="cff2")
+assert(#dictionaries == 1)
+dictionaries[1] = readstring(f,dictionaries[1])
+parsedictionaries(data,dictionaries)
+dictionary.private = dictionaries[1].private
+end
 readprivates(f,data)
 parseprivates(data,data.dictionaries)
-readlocals(f,data,dictionary)
+readlocals(f,data,dictionary,version)
 startparsing(fontdata,data,streams)
 parsecharstrings(fontdata,data,glyphs,doshapes,version,streams)
 stopparsing(fontdata,data)
@@ -2416,7 +2426,7 @@ local function 
readfdselect(f,fontdata,data,glyphs,doshapes,version,streams)
 local dictionary   = dictionaries[1]
 local cid  = dictionary.cid
 local cidselect= cid and cid.fdselect
-readglobals(f,data)
+readglobals(f,data,version)
 readcharstrings(f,data,version)
 

Re: [NTG-context] setuplayout vs Indesign!

2020-08-26 Thread Henning Hraban Ramm


> Am 26.08.2020 um 08:44 schrieb jbf :
> 
> Severe Covid-19 restrictions locally have left me out on a limb unable to be 
> side-byside with people who can set me on track for a few things! Hence the 
> bombardment of questions, for which I apologise. But almost there!
> 
> The InDesign QC individual (who accepts my ConTeXt-produced pdfs) wants some 
> tweaking to my layout, saying, in simple terms: Odd/right pgs left margin 
> should be 20mm and right margin 15mm; even/left pgs right margin 20mm and 
> left margin 15mm.
> 
> I think the difficulty is that what InDesign calls margins might be termed a 
> little differently in ConTeXt and I have no experience with InDesign.
> 
> My initial setup was as follows for a paper size defined as 
> [width=140mm,height=216mm] double-sided setup (in other words a standard 
> 8.5"x5.5" book):
> 
> \setuplayout
> 
> [backspace=16mm,
> topspace=12mm, 
> header=6mm,
> headerdistance=10mm,
> footerdistance=9mm,
> footer=8mm,
> width=fit,
> horoffset=12.7mm,
> location=middle, 
> height=198mm, 
> marking=on]
> 
> There was no mention of 'margins' as such in that layout, and the result is 
> close to what is wanted but not quite. Do I solve the problem by adding in: 
> leftmargin=20mm,
> rightmargin=15mm,
> 
> or is it some other item I need to adjust to ensure the 20mm/15mm dimensions 
> requested?

If you don’t need marginals, your left margin is backspace, right margin is: 
paper width - width - backspace, i.e. for A4:

\setuplayout[
  backspace=20mm,
  width=175mm
]
\setuppagenumbering[alternative=doublesided] % mirror right and left pages


See also https://wiki.contextgarden.net/Layout

Hraban
___
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] setuplayout vs Indesign!

2020-08-26 Thread jbf
Severe Covid-19 restrictions locally have left me out on a limb unable 
to be side-byside with people who can set me on track for a few things! 
Hence the bombardment of questions, for which I apologise. But almost there!


The InDesign QC individual (who accepts my ConTeXt-produced pdfs) wants 
some tweaking to my layout, saying, in simple terms:/Odd/right pgs left 
margin should be 20mm and right margin 15mm; even/left pgs right margin 
20mm and left margin 15mm/.


I think the difficulty is that what InDesign calls margins might be 
termed a little differently in ConTeXt and I have no experience with 
InDesign.


My initial setup was as follows for a paper size defined as 
[width=140mm,height=216mm] double-sided setup (in other words a standard 
8.5"x5.5" book):


\setuplayout

[backspace=16mm,
    topspace=12mm,
    header=6mm,
    headerdistance=10mm,
    footerdistance=9mm,
    footer=8mm,
    width=fit,
    horoffset=12.7mm,
    location=middle,
    height=198mm,
    marking=on]

There was no mention of 'margins' as such in that layout, and the result 
is close to what is wanted but not quite. Do I solve the problem by 
adding in: leftmargin=20mm,

rightmargin=15mm,

or is it some other item I need to adjust to ensure the 20mm/15mm 
dimensions requested?


Julian



___
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
___