ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* Setup font size by dimension variable
@ 2013-08-04 10:29 Dmitriy Tokarev
  2013-08-04 10:45 ` Philipp Gesang
  0 siblings, 1 reply; 4+ messages in thread
From: Dmitriy Tokarev @ 2013-08-04 10:29 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Hi all,

I want to set the font size by using the dimension variable, but it doesn't work. What am I doing wrong?

\definemeasure[AAA][20pt]
\newdimen\BBB \BBB=20pt

\starttext
TEXT

% don't work
\switchtobodyfont[\measure{AAA}]
AAA

% don't work
\switchtobodyfont[\the\BBB]
BBB

% ok
\switchtobodyfont[20pt]
TEXT 20pt

\stoptext

--
Dmitriy
___________________________________________________________________________________
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
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Setup font size by dimension variable
  2013-08-04 10:29 Setup font size by dimension variable Dmitriy Tokarev
@ 2013-08-04 10:45 ` Philipp Gesang
  2013-08-04 10:48   ` Philipp Gesang
  0 siblings, 1 reply; 4+ messages in thread
From: Philipp Gesang @ 2013-08-04 10:45 UTC (permalink / raw)
  To: mailing list for ConTeXt users


[-- Attachment #1.1: Type: text/plain, Size: 948 bytes --]

···<date: 2013-08-04, Sunday>···<from: Dmitriy Tokarev>···

> Hi all,
> 
> I want to set the font size by using the dimension variable, but it doesn't work. What am I doing wrong?
> 
> \definemeasure[AAA][20pt]
> \newdimen\BBB \BBB=20pt
> 
> \starttext
> TEXT
> 
> % don't work
> \switchtobodyfont[\measure{AAA}]
> AAA
> 
> % don't work
> \switchtobodyfont[\the\BBB]
> BBB
> 
> % ok
> \switchtobodyfont[20pt]
> TEXT 20pt
> 
> \stoptext

Hi Dmitriy,

the size-related arguments to \switchtobodyfont and
\setupbodyfont aren’t real TeX dimensions but identifiers for
predefined bodyfont sets. Example:

  \def\mainfontsize{20pt}
  \definebodyfontenvironment [\mainfontsize]

  \starttext
    TEXT
    \switchtobodyfont [\mainfontsize]
    TEXT 20pt
  \stoptext

See this thread for some background info:

  http://www.mail-archive.com/ntg-context@ntg.nl/msg63901.html

Best regards,
Philipp


[-- Attachment #1.2: Type: application/pgp-signature, Size: 490 bytes --]

[-- Attachment #2: Type: text/plain, Size: 485 bytes --]

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Setup font size by dimension variable
  2013-08-04 10:45 ` Philipp Gesang
@ 2013-08-04 10:48   ` Philipp Gesang
  2013-08-04 12:27     ` [***SPAM***] " Dmitriy Tokarev
  0 siblings, 1 reply; 4+ messages in thread
From: Philipp Gesang @ 2013-08-04 10:48 UTC (permalink / raw)
  To: mailing list for ConTeXt users


[-- Attachment #1.1: Type: text/plain, Size: 1243 bytes --]

···<date: 2013-08-04, Sunday>···<from: Philipp Gesang>···

> ···<date: 2013-08-04, Sunday>···<from: Dmitriy Tokarev>···
> 
> > Hi all,
> > 
> > I want to set the font size by using the dimension variable, but it doesn't work. What am I doing wrong?
> > 
> > \definemeasure[AAA][20pt]
> > \newdimen\BBB \BBB=20pt
> > 
> > \starttext
> > TEXT
> > 
> > % don't work
> > \switchtobodyfont[\measure{AAA}]
> > AAA
> > 
> > % don't work
> > \switchtobodyfont[\the\BBB]
> > BBB
> > 
> > % ok
> > \switchtobodyfont[20pt]
> > TEXT 20pt
> > 
> > \stoptext
> 
> Hi Dmitriy,
> 
> the size-related arguments to \switchtobodyfont and
> \setupbodyfont aren’t real TeX dimensions but identifiers for
> predefined bodyfont sets. Example:
> 
>   \def\mainfontsize{20pt}
>   \definebodyfontenvironment [\mainfontsize]
> 
>   \starttext
>     TEXT
>     \switchtobodyfont [\mainfontsize]
>     TEXT 20pt
>   \stoptext
> 
> See this thread for some background info:
> 
>   http://www.mail-archive.com/ntg-context@ntg.nl/msg63901.html

Sorry for the self-reply, but I just remembered that I already
wikified the topic:

  http://wiki.contextgarden.net/unexpected_behavior#Treacherous_Dimensions

[-- Attachment #1.2: Type: application/pgp-signature, Size: 490 bytes --]

[-- Attachment #2: Type: text/plain, Size: 485 bytes --]

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [***SPAM***] Re: Setup font size by dimension variable
  2013-08-04 10:48   ` Philipp Gesang
@ 2013-08-04 12:27     ` Dmitriy Tokarev
  0 siblings, 0 replies; 4+ messages in thread
From: Dmitriy Tokarev @ 2013-08-04 12:27 UTC (permalink / raw)
  To: mailing list for ConTeXt users

04.08.2013, 16:49, "Philipp Gesang" <Philipp.Gesang@alumni.uni-heidelberg.de>:
>>  the size-related arguments to \switchtobodyfont and
>>  \setupbodyfont aren’t real TeX dimensions but identifiers for
>>  predefined bodyfont sets. Example:
>>
>>    \def\mainfontsize{20pt}
>>    \definebodyfontenvironment [\mainfontsize]
>>
>>    \starttext
>>      TEXT
>>      \switchtobodyfont [\mainfontsize]
>>      TEXT 20pt
>>    \stoptext
>>
>>  See this thread for some background info:
>>
>>    http://www.mail-archive.com/ntg-context@ntg.nl/msg63901.html
>
> Sorry for the self-reply, but I just remembered that I already
> wikified the topic:
>
>   http://wiki.contextgarden.net/unexpected_behavior#Treacherous_Dimensions
>

Thanks, Philipp!
Now I realized that before the first use of "switchtobodyfont" I need to write "definebodyfontenvironment". In this case, everything is fine.
I also found another way without definebodyfontenvironment:

\definemeasure[AAA][20.123pt]
\newdimen\BBB \BBB=25.127pt

\starttext
TEXT

% ok
\normalizebodyfontsize\normalizedAAA{\measure{AAA}}
\switchtobodyfont[\normalizedAAA]
AAA \normalizedAAA

% ok
\normalizebodyfontsize\normalizedBBB\BBB
\switchtobodyfont[\normalizedBBB]
BBB \normalizedBBB

\stoptext

Is this code correct? Or it's better for some reason using "definebodyfontenvironment"?
--
Dmitriy
___________________________________________________________________________________
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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2013-08-04 12:27 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-08-04 10:29 Setup font size by dimension variable Dmitriy Tokarev
2013-08-04 10:45 ` Philipp Gesang
2013-08-04 10:48   ` Philipp Gesang
2013-08-04 12:27     ` [***SPAM***] " Dmitriy Tokarev

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