ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Hans Hagen <j.hagen@xs4all.nl>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>,
	"Jairo A. del Rio" <jairoadelrio6@gmail.com>
Subject: new font trickery
Date: Sun, 24 Jan 2021 16:44:00 +0100	[thread overview]
Message-ID: <fcf8d9e6-b738-eb6e-c60c-6da76d359924@xs4all.nl> (raw)
In-Reply-To: <CAKyqqab+L48mwDa9wxz-hY5Z344NjsqsqtK72myPpionuSHtig@mail.gmail.com>

Hi Jairo,

(to the list for those who want to play with it)

In addition to the metapost fotn subsystem I also made a tex variant. 
That one is currently based on setups. So, we now can use mp as well as 
tex to make fonts. Of course this is mostly for special purposes and for 
fun but both are quite efficient.

\starttext

\setupexternalfigure[directory={global,default}]

\startsetups box:demo:103
     \externalfigure[cow-brown.pdf][height=12pt]
\stopsetups

\startsetups box:demo:104
     \externalfigure[cow-black.pdf][height=10pt]
\stopsetups

\startsetups box:demo:105
     \externalfigure[mill.png][height=12pt]
\stopsetups

\startsetups box:demo:106
     \externalfigure[hacker.jpg][height=12pt]
\stopsetups

\registerboxglyph category {demo} unicode 103 \relax % rather low level 
for now
\registerboxglyph category {demo} unicode 104 \relax % rather low level 
for now
\registerboxglyph category {demo} unicode 105 \relax % rather low level 
for now
\registerboxglyph category {demo} unicode 106 \relax % rather low level 
for now

\definefontfeature[whatever][box=demo]

\definedfont[Serif*whatever]

% \enabletrackers[fonts.collecting]

\startTEXpage%[offset=0pt]
    %\hbox{g}%
     \hbox{\char103}%
     \hbox{\char104}%
\stopTEXpage

\startsetups box:demo:whatever
     \startMPcode
         picture p ; p := image (draw figure "hacker.jpg" ysized 10pt);
         fill      boundingbox p enlarged .5pt randomized 2pt withcolor 
"darkgray" ;
         clip p to boundingbox p enlarged -1pt randomized 2pt ;
         draw p ;
     \stopMPcode
\stopsetups

% in current font!

\iffontchar\font\privatecharactercode{demo:whatever}\else
     \setboxglyph {
         category {demo}
         name     {demo:whatever}
         setups   {box:demo:whatever}
     }%
\fi

\startTEXpage[offset=10pt]
     \char\privatecharactercode{demo:whatever}%
\stopTEXpage

\startTEXpage%[offset=0pt]
     \ruledhbox{\char103}
     \ruledhbox{\char104}
     \ruledhbox{\char105}
     \ruledhbox{\char106}
\stopTEXpage

\dorecurse{1000}{
     \char 103\relax \space
     \char 104\relax \space
     \char 105\relax \space
     \char 106\relax \space
}

\page

\setupalign[verytolerant,flushleft]

\dorecurse{100}{
     #1:
     \glyph yoffset -2pt `i\relax
     \glyph yoffset -3pt `j\relax\space
}

\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
-----------------------------------------------------------------
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

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

  parent reply	other threads:[~2021-01-24 15:44 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-24  1:10 m-ipsum broken Jairo A. del Rio
2021-01-24 12:40 ` Hans Hagen
2021-01-24 15:44 ` Hans Hagen [this message]
2021-01-24 16:34   ` new font trickery Pablo Rodriguez
     [not found]     ` <149c1645-b437-bc71-76f6-8ccd3bf1e650@xs4all.nl>
2021-01-24 17:16       ` Pablo Rodriguez
2021-01-24 21:25         ` Hans Hagen
  -- strict thread matches above, loose matches on Subject: below --
2020-12-22 21:28 Hans Hagen
2020-12-23 10:36 ` mf
2020-12-23 10:46   ` Hans Hagen

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=fcf8d9e6-b738-eb6e-c60c-6da76d359924@xs4all.nl \
    --to=j.hagen@xs4all.nl \
    --cc=jairoadelrio6@gmail.com \
    --cc=ntg-context@ntg.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).