[luatex] Modifying protrusion default.

Philipp Gesang Philipp.Gesang at alumni.uni-heidelberg.de
Wed Sep 4 19:31:18 CEST 2013


···<date: 2013-09-03, Tuesday>···<from: john Culleton>···

> On Tue, 3 Sep 2013 10:57:59 +0200
> Philipp Gesang <Philipp.Gesang at alumni.uni-heidelberg.de> wrote:
> 
> > ···<date: 2013-08-29, Thursday>···<from: john Culleton>···
> > 
> > > On Mon, 26 Aug 2013 00:31:07 +0200
> > > Philipp Gesang <Philipp.Gesang at alumni.uni-heidelberg.de> wrote:
> > > 
> > > > ···<date: 2013-08-24, Saturday>···<from: john Culleton>···
> > > > 
> > > > >                    These factors are too large for use in e.g.,
> > > > > a novel. I can of course modify this file for my own use. But
> > > > > if I want to send the modified file to a client to use is it
> > > > > sufficient to just include a modified otfl-font-dum.lua file in
> > > > > the batch of macros I send to the customer? Or can I put the
> > > > > modified table in a my luatex template source document and
> > > > > expect it to override the original table?
> > > > >
> > > > > Or is there another way to use a modified protrusion table that
> > > > > is easily transportable to customers who aren't into replacing
> > > > > files in the innards of TeX?
> > > >  
> > > > I’ve added some example code to the test repo:
> > > > 
> > > >   https://bitbucket.org/phg/lua-la-tex-tests/src/tip/pln-expansion-protrusion-1.lua
> > > >   https://bitbucket.org/phg/lua-la-tex-tests/src/tip/pln-expansion-protrusion-1.tex
> > > > 
> > > > This should work with both luaotfload and luatex-fonts.
> > > > 
> > > > Basically, your options include a) manipulating the scale factors
> > > > of the default vector or b) making up your own vector. New
> > > > vectors, if added to the table fonts.protrusions.setups, can be
> > > > referred to by their name when defining a font just like the
> > > > default. E. g. create a vector
> > > > 
> > > >     fonts.protrusions.setups.myvector = {
> > > >       factor = 1,
> > > >       left   = 1,
> > > >       right  = 1,
> > > > 
> > > >       --- map code points to protrusion values
> > > >       --- [1] is  left, [2] is right
> > > >       [string.byte ","] = { 0, 0.4 },
> > > >       [string.byte "."] = { 0, 0.4 },
> > > >       ....
> > > >     }
> > > > 
> > > > and then in your document define a font like so:
> > > > 
> > > >   \pdfprotrudechars2
> > > >   \font \mainfont = "file:Iwona-Regular.otf:protrusion=myvector"
> > > > 
> > > > It’s not hard, except for coming up with sane values ;-)
> > 
> > > The hard part is adding either approach to the zip file I will send
> > > my customers.  Remember, my audience is not into modifying code in
> > > their TeX installation, whether it is TeXLive or Context minimal. Is
> > > there a way to add a macro to that zip file that will override the 
> > > code already embedded in the TeX installation? 
> > 
> > Not sure about a macro, but you can use the functions in the
> > example I linked to overwrite the “default” values. Otoh, if you
> > ship your own texlive tree and don’t require the flexibility of
> > multiple vectors, then you can probably live with modifying the
> > defaults directly. In a recent luaotfload they reside in here:
> > 
> >     https://github.com/lualatex/luaotfload/blob/master/luaotfload-merged.lua#L13160
> > 
> > If you have a modified version of this file in the texmf-local/
> > tree, it should override the distribution default.
> > 
> > > And is there a plan to add the protrusion features already found in
> > > pdftex and Context MKIV to plain Luatex?
> > 
> > They are already there, in a sense. If you have a suggestion as
> > to how luaotfload should be expanded, it might be worthwhile to
> > file a feature request on the tracker [1]. Regarding the
> > fontloader (luatex-fonts) itself, it is up to Hans.
> > 
> > Good luck with your project,
> > Philipp
> > 
> > 
> > [1] https://github.com/lualatex/luaotfload/issues
> > 
> 
> 
> OK lets go back to your earlier solution:
>  https://bitbucket.org/phg/lua-la-tex-tests/src/tip/pln-expansion-protrusion-1.tex
> Is this a complete solution or must I run the other program first?

This is the usage example. It relies on the code in the
corresponding Lua file where the new vectors are set up.

> When I tried to run this file under luatex it blew up on the \jobname.
> So  I defined \jobname to be the name of the file and it blew up again,
> treating \jobname as a module. Clearly I am misunderstanding
> something. Please educate me a bit further. What is \jobname?

  “The expansion is the name that TeX has chosen for this job.
   For exaple, if TeX is putting its output on files paper.dvi
   and paper.log, then \jobname expands to ‘paper’.”
   (TeXbook, p 213)

I.e. the file assumes, as Wolfgang already wrote, that the Lua
file differs from the main file only by its extension. Those
lines at the top are equivalent to a

  \directlua {require "<name of Lua file>"}

Of course, if you renamed the file then you can substitute
whatever name you chose (without the extension).

> I am running plain luatex, not Context or lualatex. 

The example runs in both flavors of Plain Luatex.

Best,
Philipp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 490 bytes
Desc: not available
URL: <http://tug.org/pipermail/luatex/attachments/20130904/550f760b/attachment.bin>


More information about the luatex mailing list