ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Wolfgang Schuster <schuster.wolfgang@googlemail.com>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>
Subject: Re: bold small caps
Date: Sun, 12 Dec 2010 17:07:03 +0100	[thread overview]
Message-ID: <CF27C5EA-D386-4403-9CB3-E48602947286@gmail.com> (raw)
In-Reply-To: <20101212162244.55a2f946@glyph>


Am 12.12.2010 um 16:22 schrieb Marco:

> On 2010-12-12 Wolfgang Schuster <schuster.wolfgang@googlemail.com> wrote:
> 
>>> Depending on your answers, I would perhaps request to trigger
>>> \setff{smallcaps} by \sc in the core.
>> 
>> Can be a problem because we have font (e.g. Latin Modern) where
>> smallcaps are still in a separate file.
> So the user has to know in which fashion the small caps were created, as font
> feature or in a seperate file. That's not very convenient. When the user
> switches to another font it may break the document, since he has to change the
> \setff{smallcaps} to \sc.
> 
> 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}{...}? I have the following logic in mind:
> 
> 1) Check if small caps are a font feature, if not
> 2) check if small caps are in a seperate font, if not
> 3) fake them.

\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

Wolfgang

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


  reply	other threads:[~2010-12-12 16:07 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 [this message]
2010-12-12 19:39           ` Peter Münster
2010-12-15 11:43             ` Hans Hagen
2010-12-13 10:38           ` Marco
  -- 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=CF27C5EA-D386-4403-9CB3-E48602947286@gmail.com \
    --to=schuster.wolfgang@googlemail.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).