Re: [NTG-context] Problem with grid alignment and paragraph

2019-01-19 Thread Luca Donetti
On Mon, Jan 7, 2019 at 9:35 PM Wolfgang Schuster <
wolfgang.schuster.li...@gmail.com> wrote:

> Luca Donetti schrieb am 07.01.19 um 21:21:
> > On Sun, Jan 6, 2019 at 2:53 PM Wolfgang Schuster
> >  > > wrote:
> >
> > Luca Donetti schrieb am 14.12.18 um 22:14:
> > > Dear list,
> > >
> > > I am facing a problem with grid alignment when using paragraphs. I
> > > think it could be a bug because the MWE below produces lines
> > which are
> > > correctly aligned to the grid with the context version included in
> > > texlive 2017, but it does not seem to work with the context in
> > texlive
> > > 2018 and the current beta (ConTeXt  ver: 2018.12.07 19:37 MKIV beta
> > > fmt: 2018.12.14).
> > > This is the MWE:
> > >
> > > \setuplayout[grid=yes]
> > > \defineparagraphs[twocols][n=2]
> > > \showgrid
> > >
> > > \starttext
> > > \starttwocols
> > > \input knuth
> > > \nexttwocols
> > >   \input knuth
> > > \stoptwocols
> > > \stoptext
> > >
> > > Am I doing anything wrong? If not, I'll appreciate any
> > suggestion or
> > > workaround.
> >
> >
> https://tex.stackexchange.com/questions/468711/context-defineparagraphs-aligned-to-grid/
> >
> > Wolfgang
> >
> > Dear Wolfgang,
> >
> > thank you for your help. Unfortunately, if I follow the suggestion in
> > your link (using [location=depth]), the alignment improves but it is
> > still not good: some lines are on grid while some others are not. If I
> > understand correctly your answer, inside the \framed there is a table
> > and, in this case, it seems to me that the spacing between lines is
> > not always equal to the grid spacing.
> >
> > Is there a way to force the interline spacing inside the \framed
> > block? I'm sorry if this is a simple question, but I'm quite new to
> > context.
>
> The interlinespace is correct but the paragraphs environment is too high,
> location=bottom puts the text on the baseline but it adds an extra blank
> line at the begin of the environment.
>
> A simple fix to get rid of the extra line is to set the width of the frame
> border to 0pt which doesn’t matter when the rules are disabled.
>
> \setuplayout[grid=yes]
>
> \defineparagraphs [twocols] [n=2]
>
> \setupparagraphs
>[twocols]
>[location=bottom,
> rulethickness=0pt]
>
> \showgrid
>
> \starttext
>
> \starttwocols
>\input knuth
>\nexttwocols
>\input knuth
> \stoptwocols
>
> \stoptext
>
> Wolfgang
>

 Dear Wolfgang,

thank you very much for your reply (and sorry for my late reply). Your
suggestion do solve my minimal example but, unfortunately, not my real
world example. I will try to find another minimal example which still shows
the problem. In the meantime I'll try to play with different options of
location=.

LD
___
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] Scaling down symbols and emojis

2019-01-19 Thread User 19087
As far as I can tell (by experimentation), bodyfont environment
features resolve in this order:
* matching size in the current file
* default environment in the current file
* matching size in 'font-pre.mkiv'
* default environment in 'font-pre.mkiv'
* default to 1.0 otherwise
This applies to individual features such as 'a' and 'b' and not entire
blocks. For example, if the [12pt] block provides 'a' but not 'b'
while the [default] block provides 'a' and 'b', then both blocks will
be used: 'a' from [12pt] and 'b' from [default].

With one exception: the 'x' and 'xx' sizes cannot be modified by the
current file:

\setupbodyfont[12pt]
\setupbodyfontenvironment [default] [x=2.0,xx=2.0]
\starttext
  m{\tfx m}{\tfxx m}
\stoptext

Furthermore there seems to be some extraneous output when the
bodyfontenvironment matches the current bodyfont size. For example,
the following outputs: "m12.0ptm12.0ptm"

\setupbodyfontenvironment [12pt] [m=2.0,n=2.0,]
\starttext
  m{\tfm m}{\tfn m}
\stoptext

On Sat, Jan 19, 2019 at 3:59 AM Wolfgang Schuster
 wrote:
> Why do you need this when you can just change the style of commands
> with use \tfx (e.g. \high or \low) to use the \tfm size?

With that out of the way, I don't know how to change commands which
use '\tfx' to use '\tfm' instead. Unless you mean this (though
technically they still use '\tfx', it just matches '\tfm'):

\setupbodyfontenvironment [default] [m=0.8,n=0.6,x=0.8,xx=0.6]

Even if that did work, which it doesn't (see above), it would be
preferable to use the default bodyfont environment shipped by ConTeXt.
It probably exists for good reasons: matching the most common optical
font sizes, for aesthetics, and for consistency. I don't want the 'x'
and 'xx' sizes to vary between standard ConTeXt documents, and
documents which need to provide the 'n' and 'm' sizes.

It's also more work, as mentioned further up the thread. It may not be
strictly necessary to specify 'x' and 'xx' for each new size-specific
bodyfont environment, as they'll be inherited from [default]. But for
consistency each bodyfont size should have 'x' and 'xx' sizes matching
those from ConTeXt, and these vary with bodyfont size. That means
looking them up in 'font-pre.mkiv', a little math, and remembering to
do it every time you switch sizes. And that's ignoring the fact that
'\definebodyfont' can also override these sizes. I think using a macro
is simpler.
___
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] regression in fontloader?

