From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/115126 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stefan Nedeljkovic via ntg-context Newsgroups: gmane.comp.tex.context Subject: Re: Changing font and font size inside textex Date: Tue, 31 May 2022 07:10:44 +0200 Message-ID: References: Reply-To: mailing list for ConTeXt users Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============6002048798355434974==" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="40817"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Stefan Nedeljkovic , mailing list for ConTeXt users To: Max Chernoff Original-X-From: ntg-context-bounces@ntg.nl Tue May 31 07:11:50 2022 Return-path: Envelope-to: gctc-ntg-context-518@m.gmane-mx.org Original-Received: from zapf.boekplan.nl ([5.39.185.232] helo=zapf.ntg.nl) by ciao.gmane.io with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nvuAX-000AO9-2P for gctc-ntg-context-518@m.gmane-mx.org; Tue, 31 May 2022 07:11:49 +0200 Original-Received: from localhost (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id 69E1C287CBF; Tue, 31 May 2022 07:11:05 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at zapf.boekplan.nl Original-Received: from zapf.ntg.nl ([127.0.0.1]) by localhost (zapf.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Ba7JJlqaMkSh; Tue, 31 May 2022 07:11:03 +0200 (CEST) Original-Received: from zapf.ntg.nl (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id 457002899E6; Tue, 31 May 2022 07:11:03 +0200 (CEST) Original-Received: from localhost (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id 6DFE228981B for ; Tue, 31 May 2022 07:11:01 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at zapf.boekplan.nl Original-Received: from zapf.ntg.nl ([127.0.0.1]) by localhost (zapf.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 3qerZYCGYPRn for ; Tue, 31 May 2022 07:11:00 +0200 (CEST) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=209.85.222.177; helo=mail-qk1-f177.google.com; envelope-from=tsar.srb@gmail.com; receiver= Original-Received: from mail-qk1-f177.google.com (mail-qk1-f177.google.com [209.85.222.177]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by zapf.ntg.nl (Postfix) with ESMTPS id 3A712287CBF for ; Tue, 31 May 2022 07:11:00 +0200 (CEST) Original-Received: by mail-qk1-f177.google.com with SMTP id 14so12443575qkl.6 for ; Mon, 30 May 2022 22:11:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=u4gmP7QCuKIEFBKmvsynjClmTVDawmMJaJWWfE7wLXc=; b=IiFmhGz5eP+dRMwu+Ank/FmcM+wxA0BhTNpflGZITkk/yQLn0AGRqFsk5kM/+N6Ky7 SR/7dWpnG1lrBqiwPehsCWKrHRLkfzlyoopGl+1YUNmA4atr1qzmua88L3ci/lKzy33N 6IF2Jp/3M/0yZO05AryIv2UY8VPUYY3O6ipxPX+QggMReeXurWpHiv66K5e8nEdQrSHP r1cr1mR83hMX0fQdOs2S3R182DShYL3Yu7QatE95yj4FZKkoaHVm90aE7Q6lLNGXeXpc aJ3bm7MXsOuLBadeDy6ZvdJ1K9fOa1Uk9cqgrPCimNaokka2PzS8RlN8aAvuwBrMG+63 DJ9Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=u4gmP7QCuKIEFBKmvsynjClmTVDawmMJaJWWfE7wLXc=; b=KrRxjotMEK0GRWZaKVoZ73Mwo11jLXhW8jbshQ50eDMrcTM2l12GKpX7QjswNEz8Ys NVLOj187UoFh7TN2cxH9Y7PDnl0fN20wNIWxxtij/3kuABKBfdbNQtjLRoihusPkJFrH o2E44WJ7UDiJQPks5P4LhTA6K3nAeHryiYLfv3tlwndeBg2acqVN8ZRS+nWu+aEScH8O wN2HOkNH/wmUiw6ysAbA3cG2UNqt1Wq2/zAz1UjZUF23tlML9fzm6ecExnKckPzbgvWi W6qLQznGaZKbMpSaXpUH/czYNKAYcURXuFTFyt1CIO2pTKgvR1oQujOsfym18+7QtQSE Uofg== X-Gm-Message-State: AOAM5322cIl0GFZCxZBPfmkF01dol1HfdQER5ksBtUIfDkJfKbeemgvf LXMI3lMfa2MNuSzFkwylYwUoilcGRZczc9QNkPQ= X-Google-Smtp-Source: ABdhPJxvjdRQnB9s/dlZq4oSrjFUPs68yTz7avvF+sKPqrX0/NHVyjp6UeL3GkQs3e9KECXmM/mk2X1n31aOjwUCsd0= X-Received: by 2002:a05:620a:2699:b0:47d:753c:b8ff with SMTP id c25-20020a05620a269900b0047d753cb8ffmr40203011qkp.763.1653973855091; Mon, 30 May 2022 22:10:55 -0700 (PDT) In-Reply-To: X-BeenThere: ntg-context@ntg.nl X-Mailman-Version: 2.1.26 Precedence: list List-Id: mailing list for ConTeXt users List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ntg-context-bounces@ntg.nl Original-Sender: "ntg-context" Xref: news.gmane.io gmane.comp.tex.context:115126 Archived-At: --===============6002048798355434974== Content-Type: multipart/alternative; boundary="00000000000019c05605e047ccad" --00000000000019c05605e047ccad Content-Type: text/plain; charset="UTF-8" Thanks Max that works perfectly! But It would still be useful if I could change families inside a MPpage. On Tue, May 31, 2022 at 1:31 AM Max Chernoff wrote: > > I'm using the following macro to set the font size via h-height: > > > > \starttexdefinition setxheight [#1][#2] > > \switchtobodyfont[#1, 12pt] > > \scratchdimen=\dimexpr#2\relax > > \switchtobodyfont[#1, \cldcontext{tex.dimen.scratchdimen / > tex.sp"1ex" > > * tex.sp"1em" .. "sp"}] > > \stoptexdefinition > > > > But I can't figure out how to use that in MPpage. > > So it looks like the "\cldcontext" command doesn't work quite right > inside "textext", and it also looks like "\switchtobodyfont" doesn't > take effect until text is actually typeset when we're inside "textext". > > This seems to work: > > \starttexdefinition setxheight [#1] > \switchtobodyfont[\the\dimexpr #1 * \number\dimexpr1em\relax / > \number\dimexpr1ex\relax \relax] > \stoptexdefinition > > > \starttext > \switchtobodyfont[adventor] > \startMPpage > draw textext.origin("\setxheight[1cm]Hello!"); > > draw (0, 1cm) -- (6cm, 1cm); > \stopMPpage > > \switchtobodyfont[pagella] > \startMPpage > draw textext.origin("\setxheight[1cm]Hello!"); > > draw (0, 1cm) -- (6cm, 1cm); > \stopMPpage > > \switchtobodyfont[heros] > \startMPpage > draw textext.origin("\setxheight[6pt]Hello!"); > draw textext.origin("\setxheight[24pt]Hello!"); > > draw (0, 6pt) -- (6cm, 6pt); > draw (0, 24pt) -- (6cm, 24pt); > \stopMPpage > \stoptext > > The catch here is that you need to set the font family *before* you > start the MPpage. > > -- Max > --00000000000019c05605e047ccad Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Thanks Max that works perfectly! But It would still be use= ful if I could change families inside a MPpage.

