extra line after switchtobodyfont
A call to \switchtobodyfont introduces extra vertical spacing as can be seen in the example. Is this intentional or is it something like a % missing somewhere in a macro? Hans van der Meer \setuppapersize[A6][A6] \setupbodyfont[lucidaot] \starttext First line.\crlf \start \switchtobodyfont[euler] Font switch here.\crlf \stop Last line. \hairline First line.\crlf \start Font switch here.\crlf \stop Last line. \stoptext
A call to \switchtobodyfont introduces extra vertical spacing as can be seen in the example. Is this intentional or is it something like a % missing somewhere in a macro? Hans van der Meer Sorry, flew accidentally to early away. Here the attached output. \setuppapersize[A6][A6] \setupbodyfont[lucidaot] \starttext First line.\crlf \start \switchtobodyfont[euler] Font switch here.\crlf \stop Last line. \hairline First line.\crlf \start Font switch here.\crlf \stop Last line. \stoptext
Am 02.05.2013 um 12:40 schrieb "Meer, H. van der"
A call to \switchtobodyfont introduces extra vertical spacing as can be seen in the example. Is this intentional or is it something like a % missing somewhere in a macro?
Hans van der Meer
Sorry, flew accidentally to early away. Here the attached output.
\setuppapersize[A6][A6] \setupbodyfont[lucidaot] \starttext First line.\crlf \start \switchtobodyfont[euler] Font switch here.\crlf \stop Last line. \hairline First line.\crlf \start Font switch here.\crlf \stop Last line. \stoptext
Is there a reason why you use \crlf to end the lines? When you would end the paragraph after each line the additional line wouldn't appear. Wolfgang
There is more to it then a preference for \crlf, typescript loading introduces a lot of spurious white, that not always can be made to disappear. I tracked it down to a macro in type-ini.mkvi:
\def\font_typescript_process_typescript_file_and_store
{*\expandafter\let\expandafter\t_font_typescripts\csname\??typescriptfiles\currenttypefile\endcsname
A\ifx\t_font_typescripts\relax
B\font_typescript_process_typescript_store_indeed
C\fi
D\the\t_font_typescripts}
The ABCD*'s were added to see what happens. See the screen shot from one of my tests (<br/> results in \crlf but does not sit between text and fontswitch \switchtobodyfont). My guess is that the token register \t_font_typescripts is the source of the spaces, but I am not further than that. I have already mailed Hans Hagen about these findings.
[cid:AE3D66B6-9CD5-4377-B68D-AED490D0487E@fritz.box]
Hans van der Meer
On 2 May 2013, at 11:17 PM, Wolfgang Schuster
Am 03.05.2013 um 09:34 schrieb "Meer, H. van der"
There is more to it then a preference for \crlf, typescript loading introduces a lot of spurious white, that not always can be made to disappear. I tracked it down to a macro in type-ini.mkvi:
\def\font_typescript_process_typescript_file_and_store {*\expandafter\let\expandafter\t_font_typescripts\csname\??typescriptfiles\currenttypefile\endcsname A\ifx\t_font_typescripts\relax B\font_typescript_process_typescript_store_indeed C\fi D\the\t_font_typescripts}
The ABCD*'s were added to see what happens. See the screen shot from one of my tests (<br/> results in \crlf but does not sit between text and fontswitch \switchtobodyfont). My guess is that the token register \t_font_typescripts is the source of the spaces, but I am not further than that. I have already mailed Hans Hagen about these findings.
The spaces in the output come from the line ending after the \definefontsynonym entry in the typescript and extra line in your other example from the empty lines between the typescript blocks and not from the macro above. \starttext A\crlf B\crlf \stoptext Wolfgang
I did some more experiments. In the macro below delete ABC and replace D by ! then the output of the test will match.
example1 is made with the type-imp-euler.mkiv as given below. I removed every space in it, ended every ] with a % and commented [texgyre] out. In the log can be seen that --as far as I am aware-- just that euler file is loaded and processed.
For further testing I added a blank line before the starttypescript[euler]% line and the example2 results. There is indeed an effect from the intervening newline.
Also removed space from type-imp-latinmodern.mkiv and type-imp-lmnames.mkiv.
But I still cannot explain where the remaining spaces do come from. There are a few places in type-ini.mkvi with space after an } in a macro, but I have patched these in my system.
Any idea how further? More from \loadfontgoodies[lm]? To what file does that resolve?
I am willing to clean up the existing typescript files and sending them where they can be incorporated. But if that is not al…
Hans van der Meer
Minimal Tex code:
\setuppapersize[A5][A5]
%\usetypescriptfile[euler]\usetypescript[euler]
\tracetypescriptstrue
\setupbodyfont[lmodern,10pt]
\starttext Before\writestatus{++++++++}{}\switchtobodyfont[euler,10pt]\writestatus{--------}{}Fontswitch\stoptext
Sample from type-imp-euler.mkiv
%\loadtypescriptfile[texgyre]%
\starttypescriptcollection[pagella-euler]%
\starttypescript[\s!math][euler]%
\definefontsynonym[EulerMath][\s!file:euler.otf]%
\stoptypescript
\starttypescript[\s!math][euler][\s!name]%
Relevant part of the log:
++++++++ >
fonts > request: [euler] [] []
fonts > auto load typescript file 1: [euler]
fonts > request: [euler] [] []
(/Users/hansm/TeX/texmf/tex/context/base/type-imp-euler.mkiv)
fonts > match: [euler]
fonts > define: [euler] [rm] [serif] [euler]
fonts > request: [serif] [euler] [name]
fonts > match: [serif] [euler] [name]
fonts > request: [serif] [default] [size]
fonts > match: [serif] [default] [size]
fonts > define: [euler] [tt] [mono] [modern]
fonts > request: [mono] [modern] [name]
fonts > match: [mono] [modern,latin-modern-designsize,latin-modern] [name]
fonts > match: [mono] [modern,latin-modern,modern-variable,latin-modern-variable,modern-condensed,latin-modern-condensed]
fonts > request: [mono] [default] [size]
fonts > match: [mono] [default] [size]
fonts > define: [euler] [mm] [math] [euler]
fonts > request: [math] [euler] [name]
fonts > match: [math] [euler]
fonts > match: [math] [euler] [name]
fonts > request: [math] [default] [size]
fonts > match: [math] [default] [size]
-------- [cid:70BCE0AE-8EE4-4E82-B545-913CB0DE816F@fritz.box] >
[cid:58DBF4D7-539A-4FE8-A799-2BEAED31F7DE@fritz.box]
On 3 May 2013, at 9:43 AM, Wolfgang Schuster
Am 03.05.2013 um 11:19 schrieb "Meer, H. van der"
I did some more experiments. In the macro below delete ABC and replace D by ! then the output of the test will match. example1 is made with the type-imp-euler.mkiv as given below. I removed every space in it, ended every ] with a % and commented [texgyre] out. In the log can be seen that --as far as I am aware-- just that euler file is loaded and processed. For further testing I added a blank line before the starttypescript[euler]% line and the example2 results. There is indeed an effect from the intervening newline. Also removed space from type-imp-latinmodern.mkiv and type-imp-lmnames.mkiv. But I still cannot explain where the remaining spaces do come from. There are a few places in type-ini.mkvi with space after an } in a macro, but I have patched these in my system.
Do you mean the missing % after \doifsomething etc.? These lines don’t need a % because TeX gobbles the spaces between the arguments.
Any idea how further? More from \loadfontgoodies[lm]? To what file does that resolve?
The commands loads lm.lfg Wolfgang
On 3 May 2013, at 12:28 PM, Wolfgang Schuster
Do you mean the missing % after \doifsomething etc.? These lines don’t need a % because TeX gobbles the spaces between the arguments.
I wasn't aware of that, but will remember.
Any idea how further? More from \loadfontgoodies[lm]? To what file does that resolve?
The commands loads lm.lfg
The somewhat simpleminded idea of adding \ignorespaces at the end of the \definetypeface macro and friends, will not work I am afraid. Is there a possibilty to remove all whitespace from the tokens in \t_font_typescripts or prevent them from entering? Perhaps in the lua end? Or is it possible to assign to all whitespace characters (space, tab, newline) a category code 9 when reading/processing the typescript definitions? Hans van der Meer
This might be interesting. The example I gave before was now typeset with type-imp-euler.mkiv cannibalized to \endinput in the very first line. Then there are no spurious spaces and 5 executions of the recursive loop from \t_font_typescripts.
Thus, even though in type-imp-euler.mkiv all empty lines were removed, all intermediate spaces removed, all macros ended in ]% en texgyre not loaded, there is still spurious space. From the log I see that there are requests for [mono][modern] etc.
In order to locate these I have reduced the euler file to one define:
\starttypescript[euler]%
\definetypeface[euler][\s!mm][\s!math][euler][\s!default]%
\quittypescriptscanning
\stoptypescript
Now I get one or possibly two spurious spaces. But I cannot easily find which typescript file is involved. Do you know this? Exerpt from the log:
++++++++ >
fonts > request: [euler] [] []
fonts > auto load typescript file 1: [euler]
fonts > request: [euler] [] []
(/Users/hansm/TeX/texmf/tex/context/base/type-imp-euler.mkiv)
fonts > match: [euler]
fonts > define: [euler] [mm] [math] [euler]
fonts > request: [math] [euler] [name]
fonts > auto load typescript file 2: [euler]
fonts > request: [math] [euler] [name]
fonts > request: [math] [default] [size]
fonts > match: [math] [default] [size]
fonts > defining > font with asked name 'unknown' is not found using lookup 'file'
fonts > defining > unknown font 'unknown', loading aborted
fonts > defining > unable to define 'unknown' as 'euler-10pt-mm-mb--3'
fonts > defining > font with asked name 'unknown' is not found using lookup 'file'
fonts > defining > unknown font 'unknown', loading aborted
fonts > defining > unable to define 'unknown' as 'euler-10pt-mm-mb--2'
fonts > defining > font with asked name 'unknown' is not found using lookup 'file'
fonts > defining > unknown font 'unknown', loading aborted
fonts > defining > unable to define 'unknown' as 'euler-10pt-mm-mb--1'
-------- >
By the way. Is it correct that alone \definetypeface, \definefontsynonym, \starttypescriptcollection must be closed by ]% while for example \starttypescript[] seems to do no harm?
Hans van der Meer
On 3 May 2013, at 1:06 PM, "Meer, H. van der"
Seems finally solved (sigh). I cleaned out all files loading typescripts on the fly.
- typescript macros ending in ] at the end of a line have now ]% at the end of the line
- empty lines have been removed for clarity
- all files now have \endinput at the end.
The files changed fit in a 54KB zip and I can send them if Hans/Wolfgang/.. wants to incorporate them in the next beta.
Hans van der Meer
On 3 May 2013, at 9:43 AM, Wolfgang Schuster
The spaces in the output come from the line ending after the \definefontsynonym entry in the typescript and extra line in your other example from the empty lines between the typescript blocks and not from the macro above.
On 2013-05-03, at 7:36 PM, "Meer, H. van der"
Seems finally solved (sigh). I cleaned out all files loading typescripts on the fly. - typescript macros ending in ] at the end of a line have now ]% at the end of the line - empty lines have been removed for clarity - all files now have \endinput at the end.
The files changed fit in a 54KB zip and I can send them if Hans/Wolfgang/.. wants to incorporate them in the next beta.
I haven't followed this thread in detail, but an alternative is to redefine \starttypescript etc. to use a different catcode regime so that new lines and spaces are ignores (similar to \starttexdefinition, etc) Aditya
On 4 May 2013, at 9:21 AM, Aditya Mahajan
On 2013-05-03, at 7:36 PM, "Meer, H. van der"
wrote: Seems finally solved (sigh). I cleaned out all files loading typescripts on the fly. - typescript macros ending in ] at the end of a line have now ]% at the end of the line - empty lines have been removed for clarity - all files now have \endinput at the end.
The files changed fit in a 54KB zip and I can send them if Hans/Wolfgang/.. wants to incorporate them in the next beta.
I haven't followed this thread in detail, but an alternative is to redefine \starttypescript etc. to use a different catcode regime so that new lines and spaces are ignores (similar to \starttexdefinition, etc)
Would be nice. But doing this is left to other people than me, I feel not qualified to tinker with that code. You would like to challenge Hans Hagen? Hans van der Meer
Hi Hans, everybody, Hans van der Meer wrote:
Would be nice. But doing this is left to other people than me, I feel not qualified to tinker with that code. You would like to challenge Hans Hagen?
Last week's thread about ligatures got unpleasantly close to flaming at times; so, just in case, I'd like to ask that this one stays calm. That last sentence sounded a bit more antagonistic than you intended, perhaps. Aditya was simply making a suggestion, not ‘challenging’ Hans (either of the Hanses ^_^). Also: thank you for the work you put into removing/commenting out all spaces in typescript files; a 54 kB zip is nothing to sneeze at. My best wishes to everybody in Bachotek / at BachoTeX — I hope the weather is as fine there as it is here in Leiden. Cheers, Sietse
Am 04.05.2013 um 09:21 schrieb Aditya Mahajan
On 2013-05-03, at 7:36 PM, "Meer, H. van der"
wrote: Seems finally solved (sigh). I cleaned out all files loading typescripts on the fly. - typescript macros ending in ] at the end of a line have now ]% at the end of the line - empty lines have been removed for clarity - all files now have \endinput at the end.
The files changed fit in a 54KB zip and I can send them if Hans/Wolfgang/.. wants to incorporate them in the next beta.
I haven't followed this thread in detail, but an alternative is to redefine \starttypescript etc. to use a different catcode regime so that new lines and spaces are ignores (similar to \starttexdefinition, etc)
A better method is to ignore the endlinechar when typescript files are loaded. \newcount\savedendlinechar \starttext Line 1\crlf \savedendlinechar\endlinechar \endlinechar\minusone \switchtobodyfont[pagella] \endlinechar\savedendlinechar Line 2 \stoptext Wolfgang
On 5/4/2013 6:59 PM, Wolfgang Schuster wrote:
Am 04.05.2013 um 09:21 schrieb Aditya Mahajan
: On 2013-05-03, at 7:36 PM, "Meer, H. van der"
wrote: Seems finally solved (sigh). I cleaned out all files loading typescripts on the fly. - typescript macros ending in ] at the end of a line have now ]% at the end of the line - empty lines have been removed for clarity - all files now have \endinput at the end.
The files changed fit in a 54KB zip and I can send them if Hans/Wolfgang/.. wants to incorporate them in the next beta.
I haven't followed this thread in detail, but an alternative is to redefine \starttypescript etc. to use a different catcode regime so that new lines and spaces are ignores (similar to \starttexdefinition, etc)
A better method is to ignore the endlinechar when typescript files are loaded.
\newcount\savedendlinechar
\starttext
Line 1\crlf \savedendlinechar\endlinechar \endlinechar\minusone \switchtobodyfont[pagella] \endlinechar\savedendlinechar Line 2
\stoptext
in fact, that should happen automatically but maybe i messed up something ----------------------------------------------------------------- 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 -----------------------------------------------------------------
On 5/7/2013 10:11 PM, Hans Hagen wrote:
On 5/4/2013 6:59 PM, Wolfgang Schuster wrote:
Am 04.05.2013 um 09:21 schrieb Aditya Mahajan
: On 2013-05-03, at 7:36 PM, "Meer, H. van der"
wrote: Seems finally solved (sigh). I cleaned out all files loading typescripts on the fly. - typescript macros ending in ] at the end of a line have now ]% at the end of the line - empty lines have been removed for clarity - all files now have \endinput at the end.
The files changed fit in a 54KB zip and I can send them if Hans/Wolfgang/.. wants to incorporate them in the next beta.
I haven't followed this thread in detail, but an alternative is to redefine \starttypescript etc. to use a different catcode regime so that new lines and spaces are ignores (similar to \starttexdefinition, etc)
A better method is to ignore the endlinechar when typescript files are loaded.
\newcount\savedendlinechar
\starttext
Line 1\crlf \savedendlinechar\endlinechar \endlinechar\minusone \switchtobodyfont[pagella] \endlinechar\savedendlinechar Line 2
\stoptext
in fact, that should happen automatically but maybe i messed up something
(1) i adapted \loadfoundtypescriptfile (order of things, more robust) (2) i adapted type-imp-pagella (had series of two defs per line which introduced the spaces) ----------------------------------------------------------------- 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 -----------------------------------------------------------------
Am 03.05.2013 um 09:34 schrieb "Meer, H. van der"
There is more to it then a preference for \crlf […]
\setupwhitespace[line] \starttext \subject{Regular paragraphs} Line 1\par \start \switchtobodyfont[termes] Line 2\par \stop Line 3 \subject{Packed paragraphs} \startpacked Line 4\par \start \switchtobodyfont[pagella] Line 5 \par \stop Line 6 \stoppacked \subject{Line breaks with \tex{crlf}} Line 7 \crlf \start \switchtobodyfont[euler] Line 8 \crlf \stop Line 9 \stoptext Wolfgang
On 2013–05–02 Meer, H. van der wrote:
A call to \switchtobodyfont introduces extra vertical spacing as can be seen in the example. Is this intentional or is it something like a % missing somewhere in a macro?
Loading the typescript in the setup area should get rid of the space. See http://www.ntg.nl/pipermail/ntg-context/2013/072892.html Marco
I see. But that means I have to load various typescript files beforehand and then switch at a later moment. It is possible of course, but unexpected and a pain in the ass - if I may say so. Could it be solved once and for all by going through the typescript files? If I can find time for it, I will look into the matter too.
Hans van der Meer
On 2 May 2013, at 12:48 PM, Marco Patzer
On 2013–05–02 Meer, H. van der wrote:
A call to \switchtobodyfont introduces extra vertical spacing as can be seen in the example. Is this intentional or is it something like a % missing somewhere in a macro?
Loading the typescript in the setup area should get rid of the space.
See http://www.ntg.nl/pipermail/ntg-context/2013/072892.html
Indeed, adding \usetypescriptfile[euler]\usetypescript[euler] before \starttext makes the extra vertical spacing go away in a simple test file. But that doesn't solve my problem, because I am typesetting xml data wherein a font change can be dictated from the inside. See the example code (supporting modules not included):
\startbuffer[font]
<?xml version="1.0" encoding="UTF-8"?>
<root>
First line.<br/>
<fontswitch family="euler">
Font switch here.
</fontswitch><br/>
Last line.
</root>
\stopbuffer
\xmlprocessbuffer{root}{font}{}
There is no way to have the typescript loaded before the \starttext, because it is not known what fonts will be called up by the xml. And loading it from within the data processed is too late.
I therefore conclude that this typescript problem should be fundamentally solved, instead of resorting to a subterfuge as loading things beforehand to avoid - what seems to me - coding mistakes.
Hans van der Meer
On 2 May 2013, at 12:48 PM, Marco Patzer
On 2013–05–02 Meer, H. van der wrote:
A call to \switchtobodyfont introduces extra vertical spacing as can be seen in the example. Is this intentional or is it something like a % missing somewhere in a macro?
Loading the typescript in the setup area should get rid of the space.
See http://www.ntg.nl/pipermail/ntg-context/2013/072892.html
Marco ___________________________________________________________________________________ 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 ___________________________________________________________________________________
participants (6)
-
Aditya Mahajan
-
Hans Hagen
-
Marco Patzer
-
Meer, H. van der
-
Sietse Brouwer
-
Wolfgang Schuster