ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Henri Menke <henrimenke@gmail.com>
To: "ntg-context@ntg.nl >> mailing list for ConTeXt users"
	<ntg-context@ntg.nl>
Subject: How to query fonts.handlers
Date: Wed, 6 Feb 2019 09:27:21 +1300	[thread overview]
Message-ID: <bb2a1c26-2b84-ae6a-cbe0-21daabe46ff6@gmail.com> (raw)
In-Reply-To: <7db81e7b-4524-67ed-60c9-7cd68f72ac33@gmail.com>

Dear list,

I am trying to access extra kerning that I have defined using
fonts.handlers.otf.addfeature.  Even though I query the kerning from
within a paragraph where the kerning is evidently applied I can't seem
to get the value stored earlier, see the comment in the MWE.  What am I
doing wrong?

Cheers, Henri

---

\startluacode
fonts.handlers.otf.addfeature {
    name = "ktest",
    type = "kern",
    data = {
        ["t"] = { ["e"] = 500 },
    }
}
\stopluacode

\definefontfeature[ktest][ktest=yes]

\definefont[1][Serif*ktest]

\starttext

\1 test \ctxlua{
     local fnt = font.current()
     local tfmdata = fonts.hashes.identifiers[fnt]
     local t = string.byte("t")
     local e = string.byte("e")
     local kern = fonts.handlers.otf.getkern(tfmdata,t,e)
     context(kern) % 0 instead of 500. Why?
}

\stoptext

---

P.S.: I have posted the same question on the LuaTeX list, but with a
different MWE.

-------- Forwarded Message --------
Subject: How to query fonts.handlers
Date: Mon, 4 Feb 2019 15:00:12 +1300
From: Henri Menke <henrimenke@gmail.com>
To: LuaTeX discussion. <luatex@tug.org>

Dear list,

I am trying to access extra kerning that I have defined using
fonts.handlers.otf.addfeature.  Even though I query the kerning from
within a paragraph where the kerning is evidently applied I can't seem
to get the value stored earlier, see the comment in the MWE.  What am I
doing wrong?

Cheers, Henri

---

\input luaotfload.sty

\directlua{
     fonts.handlers.otf.addfeature {
         name = "ktest",
         type = "kern",
         data = {
             ["t"] = { ["e"] = 500 },
         }
     }
}

\font\1="lmroman10-regular.otf:+ktest" at 10pt
\1

test%
\directlua{
     local fnt = font.current()
     local tfmdata = fonts.hashes.identifiers[fnt]
     local t = string.byte("t")
     local e = string.byte("e")
     local kern = fonts.handlers.otf.getkern(tfmdata,t,e)
     tex.sprint(kern) % 0 instead of 500. Why?
}

\bye


___________________________________________________________________________________
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
___________________________________________________________________________________

       reply	other threads:[~2019-02-05 20:27 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <7db81e7b-4524-67ed-60c9-7cd68f72ac33@gmail.com>
2019-02-05 20:27 ` Henri Menke [this message]
2019-02-06  0:10   ` Henri Menke

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=bb2a1c26-2b84-ae6a-cbe0-21daabe46ff6@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).