-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use ConTeXt Lua code directly #71
base: master
Are you sure you want to change the base?
Conversation
Either we provide the ConTeXt code with allocator for attributes (current solution) or reserve the first 256 attributes for it. I also found the defintion of XeTeX
|
I was wrong even in the ConTeXt case, |
Hm, maybe we could even With hot caches, the following (simulating
Is:
( Compared to the situation without any
With some complexity, the opentype fonts could even be preloaded too, but I don't know about that. Now they are just read from cache. Also automatically doing |
We've talked about it before. It would be fine to leave the dependency on luaotfload, but:
|
We would need to emulate a few features if we need them. Extracting the font loader code is almost a matter of copying two files. Actually testing that the extracted stuff is working correctly is the hard part. The I actually think that for both testing the font loader and other OpTeX macros for regressions and other things, a test suite could be considered and users should be encouraged to contribute. Maybe a topic for "Github Discussions"?
XeTeX syntax will work without problems.
Agreed, but the files will have to be available somehow. |
I actually have a few ideas for the unimplemented areas of #67. Will see how that goes, but IIRC |
This is more direct, but unsupported.
This is most important issue. Suppose that we have such package, say its name is
This job is done by If the maintainer will stop supporting the |
I am willing to do it. But as you say there are issues:
There are two possibilities:
If the code is taken more or less verbatim, ConTeXt is the documentation for better or for worse.
Quite a lot is actually already part of ConTeXt. Others should be implemented in OpTeX. The hypothetical external package should not modify / add to the ConTeXt code in any significant way.
Maybe this can be a joint effort of OpTeX and minim. |
Currently OpTeX uses the
luaotfload
package for extending LuaTeX font mechanism through Lua code.luaotfload
is a wrapper that allows use of ConTeXt code in LaTeX and plain, but as ConTeXt'sluatex-plain
format proves, the ConTeXt codes is actually usable directly. In fact, the bulk of the font code is available in just a single file -luatex-fonts-merged.lua
.This PR tries to experiment with using this file (and one or two other) for potential use in OpTeX.
luaotfload
is not just a simple wrapper though. For OpTeX's use case not using it would have the following consequences:harf
mode wouldn't be available (but it was never used anyways, just suggested in documentation)luaotfload
's sophisticated mechanism for maintaining font name database couldn't be used (this includes transparent handling of system fonts)luaotfload
font features wouldn't be available (colored fonts, upper/lower casing, fallback fonts, letterspace, embolden, probably more)But I don't see that as too much problematic:
harf
mode as of now wouldn't really be a lossluaotfload
are duplicates of ConTeXt's, and some are really simple, so this can be fixedAs a benefit we gain:
I am still experimenting with this, but I think it is the right way forward.
There may or may not be speed gain / loss - I think that luaotfload's database can prevent some expensive path searching, but there will be gain upfront in loading the Lua code.
I will have to check the syntax differences between luaotfload and ConTeXt's generic mode in regards to
\font
. But my current understanding is that generally XeTeX way of\font\a=[something]
is first a lookup of font name and not file name. In the generic ConTeXt plain\font\a=something
is a lookup that first tries file name and then font name (which currently doesn't work, because I don't generate any font name database).Anyways, while there may be incompatibilities with the old way that I will have to find out, the ConTeXt way seems very nice, and maybe will allow not differentiating between "tfm" and "unicode" version of some OpTeX macros. Maybe with the code preloaded in the format,
\initunifonts
can even be default. And maybe we will get rid of preloaded fonts :-)There remains the problem of distributing the two or three files.
What do you think of the idea @olsak?