From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/108075 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Marcus Vinicius Mesquita Newsgroups: gmane.comp.tex.context Subject: Re: Alphabet & color Date: Thu, 16 Jul 2020 13:41:20 -0300 Message-ID: References: <2a6cafe6-95b1-a0f8-6537-1d26f6a5e3d3@xs4all.nl> Reply-To: mailing list for ConTeXt users Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============1991158390256682241==" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="20198"; mail-complaints-to="usenet@ciao.gmane.io" Cc: mailing list for ConTeXt users To: Hans Hagen Original-X-From: ntg-context-bounces@ntg.nl Thu Jul 16 18:42:05 2020 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 1jw6xR-00058h-3f for gctc-ntg-context-518@m.gmane-mx.org; Thu, 16 Jul 2020 18:42:05 +0200 Original-Received: from localhost (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id D2DDB18565C; Thu, 16 Jul 2020 18:41:37 +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 yqj1BfVBgEPx; Thu, 16 Jul 2020 18:41:36 +0200 (CEST) Original-Received: from zapf.ntg.nl (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id E5E2A185B09; Thu, 16 Jul 2020 18:41:36 +0200 (CEST) Original-Received: from localhost (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id B3C24185AF4 for ; Thu, 16 Jul 2020 18:41:35 +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 agatfkHXOpFb for ; Thu, 16 Jul 2020 18:41:34 +0200 (CEST) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=209.85.222.170; helo=mail-qk1-f170.google.com; envelope-from=marcusvinicius.mesquita@gmail.com; receiver= Original-Received: from mail-qk1-f170.google.com (mail-qk1-f170.google.com [209.85.222.170]) (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 9B03A18565C for ; Thu, 16 Jul 2020 18:41:34 +0200 (CEST) Original-Received: by mail-qk1-f170.google.com with SMTP id e11so6131833qkm.3 for ; Thu, 16 Jul 2020 09:41:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=7gPpbR3+qHH3NYgK0iehTIsTx64Rpr2oiWWGiu2dJF0=; b=kCBml+Cr2KPYOR1MuB99OCbMgC7o0Nlw45kgVVepWRRPnjkv1w2Nhtjnu255LgT8o9 rME5TXy29fkT6QPEUGTJXWp4nKzkSLe1782SsnB3tiP0lDSW+GO7fh8uvK5UrxzoLqzX 2zy5yhfNBWPMI/cBB2usZrWljrt+5IrOTn64u4t/r21OhyqO72pa+RMrP6Ua5Uzm1w+T W53RcZ1JjMH2iRchqYgxx2OdhH/Qj1j45gFL6ZiW9qAzxHAxxqV/JpMq0OYUWO15P2It dCqElr/DzCrxX9KQYO/Xq7BVDbM7CXwaQW3tM/Ss5YPv/CTcrNDBldVdsrZIoFQMIIbc 0VDg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=7gPpbR3+qHH3NYgK0iehTIsTx64Rpr2oiWWGiu2dJF0=; b=Z15itvutY5TXKAsa0EdzAn8mLYPUsG6yxXZf5ys+9wFj5TzRltgpkJODhs4bKFpLD3 W2e+5jaXhxgI3ldBxmCpW+uAe7GEvSBnBxSKSVn3F36bH3Z7oULqe+WjIHRveFx3jcTS UTXOfwY7cm4uvz8jGi1TyfoV20Gz0+pDBMx3BM4njMDbH+UP6hV9Lpfjj7BQWVqd/7ku Uho7E/2hYdgLfg4bbAhpgrVb5vK9PDmxUea+ZxXTlg43lPiIbo+LVJtUuaAJSYady2gm i0vWyUHejLWZH4zV9kCtUkQe/zqcXEWFnRtLJnRdV6+aC4+FzkBRgD+vSEdqxW6SetnO uYsg== X-Gm-Message-State: AOAM533zAlIeXWY0FZc3UgoxzwiCnzFc5jx6TpwJwy9w4WGZiVosvEuc y6g0NbKVU3aGbLSg9+wjT9VUxeFaGQqpTdVlwPk= X-Google-Smtp-Source: ABdhPJwUPueMwv6vQmEQl+Bf/IMEOHly+WuBdnqjgxI1HGFU0F1fWBhrm+wLNw/1Xwhp6Ut90V+DVhJ8ZJrFliCFNE8= X-Received: by 2002:a05:620a:65a:: with SMTP id a26mr4769711qka.290.1594917692797; Thu, 16 Jul 2020 09:41:32 -0700 (PDT) In-Reply-To: <2a6cafe6-95b1-a0f8-6537-1d26f6a5e3d3@xs4all.nl> 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:108075 Archived-At: --===============1991158390256682241== Content-Type: multipart/alternative; boundary="00000000000086a57d05aa91b67b" --00000000000086a57d05aa91b67b Content-Type: text/plain; charset="UTF-8" Thank you, Hans for your answer. I tried your code and it works fine. But where do the color schemes default and whatever come from? How can they be changed? Best regards Marcus Vinicius On Thu, Jul 16, 2020, 04:19 Hans Hagen wrote: > On 7/16/2020 7:32 AM, Marcus Vinicius Mesquita wrote: > > Dear list > > > > I need to typeset a book for kids wich contains texts where each letter > > is assigned a fixed color, for example: > > > > A - - > red; > > B - - > blue; > > ... > > Z - - > green. > > > > What would be the best way to do this? TIA. > There's more ways to do this but here is one: > > (1) make a file: colorfont.lfg: > > return { > name = "coloralphabet", > colorschemes = { > default = { > [1] = { "a", "e" }, > [2] = { "i", "o", "u" }, > }, > whatever = { > [1] = { "65:90" }, > [2] = { }, > [3] = { }, > [4] = { "97:122" }, > } > } > } > > There is some more possible but this wil do ... > > (2) You define a font with these goodies attached: > > \setupbodyfont[plex,10pt] > > \definefontfeature > [MyFeaturesA] [default] > [goodies={colorfont},colorscheme=default,liga=no] > > \definefontfeature > [MyFeaturesB] [default] > [goodies={colorfont},colorscheme=whatever,liga=no] > > \definefont[MyFontA][Serif*MyFeaturesA] > \definefont[MyFontB][Serif*MyFeaturesB] > > (3) and use it this way: > > \starttext > > \setfontcolorscheme[1] {\MyFontA \samplefile{tufte}}\par > \setfontcolorscheme[2] {\MyFontA \samplefile{tufte}}\par > \setfontcolorscheme[3] {\MyFontA \samplefile{tufte}}\par > > \page > > \setfontcolorscheme[1] {\MyFontB \samplefile{tufte}}\par > \setfontcolorscheme[2] {\MyFontB \samplefile{tufte}}\par > \setfontcolorscheme[3] {\MyFontB \samplefile{tufte}}\par > > \stoptext > > Now, this is pretty (more than a decade) old functionality from early > days of mkiv/luatex when it was used for some tracing (by Idris) and it > still works (surprise). > > Today I would definitely use more recent trickery. If there is real > demand for this I can have a look at it, after all it's "kind of fun" > (as is most of font stuff). > > Hans > > ----------------------------------------------------------------- > Hans Hagen | PRAGMA ADE > Ridderstraat 27 | 8061 GH Hasselt | The Netherlands > tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl > ----------------------------------------------------------------- > --00000000000086a57d05aa91b67b Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Thank you, Hans for your answer.
<= div dir=3D"auto">
I tried your code and it works= fine. But where do the color schemes default and whatever come from? How c= an they be changed?

