%D \module
%D   [       file=luatex-fonts,
%D        version=2009.12.01,
%D          title=\LUATEX\ Support Macros,
%D       subtitle=Generic \OPENTYPE\ Font Handler,
%D         author=Hans Hagen,
%D      copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]

%D \subject{Welcome}
%D
%D This file is one of a set of basic functionality enhancements
%D for \LUATEX\ derived from the \CONTEXT\ \MKIV\ code base. Please
%D don't polute the \type {luatex-*} namespace with code not coming
%D from the \CONTEXT\ development team as we may add more files.
%D
%D As this is an experimental setup, it might not always work out as
%D expected. Around \LUATEX\ version 0.50 we expect the code to be
%D more or less okay.
%D
%D This file implements a basic font system for a bare \LUATEX\
%D system. By default \LUATEX\ only knows about the classic \TFM\
%D fonts but it can read other font formats and pass them to \LUA.
%D With some glue code one can then construct a suitable \TFM\
%D representation that \LUATEX\ can work with. For more advanced font
%D support a bit more code is needed that needs to be hooked
%D into the callback mechanism.
%D
%D This file is currently rather simple: it just loads the \LUA\ file
%D with the same name. An example of a \type {luatex.tex} file that is
%D just plain \TEX:
%D
%D \starttyping
%D \catcode`\{=1 % left brace is begin-group character
%D \catcode`\}=2 % right brace is end-group character
%D
%D \input plain
%D
%D \everyjob\expandafter{\the\everyjob\input luatex-fonts\relax}
%D
%D \dump
%D \stoptyping
%D
%D We could load the \LUA\ file in \type {\everyjob} but maybe some
%D day we need more here.
%D
%D When defining a font you can use two prefixes. A \type {file:}
%D prefix forced a file search, while a \type {name:} prefix will
%D result in consulting the names database. Such a database can be
%D generated with:
%D
%D \starttyping
%D mtxrun --usekpse --script fonts --names
%D \stoptyping
%D
%D This will generate a file \type {luatex-fonts-names.lua} that has
%D to be placed in a location where it can be found by \KPSE. Beware:
%D the \type {--kpseonly} flag is only used outside \CONTEXT\ and
%D provides very limited functionality, just enough for this task.
%D
%D The code loaded here does not come out of thin air, but is mostly
%D shared with \CONTEXT, however, in that macropackage we go beyond
%D what is provided here. When you use the code packaged here you
%D need to keep a few things in mind:
%D
%D \startitemize
%D
%D \item This subsystem will be extended, improved etc. in about the
%D same pace as \CONTEXT\ \MKIV. However, because \CONTEXT\ provides a
%D rather high level of integration not all features will be supported
%D in the same quality. Use \CONTEXT\ if you want more goodies.
%D
%D \item There is no official \API\ yet, which means that using
%D functions implemented here is at your own risk, in the sense that
%D names and namespaces might change. There will be a minimal \API\
%D defined once \LUATEX\ version 1.0 is out. Instead of patching the
%D files it's better to overload functions if needed.
%D
%D \item The modules are not stripped too much, which makes it
%D possible to benefit from improvements in the code that take place
%D in the perspective of \CONTEXT\ development. They might be split a
%D bit more in due time so the baseline might become smaller.
%D
%D \item The code is maintained and tested by the \CONTEXT\
%D development team. As such it might be better suited for this macro
%D package and integration in other systems might demand some
%D additional wrapping. Problems can be reported to the team but as we
%D use \CONTEXT\ \MKIV\ as baseline, you'd better check if the problem
%D is a general \CONTEXT\ problem too.
%D
%D \item The more high level support for features that is provided in
%D \CONTEXT\ is not part of the code loaded here as it makes no sense
%D elsewhere. Some experimental features are not part of this code
%D either but some might show up later.
%D
%D \item Math font support will be added but only in its basic form
%D once that the Latin Modern and \TEX\ Gyre math fonts are
%D available.
%D
%D \item At this moment the more nifty speed-ups are not enabled
%D because they work in tandem with the alternative file handling
%D that \CONTEXT\ uses. Maybe around \LUATEX\ 1.0 we will bring some
%D speedup into this code too (if it pays off at all).
%D
%D \item The code defines a few global tables. If this code is used
%D in a larger perspective then you can best make sure that no
%D conflicts occur. The \CONTEXT\ package expects users to work in
%D their own namespace (\type {userdata}, \type {thirddata}, \type
%D {moduledata} or \type {document}. The team takes all freedom to
%D use any table at the global level but will not use tables that are
%D named after macro packages. Later the \CONTEXT\ might operate in
%D a more controlled namespace but it has a low priority.
%D
%D \item There is some tracing code present but this is not enabled
%D and not supported outside \CONTEXT\ either as it integrates quite
%D tightly into \CONTEXT. In case of problems you can use \CONTEXT\
%D for tracking down problems.
%D
%D \item Patching the code in distributions is dangerous as it might
%D fix your problem but introduce new ones for \CONTEXT. So, best keep
%D the original code as it is.
%D
%D \item Attributes are (automatically) taken from the range 127-255 so
%D you'd best not use these yourself.
%D
%D \stopitemize
%D
%D If this all sounds a bit tricky, keep in mind that it makes no sense
%D for us to maintain multiple code bases and we happen to use \CONTEXT.
%D
%D For more details about how the font subsystem works we refer to
%D publications in \TEX\ related journals, the \CONTEXT\ documentation,
%D and the \CONTEXT\ wiki.

\directlua {
    if not fonts then
        dofile(kpse.find_file("luatex-fonts.lua","tex"))
    end
}

\endinput
