Dear Hans,

Thank you for the quick update.
The modified version is very nice and easy to use.(though \Gate{F800} and 
\Gate{F801} should be changed at line 135)

I am trying to use these symbols to draw the circuit.
I am able to arrange the gates using “label” in MetaFun. But I don’t know how 
to connect them.
To do that, I need to know the exact position of input and output of gates.

Question:

What is the unit of drawing gates in the module? You use  “draw (0,1)—(-1,1);” 
to draw an input. Is there a default unit to say like that?
I can see “unit = 4” only in the whole module. By changing the unit, the size 
of font is changed. Since I am just an user, I cannot find a way of locating 
the position.

Is there a way to calculate the real position of inputs and outputs?

Thank you so much.

Best regards,

Dalyoung


******
Here is a test file for gates.

\usemodule[./Mathematics/meta-imp-logicsymbols.mkxl]

\startMPdefinitions
def connectPts(expr initP, termP)=
    pair M;
    M := .5(initP+termP);
    if xpart initP = xpart termP:
      draw ypart initP -- ypart termP;
    elseif ypart initP = ypart termP:
      draw xpart initP -- xpart termP;
    else:  
      draw initP -- (xpart M,ypart initP)--(xpart M,ypart termP) -- termP;
    fi;
enddef;
\stopMPdefinitions

\starttext

    \definefont[logic][Serif*symbols:logic]

This is a test of logic font:

  \startMPcode
  numeric u; u := 1cm;
  pair A,B;
  A := (1,0)*u;
  B := (2,3)*u;

  label(textext("\tfb\lAND"), origin);
  label(textext("\tfb\lOR"), (0, -1cm));
  label(textext("\tfc\lXOR"), (1cm, -.5cm));
  connectPts(A,B);
  \stopMPcode

  \stoptext


> 2026. 1. 31. 오전 8:41, Otared Kavian <[email protected]> 작성:
> 
> Hi Hans,
> 
> Thanks for the new version of the meta-imp-logicsymbols.mkxl module. 
> It works fine and the shapes are very nice.
> I will test it in a document for students.
> 
> Thanks a lot again,
> Best regards: Otared
> 
> 
> 
>> On 30 Jan 2026, at 22:42, Hans Hagen via ntg-context <[email protected] 
>> <mailto:[email protected]>> wrote:
>> 
>> On 1/30/2026 9:53 AM, Jeong Dal via ntg-context wrote:
>>> Hi, Hans,
>>> It is great to see the result of defining fonts of Logic gates.
>>> Also, I learn your clever way of drawing logic gates a lot from your code.
>> 
>> It was just a quick hack. I cleaned it up a bit.
>> 
>>> Last year, I need to make a short manuscript of logic which contains the 
>>> logic gates and Karnaugh Map for high school teachers.
>>> You may remember that I asked a lot to use Lua and MetaFun to draw Karnaugh 
>>> map.
>>> You helped a lot and I am able to draw them more easily.
>>> Later, I found a Karnaugh Map module!
>>> At that time, another huddle is to draw logic gates. I draw it one by one 
>>> that is a real time consuming job, and connecting those gates with lines is 
>>> another trial and error job.
>> 
>> I wonder if the flowchart module could help you there. After all there we 
>> have shapes, connecting lines, etc.
>> 
>>> There are so many math symbols like \infty, \sum, etc.
>>> Is it possible to define them like math symbols to use them  \logicNot, 
>>> \logicOr, …
>> 
>> It depends on how you use the font. We basically hook them into a regular 
>> font.
>> 
>> 
>>> BTW, logic gates is used to draw a circuit diagram, so it is another way to 
>>> use them as figure.
>>> I believe that you find the best way of using it.
>> 
>> For circuit diagram there are cad-like programs that also validate the 
>> design.
>> 
>> Hans
>> 
>> 
>> -----------------------------------------------------------------
>>                                          Hans Hagen | PRAGMA ADE
>>              Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
>>       tel: 038 477 53 69 | www.pragma-ade.nl <http://www.pragma-ade.nl/> | 
>> www.pragma-pod.nl <http://www.pragma-pod.nl/>
>> -----------------------------------------------------------------<meta-imp-logicsymbols.mkxl>___________________________________________________________________________________
>> If your question is of interest to others as well, please add an entry to 
>> the Wiki!
>> 
>> maillist : [email protected] <mailto:[email protected]> / 
>> https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl 
>> <https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl>
>> webpage  : https://www.pragma-ade.nl <https://www.pragma-ade.nl/> / 
>> https://context.aanhet.net <https://context.aanhet.net/> (mirror)
>> archive  : https://github.com/contextgarden/context 
>> <https://github.com/contextgarden/context>
>> wiki     : https://wiki.contextgarden.net <https://wiki.contextgarden.net/>
>> ___________________________________________________________________________________
> 
> Otared Kavian
> e-mail: [email protected] <mailto:[email protected]>
> Phone: +33 6 88 26 70 95
> 
> 
> 
> 
> ___________________________________________________________________________________
> If your question is of interest to others as well, please add an entry to the 
> Wiki!
> 
> maillist : [email protected] / 
> 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
> ___________________________________________________________________________________

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : [email protected] / 
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
___________________________________________________________________________________

Reply via email to