Mojca Miklavec wrote:
On Mon, Oct 6, 2008 at 1:57 AM, Idris Samawi Hamid ادريس سماوي حامد wrote:
Dear gang,
Sometimes I use the following for simple substitutions:
\defineactivecharacter ' {\otfchar{quoteright}}
But is there a more general mechanism to do things
\definesubstitution{<string1>}{<string2>}
eg
\definesubstitution{--}{–}
Of course ConTeXt already provides this particular substitution
In mkii it doesn't. Fonts do that substitution. In mkiv a hack is applied to fonts (not to TeX macros), so that this particular substitution works.
but I'm interested in such a mechanism for more general purposes.
In mkii this is not possible, except with some ugly hacks. You can easily substitute a single character by making it active. To substitute whole words, you either need to modify fonts, or write some dirty macros.
In mkiv you can either apply some "patches" to fonts (search for tlig in ConTeXt source, for example font-otf.lua, also, there are some fea files in fonts/fea/context capable of doing that), or change input text while reading/digesting some TeX file.
Hans and Taco can probably tell you more.
it all depends on what we want to achieve ... - we can have font fixers (dynamically extend fonts with features, but this demands knowledge of the font) - we can have replacements in the node list (attribute driven, relatively easy to implement) so before i start looking into this, we need to investigate what is needed (and what for) (only mkiv) Hans ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com | www.pragma-pod.nl -----------------------------------------------------------------