ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Hans Hagen via ntg-context <ntg-context@ntg.nl>
To: Willi Egger via ntg-context <ntg-context@ntg.nl>
Cc: Hans Hagen <j.hagen@freedom.nl>
Subject: Re: [NTG-context] Kaktovik numerals
Date: Wed, 19 Apr 2023 23:41:18 +0200	[thread overview]
Message-ID: <f79284a4-d42e-bcef-d0a9-9d5e2756ce51@freedom.nl> (raw)
In-Reply-To: <0B0CF438-1FC2-4DAE-9CBD-2F22D1977863@boede.nl>

[-- Attachment #1: Type: text/plain, Size: 1391 bytes --]

On 4/19/2023 10:45 PM, Willi Egger via ntg-context wrote:
> Hello Gavin,
> 
> thank you so much for your input. — Indeed you are right. Please find attached the corrected version.
> 
> 
> 
> Willi
> 
>> On 19 Apr 2023, at 20:58, Gavin via ntg-context <ntg-context@ntg.nl> wrote:
>>
>> Hi Willi,
>>
>> What fun! I think I found a couple math items to correct.
>>
>> 1) The second line of the tables at the top of page 2 should be:
>>     1000' 100, 10, 1; 8000, 400, 20, 1
>>
>> 2) For the year conversion: 2023 = 5x20^2 + 1x20 + 3. (Your 0 should be my 1). This will give a three digit Kaktovik numeral. You have 4 digit Kaktovik numerals for 2023, with both a 0 and a 1.
je kunt direct dat nummer converteren maar blijkbaar gaf ik de verkeerde 
volgorde uit:

\useMPlibrary[kaktovik] % de officiele manier

\definefontfeature
   [default]
   [default]
   [metapost=kaktovik]

\setupbodyfont[dejavu]

\starttext
  2023 \kaktoviknumerals{5}\kaktoviknumerals{1}\kaktoviknumerals{3}

\kaktoviknumerals{2023} % deze split dus voor je, order fixed

\stoptext


-----------------------------------------------------------------
                                           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 #2: meta-imp-kaktovik.mkxl --]
[-- Type: text/plain, Size: 4363 bytes --]

