From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FROM,HTML_MESSAGE,MAILING_LIST_MULTI, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 5384 invoked from network); 21 Nov 2023 05:37:18 -0000 Received: from cgl.ntg.nl (5.39.185.202) by inbox.vuxu.org with ESMTPUTF8; 21 Nov 2023 05:37:18 -0000 Received: from localhost (localhost [127.0.0.1]) by cgl.ntg.nl (Postfix) with ESMTP id F241B48394B for ; Tue, 21 Nov 2023 06:36:13 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at cgl.ntg.nl Received: from cgl.ntg.nl ([127.0.0.1]) by localhost (cgl.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id n7IPiYlGNlXX for ; Tue, 21 Nov 2023 06:36:13 +0100 (CET) Received: from cgl.ntg.nl (localhost [127.0.0.1]) by cgl.ntg.nl (Postfix) with ESMTP id 275554838CB for ; Tue, 21 Nov 2023 06:34:08 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by cgl.ntg.nl (Postfix) with ESMTP id BF2C8483874 for ; Tue, 21 Nov 2023 06:33:15 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at cgl.ntg.nl Received: from cgl.ntg.nl ([127.0.0.1]) by localhost (cgl.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id f7y2W3HbKCll for ; Tue, 21 Nov 2023 06:33:15 +0100 (CET) Received: from mail-ed1-f46.google.com (mail-ed1-f46.google.com [209.85.208.46]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by cgl.ntg.nl (Postfix) with ESMTPS id 27A80483871 for ; Tue, 21 Nov 2023 06:33:15 +0100 (CET) Received: by mail-ed1-f46.google.com with SMTP id 4fb4d7f45d1cf-53d8320f0easo7388067a12.3 for ; Mon, 20 Nov 2023 21:33:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1700544794; x=1701149594; darn=ntg.nl; h=to:subject:message-id:date:from:mime-version:from:to:cc:subject :date:message-id:reply-to; bh=pIoz0tWScozmFA7kKY7E92o8d7SR92Kirhn/nc61I38=; b=CYDiJwVmk1VBsnW4N4VISTk34Zknv+Fn/6SYYOHYNbCX05eVXj0e3TXgJRpf3YKjxN TyGfQH40DIFg6tGEpoWKVjgakXOyHemxQWWWkcaBWPIfW5mC5H+lFtsi+XydXFJkOowz yWzLIW5yvJqWVN5SiAl33cm/notpwFSj5fx+d6uCLaXJTXwLf+5LN8spgiz2KZ57mTWJ ey9SGGpHe3njSwPz47yjSpDILnI0jMcZM+9t0xOsccSqS9cJ4xCDWYs2rlZ0ujI4Iau2 J7h3EEs/zx1jnLZEd0ACfxq2wQDGJx+hv5O+GFqdJwBrMMEB1iO9R99e/8+a9Knh2Wcw vyjQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700544794; x=1701149594; h=to:subject:message-id:date:from:mime-version:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=pIoz0tWScozmFA7kKY7E92o8d7SR92Kirhn/nc61I38=; b=Q+KAyOYpH/1wGcdjveG4ivlDze/n8rGHWyjPwfrluaxH3EVg2IWQd3BYUx3y1pFhSD q1cMNLT+gM8O1ZN8XEzF1ky57Y2aEZQ2RCMe5XSdcmcCAkAv2S/kY7Z+R4tEm2Z4/Gvq jhu3rnkn4QHtZkINBHygH3HPSjLsZ/sqIjSvvzFDxmR6FjsLawCdS/pbYouX3HOv5Uvv X4AOW0xz3RRbuJTK3QKfu+x/dPp5AaP1lBM1/tTGpmEDGJzkkA/XPSvVIlafOpIzmKU4 Rr7Hos3SWQ++K2ygX+fJVlg0aGb/4UHuHucyyHkIjyXK+gxJAQYyV/RCfU4TwQZ1+XWC fv1A== X-Gm-Message-State: AOJu0YxEhHzwEHeRlv+v/gqXaOQuAowIzXpjV4oea5U2e0c/864zUtPW YPoqL67ulksydR/+YdczRJYlXjsoB5AWtkKLENXd6I5KEXBmlQ== X-Google-Smtp-Source: AGHT+IEbKv9Y2vOi2S83rGPlWeK6i6+eFyuzYvbccB9an3ME0LGqsNj/p9owAocvifc+IYHRxJSdS1fWdzhy500bgT4= X-Received: by 2002:a17:906:cc:b0:a01:f8a7:a94a with SMTP id 12-20020a17090600cc00b00a01f8a7a94amr381617eji.14.1700544794048; Mon, 20 Nov 2023 21:33:14 -0800 (PST) MIME-Version: 1.0 From: Andres Conrado Montoya Date: Tue, 21 Nov 2023 00:32:37 -0500 Message-ID: To: mailing list for ConTeXt users Message-ID-Hash: MLFQO3QY3TZCMG4TG7IHCZ6TSRA7E3BM X-Message-ID-Hash: MLFQO3QY3TZCMG4TG7IHCZ6TSRA7E3BM X-MailFrom: andresconrado@gmail.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.8 Precedence: list Reply-To: mailing list for ConTeXt users Subject: [NTG-context] Drawing calligraphy practice grid in metafun List-Id: mailing list for ConTeXt users Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Content-Type: multipart/mixed; boundary="===============1493170303260318957==" --===============1493170303260318957== Content-Type: multipart/alternative; boundary="0000000000005fbae5060aa2f0d4" --0000000000005fbae5060aa2f0d4 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hello list I've been working on a little project of mine. I give calligraphy workshops and I have been using a nice tool created by Josselin Cuette, available at http://ductus.josselincuette.com/ to generate practice templates for interested people. However, I would prefer to have an offline solution. This adventure started with the usual insidious idea: "I could do this in ConTeXt! And this is a great opportunity to learn metafun!" A couple weeks later, I have an almost ready product! It compiles fine, but I have the following issue: The template creates a Line, composed of Sections. And uses variables to assign a measurement for the nib-width, and an amount of ascender, x-height and descender Sections (nib-widths), to compose a Line. But also, I would like to, if needed, display nib-width marks on the left side. My code so far generates marks, but only for the first Line. I think they are generated but maybe they are placed on top of each other, maybe? I'm not sure why my logic is not working. Also, if I change the amount for ascenders, descenders of x-height, the marks are not drawn correctly. My current path for a mark is a custom path emulating two unit squares, nib-width size, on top of each other, with the top one shifted a nib-width to the right. A little bit like a chess board, or a scale ruler on a map. But this would only work in Lines that have an even amount of Sections. I'm not sure how to proceed with that... I tried using unit squares, but that made things very complex, and after fumbling around I managed to get this far. If you can take a look, or have some advice, it would be greatly appreciated. I hope it is understandable. My code: %%%%%%%%%%%%%%%%%% \setuppapersize[letter,landscape][letter,landscape] \setuplayout[backspace=3D15mm,width=3D250mm,header=3D0mm,footer=3D0mm] \startreusableMPgraphic{pauta} % Global variables: % Show nib-width marks boolean marks ; marks :=3D true ; % Path for nib-width path mark ; mark :=3D (0,0) -- (1,0) -- (1,2) -- (2,2) -- (2,1) -- (0,1) = -- cycle ; % Line width numeric line ; line :=3D \the\textwidth ; % Type box numeric box ; box :=3D \the\textheight ; % Nib width (distance between lines) numeric nib ; nib :=3D 3mm ; % Ascenders for writing line numeric asc ; asc :=3D 3 ; % x-height for writing line numeric med ; med :=3D 4 ; % Descenders for writing line numeric dsc ; dsc :=3D 3 ; % Total height of a writing line in mm (including asc, med, and dsc) numeric lineHeight ; lineHeight =3D (asc + med + dsc) * nib ; % Available lines on a page numeric availableLines ; availableLines =3D round(box / lineHeight) - 1 ; % Starting position numeric start ; start :=3D 0 ; % Macros % Draw a section of a line (ascender, x-height or descender) vardef Section(expr lines, initial) =3D draw (0, initial) -- (line, initial) withpen pencircle scaled 0.2mm ; for i=3D0 step 1 until lines : save final ; final =3D i*nib ; pair a; a =3D (0, final + initial) ; pair b; b =3D (line, final + initial) ; draw a -- b withpen pencircle scaled 0.1mm ; % If marks=3Dtrue show nib-width marks if marks =3D true: fill mark scaled nib yshifted (final*2) ; fi ; endfor ; draw (0, final + initial) -- (line, final + initial) withpen pencircle scaled 0.2mm ; final + initial enddef ; % Draw a line with the three secions (asc, med, dsc) vardef Line(expr descender, ascender, xheight, initial) =3D numeric dd, oo, aa ; % L=C3=ADneas dd =3D Section(descender, initial) ; oo =3D Section(xheight, dd) ; aa =3D Section(ascender, oo) ; % Devolver posicion final con espacio para siguiente renglon aa + nib*2 enddef ; % Llenar la p=C3=A1gina con renglones for i=3D1 upto availableLines : start :=3D Line(dsc, asc, med, start) ; endfor ; \stopreusableMPgraphic \startdocument \startstandardmakeup \reuseMPgraphic{pauta} \stopstandardmakeup \stopdocument %%%%%%%%%%%%%%%%%%%%%%%%%% --=20 Andr=C3=A9s Conrado Montoya Andi K=C3=BA andresconrado@gmail.com http://sesentaycuatro.com http://messier87.com http://chiquitico.org ---------------------------------------- Los fines no justifican los medios, porque la medida verdadera de nuestro car=C3=A1cter est=C3=A1 dada por los medios que estamos dispuestos a utiliz= ar, no por los fines que proclamamos. ---------------------------------------- =E2=80=9CYou develop an instant global consciousness, a people orientation,= an intense dissatisfaction with the state of the world, and a compulsion to do something about it. From out there on the moon, international politics look so petty. You want to grab a politician by the scruff of the neck and drag him a quarter of a million miles out and say, =E2=80=98Look at that, you so= n of a bitch.=E2=80=99=E2=80=9D =E2=80=94 Apollo 14 astronaut Edgar Mitchell --0000000000005fbae5060aa2f0d4 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hello list
I've been working on a little project o= f mine. I give calligraphy workshops and I have been using a nice tool crea= ted by=C2=A0Josselin Cuette, available at=C2=A0http://ductus.josselincuette.com/=C2=A0to generate pr= actice templates for interested people.=C2=A0

Howe= ver, I would prefer to have an offline solution. This adventure started wit= h the usual insidious idea: "I could do this in ConTeXt! And this is a= great opportunity to learn metafun!"

A couple week= s later, I have an almost ready product! It compiles fine, but I have the f= ollowing issue: The template creates a Line, composed of Sections. And uses= variables to assign a measurement for the nib-width, and an amount of asce= nder, x-height and descender Sections (nib-widths), to compose a Line.=C2= =A0

But also, I would like to, if needed, display = nib-width marks on the left side. My code so far generates marks, but only = for the first Line. I think they are generated but maybe they are placed on= top of each other, maybe? I'm not sure why my logic is not working.=C2= =A0

Also, if I change the amount for ascenders, de= scenders of x-height, the marks are not drawn correctly.=C2=A0
My current path for a mark is a custom path emulating two unit= squares, nib-width size, on top of each other,=C2=A0with the top one shift= ed a nib-width to the right. A little bit like a chess board,=C2=A0or a sca= le ruler on a map. But this would only work in Lines that have an even amou= nt of Sections. I'm not sure how to proceed with that... I tried using = unit squares, but that made things very complex,=C2=A0and after fumbling ar= ound I managed to get this far.

If you can take a = look, or have some advice, it would be greatly appreciated. I hope it is un= derstandable.=C2=A0

My code:=C2=A0

<= /div>
%%%%%%%%%%%%%%%%%%
\setuppapersize[letter,landscape][le= tter,landscape]
\setuplayout[backspace=3D15mm,width=3D250mm,header=3D0mm= ,footer=3D0mm]

\startreusableMPgraphic{pauta}
=C2=A0 % Global var= iables:

=C2=A0 % Show nib-width marks
=C2=A0 boolean marks ; mark= s :=3D true ;

=C2=A0 % Path for nib-width
=C2=A0 path mark ; mark= :=3D (0,0) -- (1,0) -- (1,2) -- (2,2) -- (2,1) -- (0,1) -- cycle ;

= =C2=A0 % Line width
=C2=A0 numeric line ; line :=3D \the\textwidth ;
=
=C2=A0 % Type box
=C2=A0 numeric box ; box :=3D \the\textheight ;
=C2=A0 % Nib width (distance between lines)
=C2=A0 numeric nib ; ni= b :=3D 3mm ;

=C2=A0 % Ascenders for writing line
=C2=A0 numeric a= sc ; asc :=3D 3 ;

=C2=A0 % x-height for writing line
=C2=A0 numer= ic med ; med :=3D 4 ;

=C2=A0 % Descenders for writing line
=C2=A0= numeric dsc ; dsc :=3D 3 ;

=C2=A0 % Total height of a writing line = in mm (including asc, med, and dsc)
=C2=A0 numeric lineHeight ;
=C2= =A0 lineHeight =3D (asc + med + dsc) * nib ;

=C2=A0 % Available line= s on a page
=C2=A0 numeric availableLines ;
=C2=A0 availableLines =3D= round(box / lineHeight) - 1 ;

=C2=A0 % Starting position
=C2=A0 = numeric start ; start :=3D 0 ;

=C2=A0 % Macros

=C2=A0 % Draw = a section of a line (ascender, x-height or descender)
=C2=A0 vardef Sect= ion(expr lines, initial) =3D
=C2=A0 =C2=A0 draw (0, initial) -- (line, i= nitial) withpen pencircle scaled 0.2mm ;
=C2=A0 =C2=A0 for i=3D0 step 1 = until lines :
=C2=A0 =C2=A0 =C2=A0 save final ; final =3D i*nib ;
=C2= =A0 =C2=A0 =C2=A0 pair a; a =3D (0, final + initial) ;
=C2=A0 =C2=A0 =C2= =A0 pair b; b =3D (line, final + initial) ;
=C2=A0 =C2=A0 =C2=A0 draw a = -- b withpen pencircle scaled 0.1mm ;
=C2=A0 =C2=A0 =C2=A0 % If marks=3D= true show nib-width marks
=C2=A0 =C2=A0 =C2=A0 if marks =3D true:
=C2= =A0 =C2=A0 =C2=A0 =C2=A0 fill mark scaled nib yshifted (final*2) ;
=C2= =A0 =C2=A0 =C2=A0 fi ;
=C2=A0 =C2=A0 endfor ;
=C2=A0 =C2=A0 =C2=A0 dr= aw (0, final + initial) -- (line, final + initial)
=C2=A0 =C2=A0 =C2=A0 = =C2=A0 withpen pencircle scaled 0.2mm ;
=C2=A0 =C2=A0 final + initial=C2=A0 enddef ;

=C2=A0 % Draw a line with the three secions (asc, m= ed, dsc)
=C2=A0 vardef Line(expr descender, ascender, xheight, initial) = =3D
=C2=A0 =C2=A0 numeric dd, oo, aa ;
=C2=A0 =C2=A0 % L=C3=ADneas=C2=A0 =C2=A0 dd =3D Section(descender, initial) ;
=C2=A0 =C2=A0 oo =3D= Section(xheight, dd) ;
=C2=A0 =C2=A0 aa =3D Section(ascender, oo) ;
= =C2=A0 =C2=A0 % Devolver posicion final con espacio para siguiente renglon<= br>=C2=A0 =C2=A0 aa + nib*2
=C2=A0 enddef ;

=C2=A0 % Llenar la p= =C3=A1gina con renglones
=C2=A0 for i=3D1 upto availableLines :
=C2= =A0 =C2=A0 start :=3D Line(dsc, asc, med, start) ;
=C2=A0 endfor ;
\s= topreusableMPgraphic

\startdocument
=C2=A0 \startstandardmakeup=C2=A0 =C2=A0 \reuseMPgraphic{pauta}
=C2=A0 \stopstandardmakeup
\st= opdocument
%%%%%%%%%%%%%%%%%%%%%%%%%%

--
=
Andr=C3=A9s Conrado Montoya
Andi K=C3=BA
andresconrado@gmail.= com
http://s= esentaycuatro.com
-------------------= ---------------------
Los fines no justifican los medios, porque la medi= da verdadera de nuestro car=C3=A1cter est=C3=A1 dada por los medios que est= amos dispuestos a utilizar, no por los fines que proclamamos.
----------= ------------------------------

=E2=80=9CYou develop an instant global= consciousness, a people orientation,=20 an intense dissatisfaction with the state of the world, and a compulsion to do something about it. From out there on the moon, international=20 politics look so petty. You want to grab a politician by the scruff of=20 the neck and drag him a quarter of a million miles out and say, =E2=80=98Lo= ok at that, you son of a bitch.=E2=80=99=E2=80=9D =E2=80=94 Apollo 14 astronaut = Edgar Mitchell

--0000000000005fbae5060aa2f0d4-- --===============1493170303260318957== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline ___________________________________________________________________________________ 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 ___________________________________________________________________________________ --===============1493170303260318957==--