ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: "Thomas A. Schmitz via ntg-context" <ntg-context@ntg.nl>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>
Cc: "Thomas A. Schmitz" <thomas.schmitz@uni-bonn.de>
Subject: Re: font features
Date: Thu, 3 Nov 2022 14:03:47 +0100	[thread overview]
Message-ID: <e39c312d-3eb4-71ca-f42c-72ba2134288c@uni-bonn.de> (raw)
In-Reply-To: <545c584e-64fb-461c-e3f9-48cb327ae162@fiee.net>

On 11/3/22 13:27, Henning Hraban Ramm via ntg-context wrote:
> If it works for you, then it’s a problem of my installation, otherwise a 
> regression in current LMTX...

No, I get the same error message, this looks promising but doesn't work.

And at the risk of sounding grumpy, but all of this is too much manual 
intervention; I would like to have a completely automated script. So 
I'll show what I have and add a few comments:

local Feature_Table = { }
local Parsed_Features = { }

local My_Font = environment.arguments["font"]

local Font_Features = os.resultof("otfinfo -f " .. My_Font)

for Feature_Sigla, Feature_Name in
   string.gmatch(Font_Features, "(%S-)\t(.-)\n") do
   Feature_Table[Feature_Sigla] = Feature_Name
end

COMMENTS

Expectation: this should return a list of all features and their 
descriptions as a lua table. If you run the file as

context test.cld --font="/path/to/font"

this works, and you get a table

Feature_Table={
  ["aalt"]="Access All Alternates",
  ["c2sc"]="Small Capitals From Capitals"} etc.

CODE

for name, _ in pairs(Feature_Table) do
   Context_Name = "f:" .. name
   Parsed_Features[name] = Context_Name
   context.definefontfeature( { Context_Name }, { name="yes" } )
end

COMMENTS

This should produce a lua table with ConTeXt fontfeatures and define 
those features. The table appears to be correct:

Parsed_Features={
  ["aalt"]="f:aalt",
  ["c2sc"]="f:c2sc"} etc.

So I expected that this should be equivalent to

\definefontfeature [f:aalt] [aalt=yes]

and return a list of defined features.

CODE

local Test_String = [[
ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz 1234567890 1/4 2/8 
3/9 ffi ft fi fl ffl
]]

local Font_Name =  os.resultof("otfinfo -a " .. My_Font)

context.definefontfamily( { "Test" }, { "serif" }, { Font_Name }, {} )

context.setupbodyfont{ "Test, 12pt" }

COMMENTS

Again, this works; the font is set as bodyfont.

CODE

context.starttext()

for name, feature in pairs(Feature_Table) do
   context.start ()
   context.addfeature { Parsed_Features[name] }
   context.midaligned (feature)
   context.bold (Parsed_Features[name])
   context.par ()
   context.blank{ "medium" }
   context(Test_String)
   context.par ()
   context.stop ()
end

context.stoptext()

COMMENTS

And this doesn't work: the names are picked up, but the font features 
are not defined; the sample text does not reflect any features. So this 
is what I've got... maybe one of the wizards can help.

Thomas
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : https://contextgarden.net
___________________________________________________________________________________

  reply	other threads:[~2022-11-03 13:03 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-03 11:37 Thomas A. Schmitz via ntg-context
2022-11-03 11:52 ` Herbert Voss via ntg-context
2022-11-03 12:19   ` Thomas A. Schmitz via ntg-context
2022-11-03 17:57   ` Hans Hagen via ntg-context
2022-11-03 12:20 ` Henning Hraban Ramm via ntg-context
2022-11-03 12:27   ` Henning Hraban Ramm via ntg-context
2022-11-03 13:03     ` Thomas A. Schmitz via ntg-context [this message]
2022-11-03 18:24       ` Hans Hagen via ntg-context
2022-11-03 19:38         ` Thomas A. Schmitz via ntg-context
  -- strict thread matches above, loose matches on Subject: below --
2010-11-17 19:15 Herbert Voss
2010-11-17 20:55 ` Hans Hagen
2009-05-15  2:06 Font features Vyatcheslav Yatskovsky
2009-05-15  6:21 ` Wolfgang Schuster
2009-05-15 12:23   ` Idris Samawi Hamid ادريس سماوي حامد
2009-05-15 12:41     ` Alex Lubberts
2009-05-15 14:22       ` 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=e39c312d-3eb4-71ca-f42c-72ba2134288c@uni-bonn.de \
    --to=ntg-context@ntg.nl \
    --cc=thomas.schmitz@uni-bonn.de \
    /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).