ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* Re: Font size switching problem
       [not found]     ` <000101c2d1ce$bc1d4c20$6401a8c0@victorfi>
@ 2003-02-12 11:48       ` Hans Hagen
  0 siblings, 0 replies; only message in thread
From: Hans Hagen @ 2003-02-12 11:48 UTC (permalink / raw)
  Cc: ntg-context

At 07:25 AM 2/11/2003 +0300, you wrote:
>Hello, Hans!
>
>It seems that font size switching mechanizm in ConTeXt has a bug.
>
>Here are simple test and its results (as comments):
>
>----------------------------------------------------------------------------
>\setupoutput[pdftex]
>\setuplayout[middle] \noheaderandfooterlines
>
>\title{Font sizes test}            % Shown using  CMR12 font at 20.6 pt
>
>\rm \subject{Serif font}           % Shown using  CMR12 font at 14.3  pt
>\tfx  Serif --- size tfx\par       % Shown using  CMR10 font at  9.96 pt
>\tfxx Serif --- size tfxx\par      % Shown using  CMR8  font at  7.97 pt
>\tfa  Serif --- size tfa\par       % Shown using  CMR8  font at  9.96 pt
>                                    %   (swithing to CMR 12 is missing?)
>\tfb  Serif --- size tfb\par       % Shown using  CMR8  font at 11.4  pt
>\tfc  Serif --- size tfc\par       % Shown using  CMR8  font at 13.7  pt
>\tfx  Serif --- size tfx\par       % Shown using  CMR10 font at 17.2  pt
>                                    %  (font scale switch is missing???)
>\tfxx Serif --- size tfxx\par      % Shown using  CMR8  font at 13.7  pt
>
>\ss \subject{SansSerif font}       % Shown using  CMSS8  font at 9.56  pt
>\tfx SansSerif --- size tfx\par    % Shown using  CMSS10 font at 17.2  pt
>\tfxx SansSerif --- size tfxx\par  % Shown using  CMSS8  font at 13.7  pt
>\tfa SansSerif --- size tfa\par    % Shown using  CMSS8  font at  9.56 pt
>\tfb SansSerif --- size tfb\par    % Shown using  CMSS8  font at 11.4  pt
>\tfc SansSerif --- size tfc\par    % Shown using  CMSS8  font at 13.7  pt
>\tfx SansSerif --- size tfx\par    % Shown using  CMSS10 font at 17.2  pt
>\tfxx SansSerif --- size tfxx\par  % Shown using  CMSS8  font at 13.7  pt
>
>\tt \subject{Typewriter font}      % Shown using  CMTT8  font at  9.56 pt
>\tfx  Typewriter --- size tfx\par  % Shown using  CMTT10 font at 17.2  pt
>\tfxx Typewriter --- size tfxx\par % Shown using  CMTT8  font at 13.7  pt
>\tfa  Typewriter --- size tfa\par  % Shown using  CMTT8  font at  9.56 pt
>\tfb  Typewriter --- size tfb\par  % Shown using  CMTT8  font at 11.4  pt
>\tfc  Typewriter --- size tfc\par  % Shown using  CMTT8  font at 13.7  pt
>\tfx  Typewriter --- size tfx\par  % Shown using  CMTT10 font at 17.2  pt
>\tfxx Typewriter --- size tfxx\par % Shown using  CMTT8  font at 13.7  pt
>
>\stoptext
>----------------------------------------------------------------------------
>
>So it is hard to predict the results of consecutive font size swithing
>commands. :-(
>
>(Yes I know that grouping like {\tf... } cures the problem)

Took me a while to figure out what was going on, but the problem with 
ungrouped usage is that you reach a state where context cannot longer keep 
track of what the intention is (unless i extend the font handler with some 
sort of group-insensitive stack which would slow down things quite a lot); 
think of x inside c inside x inside xx inside d and so on.

When used as intended, i.e. grouped, x/xx scaling works ok. I made a couple 
of test tables to demo this effect. A small patch is possible that at least 
prevents the funny big scale, but it's still sub optimal.


Hans

=====================================================

\let\normaltx \tx
\let\normaltxx\txx

\def\checknestedxfontsize
   {\ifcase\currentxfontsize\else\ifx\fontsize\empty\else
      \chardef\currentxfontsize\zeropoint
      \let\fontsize\empty
      \let\tx\normaltx
      \let\txx\normaltxx
    \fi\fi}

\def\setcurrentfontxalternative#1%
   {\checknestedxfontsize
    \dosetcurrentfontxxxalternative{#1}1\c!x\scriptstyle
    \let\tx\txx}

\def\setcurrentfontxxalternative#1%
   {\checknestedxfontsize
    \dosetcurrentfontxxxalternative{#1}2\c!xx\scriptscriptstyle
    \let\tx\empty
    \let\txx\empty}

\def\setcurrentfontxstylealternative #1{\csname#1\endcsname\tx}
\def\setcurrentfontxxstylealternative#1{\csname#1\endcsname\txx}

\setupoutput[pdftex]
\setuplayout[middle] \noheaderandfooterlines

\def\fontstate{\setstrut\ruledhbox{\strut Hello}}

\starttabulate[|||||]
\HL
\NC \rlap{\quad\bf grouped} \NC \NC \type {\tx} \NC \type {\txx} \NC \NR
\HL
\NC \type{\tfx}  \NC \tfx  \fontstate \NC \tfx \tx \fontstate \NC \tfx \txx 
\fontstate  \NC \NR
\NC \type{\tfxx} \NC \tfxx \fontstate \NC \tfxx\tx \fontstate \NC \tfxx\txx 
\fontstate  \NC \NR
\NC \type{\tf}   \NC \tf   \fontstate \NC \tf  \tx \fontstate \NC \tf  \txx 
\fontstate  \NC \NR
\NC \type{\tfa}  \NC \tfa  \fontstate \NC \tfa \tx \fontstate \NC \tfa \txx 
\fontstate  \NC \NR
\NC \type{\tfb}  \NC \tfb  \fontstate \NC \tfb \tx \fontstate \NC \tfb \txx 
\fontstate  \NC \NR
\NC \type{\tfc}  \NC \tfc  \fontstate \NC \tfc \tx \fontstate \NC \tfc \txx 
\fontstate  \NC \NR
\NC \type{\tfd}  \NC \tfd  \fontstate \NC \tfd \tx \fontstate \NC \tfd \txx 
\fontstate  \NC \NR
\NC \type{\tfx}  \NC \tfx  \fontstate \NC \tfx \tx \fontstate \NC \tfx \txx 
\fontstate  \NC \NR
\NC \type{\tfxx} \NC \tfxx \fontstate \NC \tfxx\tx \fontstate \NC \tfxx\txx 
\fontstate  \NC \NR
\HL
\stoptabulate

\blank

\starttabulate[|||||]
\HL
\NC \rlap{\quad\bf stacked} \NC \NC \type {\tx} \NC \type {\txx} \NC \NR
\HL
\NC \type{\tfx}
\NC \tfx                                   \fontstate
\NC \tfx                              \tx  \fontstate
\NC \tfx                              \txx \fontstate
\NC \NR
\NC \type{\tfxx}
\NC \tfx\tfxx                              \fontstate
\NC \tfx\tfxx                         \tx  \fontstate
\NC \tfx\tfxx                         \txx \fontstate
\NC \NR
\NC \type{\tf}
\NC \tfx\tfxx\tf                           \fontstate
\NC \tfx\tfxx\tf                      \tx  \fontstate
\NC \tfx\tfxx\tf                      \txx \fontstate
\NC \NR
\NC \type{\tfa}
\NC \tfx\tfxx\tf\tfa                       \fontstate
\NC \tfx\tfxx\tf\tfa                  \tx  \fontstate
\NC \tfx\tfxx\tf\tfa                  \txx \fontstate
\NC \NR
\NC \type{\tfb}
\NC \tfx\tfxx\tf\tfa\tfb                   \fontstate
\NC \tfx\tfxx\tf\tfa\tfb              \tx  \fontstate
\NC \tfx\tfxx\tf\tfa\tfb              \txx \fontstate
\NC \NR
\NC \type{\tfc}
\NC \tfx\tfxx\tf\tfa\tfb\tfc               \fontstate
\NC \tfx\tfxx\tf\tfa\tfb\tfc          \tx  \fontstate
\NC \tfx\tfxx\tf\tfa\tfb\tfc          \txx \fontstate
\NC \NR
\NC \type{\tfd}
\NC \tfx\tfxx\tf\tfa\tfb\tfd               \fontstate
\NC \tfx\tfxx\tf\tfa\tfb\tfd          \tx  \fontstate
\NC \tfx\tfxx\tf\tfa\tfb\tfd          \txx \fontstate
\NC \NR
\NC \type{\tfx}
\NC \tfx\tfxx\tf\tfa\tfb\tfc\tfx           \fontstate
\NC \tfx\tfxx\tf\tfa\tfb\tfc\tfx      \tx  \fontstate
\NC \tfx\tfxx\tf\tfa\tfb\tfc\tfx      \txx \fontstate
\NC \NR
\NC \type{\tfxx}
\NC \tfx\tfxx\tf\tfa\tfb\tfc\tfx\tfxx      \fontstate
\NC \tfx\tfxx\tf\tfa\tfb\tfc\tfx\tfxx \tx  \fontstate
\NC \tfx\tfxx\tf\tfa\tfb\tfc\tfx\tfxx \txx \fontstate
\NC \NR
\HL
\stoptabulate

\stoptext


-------------------------------------------------------------------------
                                   Hans Hagen | PRAGMA ADE | pragma@wxs.nl
                       Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
  tel: +31 (0)38 477 53 69 | fax: +31 (0)38 477 53 74 | www.pragma-ade.com
-------------------------------------------------------------------------
                        information: http://www.pragma-ade.com/roadmap.pdf
                     documentation: http://www.pragma-ade.com/showcase.pdf
-------------------------------------------------------------------------

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2003-02-12 11:48 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <5.1.0.14.1.20030124101026.030aec50@server-1>
     [not found] ` <5.1.0.14.1.20030124231632.06b02a48@remote-1>
     [not found]   ` <5.1.0.14.1.20030209230022.02713fd0@remote-1>
     [not found]     ` <000101c2d1ce$bc1d4c20$6401a8c0@victorfi>
2003-02-12 11:48       ` Font size switching problem Hans Hagen

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).