[NTG-context] ConTeXt meeting Lua tutorials

Taco Hoekwater taco at elvenkind.com
Mon Aug 23 20:22:19 CEST 2010

On 08/23/2010 06:37 PM, Mojca Miklavec wrote:
> [the following is just some brainstorming]
> For fonts, agreed with Luigi, it would be nice to see some lua code that
> a) takes a bunch of fonts as input (like:
> regular/italic/bold/bolditalic/script) and writes some simple sentence
> with all variants; switching options on and off (after thinking a bit,
> this can just as well be done in almost-plain-TeX in LuaTeX, so maybe
> it's not such a good idea)

This teaches nothing that really needs the lua font interface, so I
do not think that is such a good idea either.

> b) takes a font as input and makes a really nice graphical representation:
> - font name (under different OS systems?), file name, ...
> - available features
> - glyph repertoire (index/Unicode point/name/big drawing)
> - alternatives of the same glyph (under small caps or when alternative
> styles play some role), ... [i know it's incomplete]
> - ...
> - takes some input string and writes out that sentence under different
> permutations of available features (with some user's help)

This sounds interesting (and, also important, doable up to a reasonable
point within the available time).

> c) shows some OpenType math tricks (visually?) or even does the same
> as showttf/poin b, but for math (challenge :) :) :)

OpenType Math really uses next to no lua code, it is almost all coded
in the executable proper, so it would be hard to do something
illustrative that is not overly complex on purpose at the same time.
As a beginner's tutorial, that is probably a step too far.

Myself, I was thinking of how to create a virtual font on the fly.
but b) definitely sounds interesting.

> One of possible ideas for an advanced example (just brainstorming; you
> need to judge whether it makes sense or not; it might be too long&
> complicated, but it would be instructive to see both parsing and
> drawing at the same time):
> - parse some very simple text input
> - draw the image with mplib
> For example, one could try to parse:
>      http://www.daylight.com/dayhtml/doc/theory/theory.smiles.html
> (but with some strict restrictions, like: no cycles allowed, no
> reactions, ... only element names, =, # and parenthesis with at most
> one branch; no nested ones)
> and then try to draw a full circle for every element and connect the
> circles with single/double/triple lines (no attempt for optimal
> placement and nothing complicated).

Should be ok, if I cheat a bit on the creation of metapost macros.
I had a somewhat similar idea myself, for parsing turtle graphics,
but that needed quite a bit of lpeg for which we may not have enough
time, so I had almost given up on parsing stuff. this chemistry stuff
is doable within the time constraints, I think.

Best wishes,

More information about the ntg-context mailing list