On Tue, May 31, 2022 at 1:31= AM Max Chernoff <mseven@telus.net> wrote:
&g= t; I'm using the following macro to set the font size via h-height:
>
> \starttexdefinition setxheight [#1][#2]
>=C2=A0 =C2=A0 =C2=A0\switchtobodyfont[#1, 12pt]
>=C2=A0 =C2=A0 =C2=A0\scratchdimen=3D\dimexpr#2\relax
>=C2=A0 =C2=A0 =C2=A0\switchtobodyfont[#1, \cldcontext{tex.dimen.scratch= dimen / tex.sp"1ex"
> * tex.sp"1em" .. "sp"}]
> \stoptexdefinition
>
> But I can't figure out how to use that in MPpage.

So it looks like the "\cldcontext" command doesn't work quite= right
inside "textext", and it also looks like "\switchtobodyfont&= quot; doesn't
take effect until text is actually typeset when we're inside "text= ext".

This seems to work:

=C2=A0 =C2=A0 =C2=A0\starttexdefinition setxheight [#1]
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0\switchtobodyfont[\the\dimexpr #1 * \numb= er\dimexpr1em\relax / \number\dimexpr1ex\relax \relax]
=C2=A0 =C2=A0 =C2=A0\stoptexdefinition


=C2=A0 =C2=A0 =C2=A0\starttext
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0\switchtobodyfont[adventor]
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0\startMPpage
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0draw textext.origin("\= setxheight[1cm]Hello!");

=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0draw (0, 1cm) -- (6cm, 1cm)= ;
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0\stopMPpage

=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0\switchtobodyfont[pagella]
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0\startMPpage
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0draw textext.origin("\= setxheight[1cm]Hello!");

=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0draw (0, 1cm) -- (6cm, 1cm)= ;
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0\stopMPpage

=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0\switchtobodyfont[heros]
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0\startMPpage
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0draw textext.origin("\= setxheight[6pt]Hello!");
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0draw textext.origin("\= setxheight[24pt]Hello!");

=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0draw (0, 6pt) -- (6cm, 6pt)= ;
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0draw (0, 24pt) -- (6cm, 24p= t);
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0\stopMPpage
=C2=A0 =C2=A0 =C2=A0\stoptext

The catch here is that you need to set the font family *before* you
start the MPpage.

-- Max
--00000000000019c05605e047ccad-- --===============6002048798355434974== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 Content-Disposition: inline X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19f X19fX19fX19fX19fX19fX19fX19fX19fX18KSWYgeW91ciBxdWVzdGlvbiBpcyBvZiBpbnRlcmVz dCB0byBvdGhlcnMgYXMgd2VsbCwgcGxlYXNlIGFkZCBhbiBlbnRyeSB0byB0aGUgV2lraSEKCm1h aWxsaXN0IDogbnRnLWNvbnRleHRAbnRnLm5sIC8gaHR0cDovL3d3dy5udGcubmwvbWFpbG1hbi9s aXN0aW5mby9udGctY29udGV4dAp3ZWJwYWdlICA6IGh0dHA6Ly93d3cucHJhZ21hLWFkZS5ubCAv IGh0dHA6Ly9jb250ZXh0LmFhbmhldC5uZXQKYXJjaGl2ZSAgOiBodHRwczovL2JpdGJ1Y2tldC5v cmcvcGhnL2NvbnRleHQtbWlycm9yL2NvbW1pdHMvCndpa2kgICAgIDogaHR0cDovL2NvbnRleHRn YXJkZW4ubmV0Cl9fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19f X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fCg== --===============6002048798355434974==--