%D \module
%D   [       file=meta-imp-kaktovik,
%D        version=2023.04.18,
%D          title=\METAPOST\ Graphics,
%D       subtitle=Kaktovik Numbers,
%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.

%D Just a quick hack for Hraban (after a post on the mailing list).

\startMPcalculation{simplefun}

    path kaktovik_glyphs[] ;

    def InitializeKaktovik =

        save p, d, u ;

        pair p[] ; numeric d ; d := .1 ; numeric u ; u := .15 ;

      % d := getparameterdefault "mpsfont" "d" .10 ;
      % u := getparameterdefault "mpsfont" "u" .15 ;

        p[0] := (0,1) ;
        p[1] := (1,0) ;
        p[2] := (2,1 -  d) ;
        p[3] := (3,0) ;
        p[4] := (4,1 - 2d) ;

        p[5] := (4,1 +  u) ;
        p[6] := (0,1 + 2u) ;
        p[7] := (4,1 + 4u) ;

        kaktovik_glyphs[0] := (1,1)  { right } .. { left } (2,1/2) { left } .. { right } (3,1);

        for i= 1 upto 4 :
            kaktovik_glyphs[i] := p[0] for j=1 upto i : -- p[j] endfor ;
        endfor ;

        kaktovik_glyphs[ 5] := p[5] -- p[0] ;                for i= 6 upto  9 : kaktovik_glyphs[i] := p[5] -- kaktovik_glyphs[i-5] ; endfor ;
        kaktovik_glyphs[10] := p[6] -- kaktovik_glyphs[ 5] ; for i=11 upto 14 : kaktovik_glyphs[i] := p[6] -- kaktovik_glyphs[i-5] ; endfor ;
        kaktovik_glyphs[15] := p[7] -- kaktovik_glyphs[10] ; for i=16 upto 19 : kaktovik_glyphs[i] := p[7] -- kaktovik_glyphs[i-5] ; endfor ;

    enddef ;

    vardef Kaktovik(expr i) =
        draw image (
            draw kaktovik_glyphs[i]
                xscaled (10/20 -1/20)
                yscaled (25/20 -2/20)
                withpen (pencircle xscaled 1/20 yscaled 5/20) rotated -(2*20)
              % withpen (pencircle xscaled 1/40 yscaled 5/40) rotated -(2*20)
              % withpen (pencircle xscaled 2.5/40 yscaled 5/40) rotated -(2*20)
            ;
        ) shifted (2/20,2/20)
    enddef ;

    lmt_registerglyphs [
        name     = "kaktovik",
        units    = 2,
        usecolor = true,
        width    = 2,
        height   = 2,
        depth    = 0,
        preamble = "InitializeKaktovik"
    ] ;

    for i=0 upto 19 :
        lmt_registerglyph [
            category = "kaktovik",
            unicode  = 119488 + i, % "0x1D2C0"
            code     = "Kaktovik(" & decimal i & ")"
        ] ;
    endfor ;

\stopMPcalculation

\startluacode
    interfaces.implement {
        name      = "kaktoviknumerals",
        arguments = "integer",
        actions   = function(n)
            local digits = { }
            local count  = 1
            while true do
                digits[count] = utf.char(0x1D2C0 + (n % 20))
                n = n // 20
                if n == 0 then
                    break;
                end
                count = count + 1
            end
            table.reverse(digits)
            context("%t",digits)
        end
    }
\stopluacode

\unprotect

\permanent\def\kaktoviknumerals#1{\clf_kaktoviknumerals\numexpr#1\relax}

\defineconversion [kaktoviknumerals] [\kaktoviknumerals]
\defineconversion [K]                [\kaktoviknumerals]

\definefontfeature
  [kaktovik]
  [metapost=kaktovik]

\protect

\continueifinputfile{meta-imp-kaktovik.mkxl}

\definefontfeature
  [default]
  [default]
  [metapost=kaktovik]
% [metapost={category=kaktovik,u=.25,d=.20,x=}]

\setupbodyfont[dejavu]

% \nopdfcompression

\startTEXpage[offset=1ts,width=3es]

    \start
    \showglyphs
        KAKTOVIK
        \dostepwiserecurse{0}{19}{1}{\kaktoviknumerals{#1}\space }
    \stop

    kaktovik \start
        \red\glyphxscale 700
        \dostepwiserecurse{0}{19}{1}{\kaktoviknumerals{#1}\space }
    \stop

    \startitemize[packed,K][color=orange,stopper=]
        \startitem first  \stopitem
        \startitem second \stopitem
        \startitem third  \stopitem
    \stopitemize

    KAKTOVIK \start
        \red  \kaktoviknumerals{2023} --
        \green\kaktoviknumerals{4}    --
        \blue \kaktoviknumerals{18}
    \stop

    KAKTOVIK
\stopTEXpage



[-- Attachment #3: Type: text/plain, Size: 496 bytes --]

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

maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : https://contextgarden.net
___________________________________________________________________________________

  reply	other threads:[~2023-04-19 21:41 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-18  8:57 Henning Hraban Ramm via ntg-context
2023-04-18  9:23 ` Arthur Rosendahl via ntg-context
2023-04-18 13:01 ` Hans Hagen via ntg-context
2023-04-18 13:52   ` Willi Egger via ntg-context
2023-04-19 12:29   ` Henning Hraban Ramm via ntg-context
2023-04-18 13:41 ` Willi Egger via ntg-context
2023-04-18 15:50 ` Rudolf Bahr via ntg-context
2023-04-18 17:19 ` Otared Kavian via ntg-context
2023-04-19 15:17 ` Willi Egger via ntg-context
2023-04-19 18:36 ` Willi Egger via ntg-context
2023-04-19 18:58   ` Gavin via ntg-context
2023-04-19 20:45     ` Willi Egger via ntg-context
2023-04-19 21:41       ` Hans Hagen via ntg-context [this message]
2023-04-20 16:06         ` Willi Egger via ntg-context

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=f79284a4-d42e-bcef-d0a9-9d5e2756ce51@freedom.nl \
    --to=ntg-context@ntg.nl \
    --cc=j.hagen@freedom.nl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).