Best= regards

Marcus Vinicius=

On Thu, Jul 16, 2020, 04:19 Hans Hagen <j.hagen@xs4all.nl> wrote:
On 7/16/2020 7:32 AM, Marcus Vinicius Mesquita wrote:
> Dear list
>
> I need to typeset a book for kids wich contains texts where each lette= r
> is assigned a fixed color, for example:
>
> A - - > red;
> B - - > blue;
> ...
> Z - - > green.
>
> What would be the best way to do this? TIA.
There's more ways to do this but here is one:

(1) make a file: colorfont.lfg:

return {
=C2=A0 =C2=A0 =C2=A0name =3D "coloralphabet",
=C2=A0 =C2=A0 =C2=A0colorschemes =3D {
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0default =3D {
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0[1] =3D { "a", &q= uot;e" },
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0[2] =3D { "i", &q= uot;o", "u" },
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0},
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0whatever =3D {
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0[1] =3D { "65:90"= },
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0[2] =3D { },
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0[3] =3D { },
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0[4] =3D { "97:122"= ; },
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0}
=C2=A0 =C2=A0 =C2=A0}
}

There is some more possible but this wil do ...

(2) You define a font with these goodies attached:

\setupbodyfont[plex,10pt]

\definefontfeature
=C2=A0 =C2=A0[MyFeaturesA] [default]
=C2=A0 =C2=A0[goodies=3D{colorfont},colorscheme=3Ddefault,liga=3Dno]

\definefontfeature
=C2=A0 =C2=A0[MyFeaturesB] [default]
=C2=A0 =C2=A0[goodies=3D{colorfont},colorscheme=3Dwhatever,liga=3Dno]

\definefont[MyFontA][Serif*MyFeaturesA]
\definefont[MyFontB][Serif*MyFeaturesB]

(3) and use it this way:

\starttext

\setfontcolorscheme[1] {\MyFontA \samplefile{tufte}}\par
\setfontcolorscheme[2] {\MyFontA \samplefile{tufte}}\par
\setfontcolorscheme[3] {\MyFontA \samplefile{tufte}}\par

\page

\setfontcolorscheme[1] {\MyFontB \samplefile{tufte}}\par
\setfontcolorscheme[2] {\MyFontB \samplefile{tufte}}\par
\setfontcolorscheme[3] {\MyFontB \samplefile{tufte}}\par

\stoptext

Now, this is pretty (more than a decade) old functionality from early
days of mkiv/luatex when it was used for some tracing (by Idris) and it still works (surprise).

Today I would definitely use more recent trickery. If there is real
demand for this I can have a look at it, after all it's "kind of f= un"
(as is most of font stuff).

Hans

-----------------------------------------------------------------
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0Hans Hagen | PRAGMA ADE
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0Ridderstraat 27 | 80= 61 GH Hasselt | The Netherlands
=C2=A0 =C2=A0 =C2=A0 =C2=A0 tel: 038 477 53 69 | www.pragma-ade.n= l | www.pragma-pod.nl
-----------------------------------------------------------------
--00000000000086a57d05aa91b67b-- --===============1991158390256682241== 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== --===============1991158390256682241==--