From: Henri Menke <henrimenke@gmail.com>
To: ntg-context@ntg.nl
Subject: Re: using lua fonts
Date: Wed, 9 May 2018 13:02:22 +1200 [thread overview]
Message-ID: <47ab9ba1-2f4f-e1e5-3702-850fd1836105@gmail.com> (raw)
In-Reply-To: <txoi67dilpl7.dlg@nililand.de>
Dear list,
this is a follow-up on Ulrike's post, so I'm just hijacking the thread.
How can I use the Lua fonts in Plain? It works fine if I just remove
ConTeXt-specific actualtext bits but as soon as I add features to the
font, the name resolution fails with something like
! Font
\mainfont=file:fonts-demo-rule.lua:original=file:texgyrepagella-regular.
otf not loadable: metric data not found or bad.
MWE is below as always.
Cheers, Henri
----------- test.tex -----------
\input luaotfload.sty
\font\mainfont="file:fonts-demo-rule.lua":original=file:texgyrepagella-regular.otf
\mainfont
This code is stored in fonts-demo-rule.lua and we can load that font in
the usual way,
by specifying a filename.
\bye
----------- fonts-demo-rule.lua -----------
return function(specification)
local features = specification.features.normal
local name = features.original or "dejavu-serif"
local option = features.option -- we only support "line"
local size = specification.size -- always set
local detail = specification.detail -- e.g. default
if detail then
name = name .. "*" .. detail
end
local f, id = fonts.constructors.readanddefine(name,size)
if f then
f.properties.name = specification.name
f.properties.virtualized = true
f.fonts = {
{ id = id },
}
for s in string.gmatch("aeuioy",".") do
local n = utf.byte(s)
local c = f.characters[n]
if c then
local w = c.width or 0
local h = c.height or 0
local d = c.depth or 0
if option == "line" then
f.characters[n].commands = {
{ "rule", option == "line" and size/10, w },
}
else
f.characters[n].commands = {
{ "down", d },
{ "rule", h + d, w },
}
end
else
-- probably a real bad font
end
end
end
return f
end
On 04/05/18 06:26, Ulrike Fischer wrote:
> I'm trying to run one of the examples of fonts-mkiv.pdf
>
> I copied the code from 4.5 Lua fonts to a file
> "fonts-demo-rule.lua". This lua file is in the same directory as my
> test file.
>
> Then I tried
>
> \definefont
> [MyRuleFont]
> [file:fonts-demo-rule.lua*default sa 1]
>
> \starttext
>
> {\MyRuleFont So when we use it we get text }
>
> \stoptext
>
> but I get in the log
>
> fonts > defining > forced type 'lua' of 'fonts-demo-rule' not found
> fonts > defining > font with asked name 'fonts-demo-rule' is not
> found using lookup 'file'
> fonts > defining > unknown font 'fonts-demo-rule', loading aborted
> fonts > defining > unable to define 'fonts-demo-rule.lua' as
> 'MyRuleFont--0'
>
> The file itself is found (I can see its path later on). What is
> going on here?
>
___________________________________________________________________________________
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://context.aanhet.net
archive : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___________________________________________________________________________________
next prev parent reply other threads:[~2018-05-09 1:02 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-05-03 18:26 Ulrike Fischer
2018-05-08 8:43 ` Hans Hagen
2018-05-08 14:01 ` Ulrike Fischer
2018-05-08 14:17 ` Hans Hagen
2018-05-08 14:46 ` Ulrike Fischer
2018-05-09 1:02 ` Henri Menke [this message]
2018-05-09 7:56 ` Hans Hagen
2018-05-09 10:40 ` Ulrike Fischer
2018-05-09 11:05 ` Hans Hagen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=47ab9ba1-2f4f-e1e5-3702-850fd1836105@gmail.com \
--to=henrimenke@gmail.com \
--cc=ntg-context@ntg.nl \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).