ConTeXt meeting Lua tutorials
![](https://secure.gravatar.com/avatar/565476157eb3895a9c928ffce26d988d.jpg?s=120&d=mm&r=g)
Hi all, Today I started preparations for my activities at the ConTeXt meeting. There are two small lua tutorials in the program, and I am looking for input on both. There is one that is supposed to be a general beginner's introduction, and one specifically about fonts. For both, I am looking for input on what subjects I should cover? Since both tutorials will end up as articles/wiki pages, it makes sense to ask everybody on the list for input (but requests by actual attendees will be scored considerably higher). Best wishes, Taco
![](https://secure.gravatar.com/avatar/386a116d129cdc597f2bb6210bbaff7a.jpg?s=120&d=mm&r=g)
On Sat, Aug 21, 2010 at 1:48 PM, Taco Hoekwater
Hi all,
Today I started preparations for my activities at the ConTeXt meeting.
There are two small lua tutorials in the program, and I am looking for input on both. There is one that is supposed to be a general beginner's introduction, and one specifically about fonts.
For both, I am looking for input on what subjects I should cover?
1)data description (cfr. http://www.lua.org/pil/10.1.html ) for beginner 2)a luatex program similar to showttf for fonts tutorial -- luigi
![](https://secure.gravatar.com/avatar/5a39f1335b6eff433673ed987859fb24.jpg?s=120&d=mm&r=g)
Am 2010-08-21 um 13:48 schrieb Taco Hoekwater:
Hi all,
Today I started preparations for my activities at the ConTeXt meeting.
There are two small lua tutorials in the program, and I am looking for input on both. There is one that is supposed to be a general beginner's introduction, and one specifically about fonts.
For both, I am looking for input on what subjects I should cover?
Since both tutorials will end up as articles/wiki pages, it makes sense to ask everybody on the list for input (but requests by actual attendees will be scored considerably higher).
I'm planning to work on my LilyPond module during the meeting and would like to replace the catcode tinkering with some clean Lua logic, if possible. Don't know what will be required for that. And I guess I could use some image/PDF analyzing, e.g. to finally get inline-music working. Another plan WRT the documentation subject: I'll try to make a ConTeXt "cheat sheet", but that won't need Lua ;-) Greetlings from Lake Constance! Hraban --- http://www.fiee.net/texnique/ http://wiki.contextgarden.net https://www.cacert.org (I'm an assurer)
![](https://secure.gravatar.com/avatar/49e63acb01f2ca80efce7eed08310ce8.jpg?s=120&d=mm&r=g)
On 22-8-2010 4:37, Henning Hraban Ramm wrote:
Am 2010-08-21 um 13:48 schrieb Taco Hoekwater:
Hi all,
Today I started preparations for my activities at the ConTeXt meeting.
There are two small lua tutorials in the program, and I am looking for input on both. There is one that is supposed to be a general beginner's introduction, and one specifically about fonts.
For both, I am looking for input on what subjects I should cover?
Since both tutorials will end up as articles/wiki pages, it makes sense to ask everybody on the list for input (but requests by actual attendees will be scored considerably higher).
I'm planning to work on my LilyPond module during the meeting and would like to replace the catcode tinkering with some clean Lua logic, if possible. Don't know what will be required for that. And I guess I could use some image/PDF analyzing, e.g. to finally get inline-music working.
Another plan WRT the documentation subject: I'll try to make a ConTeXt "cheat sheet", but that won't need Lua ;-)
didn't you once made a math cheat sheet? ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com | www.pragma-pod.nl -----------------------------------------------------------------
![](https://secure.gravatar.com/avatar/5a39f1335b6eff433673ed987859fb24.jpg?s=120&d=mm&r=g)
2010/8/23 Hans Hagen
Another plan WRT the documentation subject: I'll try to make a ConTeXt "cheat sheet", but that won't need Lua ;-)
didn't you once made a math cheat sheet?
Who, me? ;-) I made a formulary for the printing industry (including basic algebra, geometry, statistics etc.), but that was a bit more than a "sheet", and it was my only LaTeX project. Greetlings, Hraban
![](https://secure.gravatar.com/avatar/6114858d84b0f40cf715f12237ab67a1.jpg?s=120&d=mm&r=g)
[the following is just some brainstorming] On Sat, Aug 21, 2010 at 13:48, Taco Hoekwater wrote:
Hi all,
Today I started preparations for my activities at the ConTeXt meeting.
There are two small lua tutorials in the program, and I am looking for input on both. There is one that is supposed to be a general beginner's introduction, and one specifically about fonts.
For both, I am looking for input on what subjects I should cover?
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) 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) c) shows some OpenType math tricks (visually?) or even does the same as showttf/poin b, but for math (challenge :) :) :) 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). Mojca
![](https://secure.gravatar.com/avatar/565476157eb3895a9c928ffce26d988d.jpg?s=120&d=mm&r=g)
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, Taco
![](https://secure.gravatar.com/avatar/386a116d129cdc597f2bb6210bbaff7a.jpg?s=120&d=mm&r=g)
On Mon, Aug 23, 2010 at 8:22 PM, Taco Hoekwater
On 08/23/2010 06:37 PM, Mojca Miklavec wrote:
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). Just to add that I have compiled showttf for linux (gcc, 32 bit) windows seven (mingw, 32bit)
-- luigi
![](https://secure.gravatar.com/avatar/96a2b835dde0041c68f1803473d0b013.jpg?s=120&d=mm&r=g)
* Taco Hoekwater
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.
This brings up a possible point: Some introductory matter on "What lua is and is not good for/needed for". -- Thanks David
![](https://secure.gravatar.com/avatar/c5ae4f9aa0d3a9bd5376e92b322c3e50.jpg?s=120&d=mm&r=g)
On Sat, 21 Aug 2010, Taco Hoekwater wrote:
Hi all,
Today I started preparations for my activities at the ConTeXt meeting.
There are two small lua tutorials in the program, and I am looking for input on both. There is one that is supposed to be a general beginner's introduction, and one specifically about fonts.
For both, I am looking for input on what subjects I should cover?
Since both tutorials will end up as articles/wiki pages, it makes sense to ask everybody on the list for input (but requests by actual attendees will be scored considerably higher).
Some things that took a lot of trial and error for me to learn: * Write a macro that passes its argument as a string to a lua function * Write a macro that passes its argument as a function to a lua function * Write a macro that passes a lua function to another lua function. * Write a macro that passes an anonymous function to another lua function. For example, I should be able to do: \ToString{ABC with all " sorts ' of [[ weird [=[ characters [==[ [===[ [====[} \ToTable{ ['A'] = B, ['B'] = A } \ToFunction{ table.merge } \ToFunction{ function (a, b) do return (a+b) end } Slightly more advanced is how write a \setup command that can take these as an argument and pass it to a luafunction. For example \setupwhatever [ string={ABC with all " sorts ' of [[ weird [=[ charactes [===[ [====[", table={ ['A'] = B, ['B'] = A }, function = {table.merge}, anon={funcion (a,b) do return (a+b) end}, ] On hindsight, these are simple. But there is no documentaion on how lua sees the TeX arguments, and you need to understand how \directlua expands its arguments...something that can be very frustrating in the beginning. Aditya
![](https://secure.gravatar.com/avatar/da275274bab3cdbc839a9d0e8f2c2299.jpg?s=120&d=mm&r=g)
Hi all,
Today I started preparations for my activities at the ConTeXt meeting.
There are two small lua tutorials in the program, and I am looking for input on both. There is one that is supposed to be a general beginner's introduction, and one specifically about fonts.
For both, I am looking for input on what subjects I should cover?
Since both tutorials will end up as articles/wiki pages, it makes sense to ask everybody on the list for input (but requests by actual attendees will be scored considerably higher).
Perhaps some example to modify a font at runtime? I don't know whether that's possible at all, but if yes, it would be great to see how one could modify kerning tables etc. Often a font needs to be groomed but its license places some restrictions on modifying the file itself... Oliver P.S. Will have to wait for the article...
![](https://secure.gravatar.com/avatar/e79f226aa442b589932230491affa641.jpg?s=120&d=mm&r=g)
Am 24.08.2010 um 20:37 schrieb Oliver Buerschaper:
Hi all,
Today I started preparations for my activities at the ConTeXt meeting.
There are two small lua tutorials in the program, and I am looking for input on both. There is one that is supposed to be a general beginner's introduction, and one specifically about fonts.
For both, I am looking for input on what subjects I should cover?
Since both tutorials will end up as articles/wiki pages, it makes sense to ask everybody on the list for input (but requests by actual attendees will be scored considerably higher).
Perhaps some example to modify a font at runtime? I don't know whether that's possible at all, but if yes, it would be great to see how one could modify kerning tables etc. Often a font needs to be groomed but its license places some restrictions on modifying the file itself...
+1 st.
![](https://secure.gravatar.com/avatar/49e63acb01f2ca80efce7eed08310ce8.jpg?s=120&d=mm&r=g)
On 25-8-2010 10:05, Steffen Wolfrum wrote:
Am 24.08.2010 um 20:37 schrieb Oliver Buerschaper:
Hi all,
Today I started preparations for my activities at the ConTeXt meeting.
There are two small lua tutorials in the program, and I am looking for input on both. There is one that is supposed to be a general beginner's introduction, and one specifically about fonts.
For both, I am looking for input on what subjects I should cover?
Since both tutorials will end up as articles/wiki pages, it makes sense to ask everybody on the list for input (but requests by actual attendees will be scored considerably higher).
Perhaps some example to modify a font at runtime? I don't know whether that's possible at all, but if yes, it would be great to see how one could modify kerning tables etc. Often a font needs to be groomed but its license places some restrictions on modifying the file itself...
+1
This is somewhat tricky. Actually I had a mechanism for that but I discarded the code. However there will be a feature like that some day as it needs a rather tight integration in the core of context's font handling. (btw, there is a feature for type 1 fonts that adds 'missing' kerns based on shape codes). Hans ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com | www.pragma-pod.nl -----------------------------------------------------------------
![](https://secure.gravatar.com/avatar/8870709061256c1b455dca8f169e855e.jpg?s=120&d=mm&r=g)
How about including Lua library loading in the tutorial? The
discussion of converting from pre-formats like Markdown seems like a
good starting point for demonstrating how to load Lua libraries and
integrate procedural programming into a ConTeXt workflow.
Hopefully I will be there, still rounding up the cash but it looks
like I might make it.
On Wed, Aug 25, 2010 at 11:17 AM, Hans Hagen
On 25-8-2010 10:05, Steffen Wolfrum wrote:
Am 24.08.2010 um 20:37 schrieb Oliver Buerschaper:
Hi all,
Today I started preparations for my activities at the ConTeXt meeting.
There are two small lua tutorials in the program, and I am looking for input on both. There is one that is supposed to be a general beginner's introduction, and one specifically about fonts.
For both, I am looking for input on what subjects I should cover?
Since both tutorials will end up as articles/wiki pages, it makes sense to ask everybody on the list for input (but requests by actual attendees will be scored considerably higher).
Perhaps some example to modify a font at runtime? I don't know whether that's possible at all, but if yes, it would be great to see how one could modify kerning tables etc. Often a font needs to be groomed but its license places some restrictions on modifying the file itself...
+1
This is somewhat tricky. Actually I had a mechanism for that but I discarded the code. However there will be a feature like that some day as it needs a rather tight integration in the core of context's font handling. (btw, there is a feature for type 1 fonts that adds 'missing' kerns based on shape codes).
Hans
----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com | 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://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___________________________________________________________________________________
![](https://secure.gravatar.com/avatar/7325514c8a7b377b86d86ad29d35e8ef.jpg?s=120&d=mm&r=g)
On Wed, Aug 25, 2010 at 11:17:13AM +0200, Hans Hagen wrote:
On 25-8-2010 10:05, Steffen Wolfrum wrote:
Am 24.08.2010 um 20:37 schrieb Oliver Buerschaper:
Hi all,
Today I started preparations for my activities at the ConTeXt meeting.
There are two small lua tutorials in the program, and I am looking for input on both. There is one that is supposed to be a general beginner's introduction, and one specifically about fonts.
For both, I am looking for input on what subjects I should cover?
Since both tutorials will end up as articles/wiki pages, it makes sense to ask everybody on the list for input (but requests by actual attendees will be scored considerably higher).
Perhaps some example to modify a font at runtime? I don't know whether that's possible at all, but if yes, it would be great to see how one could modify kerning tables etc. Often a font needs to be groomed but its license places some restrictions on modifying the file itself...
+1
This is somewhat tricky. Actually I had a mechanism for that but I discarded the code. However there will be a feature like that some day as it needs a rather tight integration in the core of context's font handling. (btw, there is a feature for type 1 fonts that adds 'missing' kerns based on shape codes).
And there is font feature files, which, when not broken :), look the same to the OpenType handling code as if the feature were in the original font i.e. no special handling needed. Regards, Khaled -- Khaled Hosny Arabic localiser and member of Arabeyes.org team Free font developer
![](https://secure.gravatar.com/avatar/e79f226aa442b589932230491affa641.jpg?s=120&d=mm&r=g)
Am 25.08.2010 um 12:46 schrieb Khaled Hosny:
On Wed, Aug 25, 2010 at 11:17:13AM +0200, Hans Hagen wrote:
On 25-8-2010 10:05, Steffen Wolfrum wrote:
Am 24.08.2010 um 20:37 schrieb Oliver Buerschaper:
Hi all,
Today I started preparations for my activities at the ConTeXt meeting.
There are two small lua tutorials in the program, and I am looking for input on both. There is one that is supposed to be a general beginner's introduction, and one specifically about fonts.
For both, I am looking for input on what subjects I should cover?
Since both tutorials will end up as articles/wiki pages, it makes sense to ask everybody on the list for input (but requests by actual attendees will be scored considerably higher).
Perhaps some example to modify a font at runtime? I don't know whether that's possible at all, but if yes, it would be great to see how one could modify kerning tables etc. Often a font needs to be groomed but its license places some restrictions on modifying the file itself...
+1
This is somewhat tricky. Actually I had a mechanism for that but I discarded the code. However there will be a feature like that some day as it needs a rather tight integration in the core of context's font handling. (btw, there is a feature for type 1 fonts that adds 'missing' kerns based on shape codes).
And there is font feature files, which, when not broken :), look the same to the OpenType handling code as if the feature were in the original font i.e. no special handling needed.
participants (11)
-
Aditya Mahajan
-
David Rogers
-
Hans Hagen
-
Henning Hraban Ramm
-
John Haltiwanger
-
Khaled Hosny
-
luigi scarso
-
Mojca Miklavec
-
Oliver Buerschaper
-
Steffen Wolfrum
-
Taco Hoekwater