2019-01-19 Thread Hans Hagen

On 1/18/2019 6:00 PM, Ulrike Fischer wrote:

The following example gave with the generic fontloader from
2018-12-19 and luatex 1.07 two identical lines. With a fontloader
from 2019-01-07 and luatex 1.09 the first line is wrong at the left
side, the "j" is squashed into the next glyph:

\font\test =
{name:FreeSerif:mode=node;script=arab;language=DFLT;+tlig;+ccmp;+locl;+isol;
+fina;
+fin2;+fin3;+medi;+med2;+init;+rlig;+calt;+liga;+cswh;+mset;+curs;+kern;+mark;+mkmk;}
\test
\textdir TRT \pardir TRT \bodydir TRT \pagedir TRT

الإشارات برهن

\hbox{الإشارات برهن}

line 3803 in font-ots should be (start->head):

initialrl = pardirstate(head)


-
  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] Scaling down symbols and emojis

2019-01-19 Thread Wolfgang Schuster

User 19087 schrieb am 19.01.19 um 09:42:

On Fri, Jan 18, 2019 at 4:44 PM User 19087  wrote:

There must be some other method (at least via luatex) to
obtain the 'x' and 'xx' sizes as workable dimensions.

Why do you need this when you can just change the style of commands
with use \tfx (e.g. \high or \low) to use the \tfm size?

Wolfgang

___
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] Scaling down symbols and emojis

2019-01-19 Thread User 19087
On Fri, Jan 18, 2019 at 4:44 PM User 19087  wrote:
> There must be some other method (at least via luatex) to
> obtain the 'x' and 'xx' sizes as workable dimensions.

I've come up with the following macro and I'd like some feedback. Will
it work consistently? Any suggestions for improvement?


% A '\start...\stopluacode' block inside a macro is just as bad (or worse?) to
% escape as '\ctxlua' code. So create a function here for use elsewhere.
%
% There were multiple font sizes in the "specification" and "parameters"
% tables, hopefully I picked the right one.
%
% It turns out that for ConTeXt there is a difference between the 10pt and
% 10.0pt sizes: the former is predefined in the body font environment that
% ships with ConTeXt while the latter causes ConTeXt to generate a new body
% font environment. Unfortunately '\the' displays values with trailing 0s, and
% so the result must be converted to a string and truncated in lua.
\startluacode
userdata = userdata or {}
userdata.fontsize = function ()
local fs
fs = font.getfont(font.current()).specification.size
fs = tostring(fs/2^16):gsub("%.?0+$","") .. "pt"
return fs
end
\stopluacode

% In some situations the 'tx' and 'txx' sizes are ignored by ConTeXt. This
% macro determines the font size that would have been used by such a command
% and switches the entire body font to that size for the duration of the second
% argument. The chosen size depends on the 'x' and 'xx' values of the specific
% body font environment nearest in size to the current body font, though the
% font itself (via definebodyfont) may override those values.
\define[2]\tosize{%
% Use a scratch box to prevent any typesetting. Otherwise changes to the
% font size would be compounded: 'tfxx' remaining in effect after
% 'switchtobodyfont'. I've also tried stop...starthiding, but that prevents
% all processing of contents.
\setbox\scratchbox\hbox{%
#1%
% Use a global lua variable rather than globally setting a scratch
% register.
\startluacode
userdata = userdata or {}
userdata.lastfontsize = userdata.fontsize()
\stopluacode%
}%
{\switchtobodyfont[\ctxlua{context(userdata.lastfontsize)}]#2}%
}

Test{\tfx Test}
\tosize{\tfx Unwanted}{Test{\tfx Test}}
___
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] Documentation of change / Evolving documents

2019-01-19 Thread Axel Kielhorn
Hi,

I often have documents that are not finished but need to change over time.
A client changes their mind, laws are changed, …

While working with the document, I want to see the changes.
When the document is finally finished, I only want to see the change history.

I came up with the following.
When the mode is „change“  the date (or version) is shown in the margin and the 
change is printed in red.
Without mode „change“ only the change history is printed.

What I want now is to change the layout of the register.
Adding some vspace around the date and printing the date in bold.
Is there a way to achieve this or am I on the wrong way?
(Should the date be the indicator, thus giving me the layout I want?)

\enablemode[change]

\setuppapersize [A4][A4]
\setuplayout[width=middle,  backspace=1.5in, cutspace=1.5in,
 height=middle, topspace=0.75in, bottomspace=0.75in]

\setupbodyfont[11pt]

\defineregister [change]
\setupregister  [change] [
  indicator=no  %% no letter
  style=sansbold,   %% headings
  textstyle=slanted,%% entries
  pagestyle=bolditalic, %% page refs
  n=1,  %% columns
]

\def\ChangeV#1#2{\change{#1+#2}\doifmode{change}{\inmargin{\tx #1}{\red 
#2\par}}}
\def\ChangeD#1#2{\change{#1+#2}\doifmode{change}{\inmargin{\tx #1}{\red 
#2\par}}}

\starttext

\ChangeV{V. 1.0}{Fertig!}
\input knuth

\ChangeD{2018-12-22}{Fertig!}

\ChangeD{2018-12-23}{Letzter Fehler beseitigt.}
\input knuth

\ChangeD{2018-12-23}{Allerletzter Fehler beseitigt.}

Ende

\startsection[title={History}]

\placechange

\stopsection

\stoptext


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