From: Leah Neukirchen via ntg-context <ntg-context@ntg.nl>
To: ntg-context@ntg.nl
Cc: Leah Neukirchen <leah@vuxu.org>
Subject: LMTX: reimplementing texquotes as OTF feature
Date: Fri, 11 Nov 2022 22:19:52 +0100 [thread overview]
Message-ID: <871qq9kx3b.fsf@vuxu.org> (raw)
Hi,
as Hans recommended in the last video meeting, I tried to implement
the texquotes feature using OTF features, and hit two problems:
1) To support German quotes as well, I have two ligatures that end
up as the same glyph:
`` -> “
"' -> “
This can't be in the same ligature feature, as it will overwrite
the table entry with a duplicate key.
After some fiddling, I decided to map "' to a Unicode PUA symbol
and then add a second feature that maps this symbol to “ using
the substitute feature. This works for TeX Gyre Schola.
But perhaps someone knows a nicer way.
2) This approach doesn't work for lmodern or palatino, I still
get "' as inch-sign/quote there... anything else I need to tweak
for these fonts?
\startluacode
fonts.handlers.otf.addfeature {
name = "texlig",
type = "ligature",
data = {
['“'] = { "`", "`" },
['”'] = { "'", "'" },
['„'] = { '"', "`" },
[''] = { '"', "'" },
['‘'] = { "`" },
['’'] = { "'" }
}
}
fonts.handlers.otf.addfeature {
name = "texsub",
type = "substitute",
data = {
[''] = '“',
}
}
\stopluacode
% with lmodern or palatino it breaks
\setupbodyfont[schola]
\definefontfeature[ltest][texlig=yes,texsub=yes,trep=no]
\addff{ltest}
\starttext
``foo'' `foo' "`foo"' 19" rack
\stoptext
Thanks,
--
Leah Neukirchen <leah@vuxu.org> https://leahneukirchen.org/
___________________________________________________________________________________
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
___________________________________________________________________________________
next reply other threads:[~2022-11-11 21:19 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-11 21:19 Leah Neukirchen via ntg-context [this message]
2022-11-11 22:51 ` Hans Hagen via ntg-context
2022-11-12 14:57 ` Leah Neukirchen via ntg-context
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=871qq9kx3b.fsf@vuxu.org \
--to=ntg-context@ntg.nl \
--cc=leah@vuxu.org \
/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).