On 1/29/2026 5:46 PM, Otared Kavian wrote:
Hi everyone,

Has anyone on this list tried to use in ConTeXt the loggates font described on 
CTAN :

        https://ctan.org/pkg/loggates

or any other font containing these symbols ?

Indeed one could use images of the logic gates as described here

        https://en.wikipedia.org/wiki/Logic_gate

and insert them when necessary, but the result is not elegant.

Thanks in advance for any hint: Otared

Attached some homework (some missing bits):

- what shapes are best
- what unicodes make sense

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
-----------------------------------------------------------------

Attachment: meta-imp-logicsymbols.pdf
Description: Adobe PDF document

%D \module
%D   [       file=meta-imp-logicsymbols,
%D        version=2026.01.29,
%D          title=\METAPOST\ Graphics,
%D       subtitle=Logic Symbols,
%D         author=Hans Hagen,
%D           date=\currentdate,
%D      copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
%C
%C This module is part of the \CONTEXT\ macro||package and is
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.

\startMPcalculation{simplefun}

    path Logic[] ;

    Logic[30] := (0,1  ) -- (-1,1  ) ;
    Logic[31] := (0,0.5) -- (-1,0.5) ;
    Logic[32] := (0,1.5) -- (-1,1.5) ;
    Logic[33] := (2,1  ) -- ( 3,1  ) ;
    Logic[34] := fullcircle scaled .4 shifted (2.2,1) -- (2.4,1) -- (3,1) ;

    Logic[1]  := (0,0) -- (1,0) .. (2,1) .. (1,2) -- (0,2) -- cycle ;
    Logic[2]  := (0,0) -- (2,1) -- (0,2)-- cycle ;

    def LogicBUFFER =
        pickup pencircle scaled 1/4 ;
        draw Logic[2] && Logic[30] && Logic[33] ;
        currentpicture := currentpicture shifted (1,0) ;
    enddef ;

    def LogicNOT =
        pickup pencircle scaled 1/4 ;
        draw Logic[2] && Logic[30] && Logic[34] ;
        currentpicture := currentpicture shifted (1,0) ;
    enddef ;

    def LogicAND =
        pickup pencircle scaled 1/4 ;
        draw Logic[1] && Logic[31] && Logic[32] && Logic[33] ;
        currentpicture := currentpicture shifted (1,0) ;
    enddef ;

    def LogicNAND =
        pickup pencircle scaled 1/4 ;
        draw Logic[1] && Logic[31] && Logic[32] && Logic[34] ;
        currentpicture := currentpicture shifted (1,0) ;
    enddef ;

    vardef LogicOR =
        pickup pencircle scaled 1/4 ;
        draw Logic[2] && Logic[31] && Logic[32] && Logic[33] ;
        currentpicture := currentpicture shifted (1,0) ;
    enddef ;

    vardef LogicNOR =
        pickup pencircle scaled 1/4 ;
        draw Logic[2] && Logic[31] && Logic[32] && Logic[34] ;
        currentpicture := currentpicture shifted (1,0) ;
    enddef ;

    vardef LogicXOR =
        pickup pencircle scaled 1/4 ;
        % todo
        currentpicture := currentpicture shifted (1,0) ;
    enddef ;

    vardef LogicXNOR =
        pickup pencircle scaled 1/4 ;
        % todo
        currentpicture := currentpicture shifted (1,0) ;
    enddef ;

    lmt_registerglyphs [
        name     = "symbols:logic",
        units    = 4,
        width    = 4,
        height   = 2,
        depth    = 0,
        usecolor = true,
    ] ;

    lmt_registerglyph [ category = "symbols:logic", unicode = "0xFE01", code = 
"LogicBUFFER;" ] ;
    lmt_registerglyph [ category = "symbols:logic", unicode = "0x00AC", code = 
"LogicNOT;"    ] ;
    lmt_registerglyph [ category = "symbols:logic", unicode = "0x22BA", code = 
"LogicAND;"    ] ;
    lmt_registerglyph [ category = "symbols:logic", unicode = "0x22BB", code = 
"LogicOR;"     ] ;
    lmt_registerglyph [ category = "symbols:logic", unicode = "0x22BC", code = 
"LogicNAND;"   ] ;
    lmt_registerglyph [ category = "symbols:logic", unicode = "0x22BD", code = 
"LogicNOR;"    ] ;
  % lmt_registerglyph [ category = "symbols:logic", unicode = "0xFE02", code = 
"LogicXOR;"    ] ;
  % lmt_registerglyph [ category = "symbols:logic", unicode = "0xFE03", code = 
"LogicXNOR;"   ] ;

\stopMPcalculation

\definefontfeature
  [symbols:logic]
  [default]
  [metapost={category=symbols:logic}]

\continueifinputfile{meta-imp-logicsymbols.mkxl}

\starttext

    \showglyphs

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

    \startTEXpage[offset=3pt]
        \Logic
        logic\quad\char"22BA\quad\char"22BC\quad\char"22BB\quad\char"22BD\quad
                  \char"00AC\quad\char"FE01\par
        \darkblue
        logic\quad ⊺\quad ⊼\quad ⊻\quad ⊽\quad
                   ¬\par
        \darkgreen
        logic\quad\char"22BA\quad\char"22BC\quad\char"22BB\quad\char"22BD\quad
                  \char"00AC\quad\char"FE01\par
        \darkred
        logic\quad ⊺\quad ⊼\quad ⊻\quad ⊽\quad
                   ¬\par
    \stopTEXpage

\stoptext
___________________________________________________________________________________
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