ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Marco <netuse@lavabit.com>
To: ntg-context@ntg.nl
Subject: Re: bold small caps
Date: Mon, 13 Dec 2010 11:38:08 +0100	[thread overview]
Message-ID: <20101213113808.0142c72f@glyph> (raw)
In-Reply-To: <CF27C5EA-D386-4403-9CB3-E48602947286@gmail.com>

On 2010-12-12 Wolfgang Schuster <schuster.wolfgang@googlemail.com> wrote:

> > Maybe it is possible that the \sc macro can check if the font contains the
> > small caps as a feature. Is there a switch like
> > \doiffontfeatureexists{smcp}{...}?
> 
> \startluacode
>     function commands.doifelsecurrentfonthasfeature(name)
>         local f = fonts.identifiers[font.current()]
>         f = f and f.shared
>         f = f and f.otfdata
>         f = f and f.luatex
>         f = f and f.features
>         commands.doifelse(f and (f.gpos[name] or f.gsub[name]))
>     end
> \stopluacode
> 
> \def\doifelsecurrentfonthasfeature#1%
>   {\ctxlua{commands.doifelsecurrentfonthasfeature("#1")}}
> 
> \let\normalsc\sc
> \definefontfeature[smcp][smcp=yes]
> \definefontfeature[latn][script=latn]
> 
> \unexpanded\def\sc{\doifelsecurrentfonthasfeature{smcp}{\addfs{smcp}}\normalsc}
> 
> \starttext
> 
> \tf text \sc text
> 
> \switchtobodyfont[cambria]\addfs{latn} % cambria needs the latin script for
> smallcaps
> 
> \tf text \addfs{smcp} text
> 
> \switchtobodyfont[modern]
> 
> \tf text \sc text
> 
> \stoptext
That's a nice piece of code! Thanks for your effort.

Marco


___________________________________________________________________________________
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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


  parent reply	other threads:[~2010-12-13 10:38 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-12-11 22:40 Peter Münster
2010-12-11 22:57 ` Florian Wobbe
2010-12-11 23:12   ` Peter Münster
2010-12-12  8:30     ` Wolfgang Schuster
2010-12-12 15:22       ` Marco
2010-12-12 16:07         ` Wolfgang Schuster
2010-12-12 19:39           ` Peter Münster
2010-12-15 11:43             ` Hans Hagen
2010-12-13 10:38           ` Marco [this message]
  -- strict thread matches above, loose matches on Subject: below --
2023-04-03  7:07 Peter Münster via ntg-context
2023-04-03  9:34 ` Hans Hagen via ntg-context
2023-04-03 21:33 ` Pablo Rodriguez via ntg-context
2014-05-23 15:55 Bold " Mojca Miklavec
2014-05-23 16:11 ` Wolfgang Schuster
2014-05-23 16:46   ` Mojca Miklavec
2014-05-23 16:52     ` Hans Hagen
2014-05-23 16:49 ` Hans Hagen
2013-06-25 12:59 Bold Small Caps Malte Stien
2013-06-25 13:08 ` Wolfgang Schuster
2013-06-25 13:34   ` Malte Stien
2013-06-25 17:39     ` Sietse Brouwer
2004-01-09 21:33 bold small caps Peter Münster

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=20101213113808.0142c72f@glyph \
    --to=netuse@lavabit.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).