* [NTG-context] Scale content to height of the font, measure font height
@ 2024-06-10 11:16 Gerion Entrup
2024-06-10 11:57 ` [NTG-context] " Hans Hagen
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Gerion Entrup @ 2024-06-10 11:16 UTC (permalink / raw)
To: ntg-context
[-- Attachment #1.1: Type: text/plain, Size: 653 bytes --]
Hi,
I'd like to scale something (actually a symbol drawn in TikZ) to the exact
high of the char 'M'. I found the scale environment for it but struggle to
measure the correct font height. I found the "definemeasure/measure/measured"
commands but they define a dimension and are not for doing measurements on
rendered text. Is there a simple way to get the height a char as a dimension?
MWE:
```
\starttext
% Is it possible to replace 1cm with a common expression?
This is the letter M. \scale[height=1cm]{a} should have the exact same size as
M.
This should also be true {\tfc with a bigger M. \scale[height=1cm]{a}}.
\stoptext
```
Best
Gerion
[-- Attachment #1.2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 659 bytes --]
[-- Attachment #2: Type: text/plain, Size: 511 bytes --]
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 5+ messages in thread
* [NTG-context] Re: Scale content to height of the font, measure font height
2024-06-10 11:16 [NTG-context] Scale content to height of the font, measure font height Gerion Entrup
@ 2024-06-10 11:57 ` Hans Hagen
2024-06-10 12:07 ` seyal zavira
2024-06-10 13:53 ` Wolfgang Schuster
2 siblings, 0 replies; 5+ messages in thread
From: Hans Hagen @ 2024-06-10 11:57 UTC (permalink / raw)
To: ntg-context
On 6/10/2024 1:16 PM, Gerion Entrup wrote:
> Hi,
>
> I'd like to scale something (actually a symbol drawn in TikZ) to the exact
> high of the char 'M'. I found the scale environment for it but struggle to
> measure the correct font height. I found the "definemeasure/measure/measured"
> commands but they define a dimension and are not for doing measurements on
> rendered text. Is there a simple way to get the height a char as a dimension?
>
> MWE:
> ```
> \starttext
> % Is it possible to replace 1cm with a common expression?
> This is the letter M. \scale[height=1cm]{a} should have the exact same size as
> M.
>
> This should also be true {\tfc with a bigger M. \scale[height=1cm]{a}}.
> \stoptext
\the\dimexpr\fontcharht\font`M+\fontchardp\font`M\relax
-----------------------------------------------------------------
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 / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 5+ messages in thread
* [NTG-context] Re: Scale content to height of the font, measure font height
2024-06-10 11:16 [NTG-context] Scale content to height of the font, measure font height Gerion Entrup
2024-06-10 11:57 ` [NTG-context] " Hans Hagen
@ 2024-06-10 12:07 ` seyal zavira
2024-06-10 13:53 ` Wolfgang Schuster
2 siblings, 0 replies; 5+ messages in thread
From: seyal zavira @ 2024-06-10 12:07 UTC (permalink / raw)
To: mailing list for ConTeXt users
[-- Attachment #1.1: Type: text/plain, Size: 1677 bytes --]
Also you can use this:
assuming that you have a fixed size figure such as a pdf page:
\definesymbol[Bsymbol][{\scale[width=1.6ex]{\externalfigure[myfile.pdf][page=1]}}]
\define\mysym{\kern 0.2em \symbol[Bsymbol] \kern 0.3em}
\starttext
this is a sample\mysym text.
\tfa{this is a sample\mysym text.}
\stoptext
On Mon, Jun 10, 2024 at 7:18 AM Gerion Entrup <gerion.entrup@flump.de>
wrote:
> Hi,
>
> I'd like to scale something (actually a symbol drawn in TikZ) to the exact
> high of the char 'M'. I found the scale environment for it but struggle to
> measure the correct font height. I found the
> "definemeasure/measure/measured"
> commands but they define a dimension and are not for doing measurements on
> rendered text. Is there a simple way to get the height a char as a
> dimension?
>
> MWE:
> ```
> \starttext
> % Is it possible to replace 1cm with a common expression?
> This is the letter M. \scale[height=1cm]{a} should have the exact same
> size as
> M.
>
> This should also be true {\tfc with a bigger M. \scale[height=1cm]{a}}.
> \stoptext
> ```
>
> Best
> Gerion
>
>
> ___________________________________________________________________________________
> If your question is of interest to others as well, please add an entry to
> the Wiki!
>
> maillist : ntg-context@ntg.nl /
> https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
> webpage : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
> archive : https://github.com/contextgarden/context
> wiki : https://wiki.contextgarden.net
>
> ___________________________________________________________________________________
>
[-- Attachment #1.2: Type: text/html, Size: 2562 bytes --]
[-- Attachment #2: test.pdf --]
[-- Type: application/pdf, Size: 7777 bytes --]
[-- Attachment #3: Type: text/plain, Size: 511 bytes --]
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 5+ messages in thread
* [NTG-context] Re: Scale content to height of the font, measure font height
2024-06-10 11:16 [NTG-context] Scale content to height of the font, measure font height Gerion Entrup
2024-06-10 11:57 ` [NTG-context] " Hans Hagen
2024-06-10 12:07 ` seyal zavira
@ 2024-06-10 13:53 ` Wolfgang Schuster
2024-06-11 21:18 ` Gerion Entrup
2 siblings, 1 reply; 5+ messages in thread
From: Wolfgang Schuster @ 2024-06-10 13:53 UTC (permalink / raw)
To: mailing list for ConTeXt users, Gerion Entrup
Gerion Entrup schrieb am 10.06.2024 um 13:16:
> Hi,
>
> I'd like to scale something (actually a symbol drawn in TikZ) to the exact
> high of the char 'M'. I found the scale environment for it but struggle to
> measure the correct font height. I found the "definemeasure/measure/measured"
> commands but they define a dimension and are not for doing measurements on
> rendered text. Is there a simple way to get the height a char as a dimension?
>
> MWE:
> ```
> \starttext
> % Is it possible to replace 1cm with a common expression?
> This is the letter M. \scale[height=1cm]{a} should have the exact same size as
> M.
>
> This should also be true {\tfc with a bigger M. \scale[height=1cm]{a}}.
> \stoptext
> ```
\starttext
M\scale[height=\heightofstring{M}]{a}M
\stoptext
Wolfgang
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2024-06-11 21:19 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-06-10 11:16 [NTG-context] Scale content to height of the font, measure font height Gerion Entrup
2024-06-10 11:57 ` [NTG-context] " Hans Hagen
2024-06-10 12:07 ` seyal zavira
2024-06-10 13:53 ` Wolfgang Schuster
2024-06-11 21:18 ` Gerion Entrup
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).