ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* font switches: bold, slanted, etc.
@ 2016-02-12 23:23 Alan BRASLAU
  2016-02-13  1:14 ` Pablo Rodriguez
                   ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: Alan BRASLAU @ 2016-02-12 23:23 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Hi,

Basic font switches are bold (\bf), italic (\it), slanted (\sl), ...
and one can have bolditalic (\bi), boldslated (\bs), etc.
We also have style=bold, style=slanted, etc.

Is there some way to manipulate font switches so that
\bold{This text is \slated{bold}}
for example, would put the word "bold" into boldslanted?

A natural use of this is, e.g. headers that get typeset in bold. What
if the title contains a word, say, in slanted (or, worse, some
mathematics)?

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

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: font switches: bold, slanted, etc.
  2016-02-12 23:23 font switches: bold, slanted, etc Alan BRASLAU
@ 2016-02-13  1:14 ` Pablo Rodriguez
  2016-02-13 10:02   ` Alan BRASLAU
  2016-02-13  9:53 ` Wolfgang Schuster
  2016-02-13 11:42 ` Hans Hagen
  2 siblings, 1 reply; 10+ messages in thread
From: Pablo Rodriguez @ 2016-02-13  1:14 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On 02/13/2016 12:23 AM, Alan BRASLAU wrote:
> [...]
> Is there some way to manipulate font switches so that
> \bold{This text is \slated{bold}}
> for example, would put the word "bold" into boldslanted?
> 
> A natural use of this is, e.g. headers that get typeset in bold. What
> if the title contains a word, say, in slanted (or, worse, some
> mathematics)?

Sorry, Alan, but I don’t see the point you’re trying to make.

I guess \em is your friend here:

    \starttext
    \startTEXpage[offset=1em]
    {\bf Heading {\em One}}

    {\bf Heading {\em One {\em Extended}}}

    {\bf Heading {\sl Two}}

    {\bf Heading {\sl One {\sl Extended}}}
    \stopTEXpage
    \stoptext

It has two main advantages over \sl: it accepts bold and double emphasis
means no emphasis.

Or what I am missing?

Just in case it helps,

Pablo
-- 
http://www.ousia.tk
___________________________________________________________________________________
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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: font switches: bold, slanted, etc.
  2016-02-12 23:23 font switches: bold, slanted, etc Alan BRASLAU
  2016-02-13  1:14 ` Pablo Rodriguez
@ 2016-02-13  9:53 ` Wolfgang Schuster
  2016-02-13 10:30   ` Alan BRASLAU
  2016-02-13 11:42 ` Hans Hagen
  2 siblings, 1 reply; 10+ messages in thread
From: Wolfgang Schuster @ 2016-02-13  9:53 UTC (permalink / raw)
  To: mailing list for ConTeXt users


[-- Attachment #1.1: Type: text/plain, Size: 3742 bytes --]

> Alan BRASLAU <mailto:alan.braslau@cea.fr>
> 13. Februar 2016 um 00:23
> Hi,
>
> Basic font switches are bold (\bf), italic (\it), slanted (\sl), ...
> and one can have bolditalic (\bi), boldslated (\bs), etc.
> We also have style=bold, style=slanted, etc.
>
> Is there some way to manipulate font switches so that
> \bold{This text is \slated{bold}}
> for example, would put the word "bold" into boldslanted?
>
> A natural use of this is, e.g. headers that get typeset in bold. What
> if the title contains a word, say, in slanted (or, worse, some
> mathematics)?

There are a few font switches which change the style dependant on the 
current style


\starttext

\starttabulate[|l|f{\tf}l|f{\it}l|f{\sl}l|f{\bf}l|f{\bi}l|f{\bs}l|]
\NC                \NC \tttf \tex{tf} \NC \tttf \tex{it} \NC \tttf 
\tex{sl} \NC \tttf \tex{bf} \NC \tttf \tex{bi} \NC \tttf \tex{bs} \NC\NR
\NC                \NC           Text \NC           Text \NC           
Text \NC           Text \NC           Text \NC           Text \NC\NR
\NC \tex{em}       \NC \em       Text \NC \em       Text \NC \em       
Text \NC \em       Text \NC \em       Text \NC \em       Text \NC\NR
\NC \tex{boldface} \NC \boldface Text \NC \boldface Text \NC \boldface 
Text \NC \boldface Text \NC \boldface Text \NC \boldface Text \NC\NR
\NC \tex{typeface} \NC \typeface Text \NC \typeface Text \NC \typeface 
Text \NC \typeface Text \NC \typeface Text \NC \typeface Text \NC\NR
\NC \tex{swapface} \NC \swapface Text \NC \swapface Text \NC \swapface 
Text \NC \swapface Text \NC \swapface Text \NC \swapface Text \NC\NR
\stoptabulate

\stoptext


but I guess you’re looking for something like this (similar to the LaTeX 
font system):


\unprotect

\def\texttf_direct
   {\ifx\fontalternative\s!it \tf \else
    \ifx\fontalternative\s!sl \tf \else
    \ifx\fontalternative\s!bi \bf \else
    \ifx\fontalternative\s!bs \bf \fi\fi\fi\fi}

\def\textbf_direct
   {\ifx\fontalternative\s!tf \bf \else
    \ifx\fontalternative\s!it \bi \else
    \ifx\fontalternative\s!sl \bs \fi\fi\fi}

\def\textit_direct
   {\ifx\fontalternative\s!tf \it \else
    \ifx\fontalternative\s!sl \it \else
    \ifx\fontalternative\s!bf \bi \else
    \ifx\fontalternative\s!bs \bi \fi\fi\fi\fi}

\def\textsl_direct
   {\ifx\fontalternative\s!tf \sl \else
    \ifx\fontalternative\s!it \it \else
    \ifx\fontalternative\s!bf \bs \else
    \ifx\fontalternative\s!bi \bs \fi\fi\fi\fi}

\def\textem_direct
   {\ifx\fontalternative\s!tf \it \else
    \ifx\fontalternative\s!it \tf \else
    \ifx\fontalternative\s!sl \tf \else
    \ifx\fontalternative\s!bf \bi \else
    \ifx\fontalternative\s!bi \bf \else
    \ifx\fontalternative\s!bs \bf \fi\fi\fi\fi\fi\fi}

\def\texttf_indeed{\bgroup\texttf_direct\let\nexttoken}
\def\textbf_indeed{\bgroup\textbf_direct\let\nexttoken}
\def\textit_indeed{\bgroup\textit_direct\let\nexttoken}
\def\textsl_indeed{\bgroup\textsl_direct\let\nexttoken}
\def\textem_indeed{\bgroup\textem_direct\let\nexttoken}

\unexpanded\def\texttf{\doifelsenextbgroup\texttf_indeed\texttf_direct}
\unexpanded\def\textbf{\doifelsenextbgroup\textbf_indeed\textbf_direct}
\unexpanded\def\textit{\doifelsenextbgroup\textit_indeed\textit_direct}
\unexpanded\def\textsl{\doifelsenextbgroup\textsl_indeed\textsl_direct}
\unexpanded\def\textem{\doifelsenextbgroup\textem_indeed\textem_direct}

\protect

\starttext

text {\textbf text \textit text \texttf text \textsl text}

text {\textit text \textbf text \textsl text \texttf text}

text \textbf{text \textit{text} \textsl{text \texttf{text} text}}

text {\textem text \textem text} {\bf text \textem text \textem text}

\stoptext


Wolfgang

[-- Attachment #1.2: Type: text/html, Size: 5201 bytes --]

[-- Attachment #2: Type: text/plain, Size: 485 bytes --]

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

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: font switches: bold, slanted, etc.
  2016-02-13  1:14 ` Pablo Rodriguez
@ 2016-02-13 10:02   ` Alan BRASLAU
  2016-02-13 10:20     ` Pablo Rodriguez
  0 siblings, 1 reply; 10+ messages in thread
From: Alan BRASLAU @ 2016-02-13 10:02 UTC (permalink / raw)
  To: Pablo Rodriguez; +Cc: mailing list for ConTeXt users

On Sat, 13 Feb 2016 02:14:10 +0100
Pablo Rodriguez <oinos@gmx.es> wrote:

> I guess \em is your friend here:

Yes, silly me, of course \em nests well with bold
as does mathematics:

\starttext
This is $τεχ$.

\bf This is $τεχ$.
\stoptext

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

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: font switches: bold, slanted, etc.
  2016-02-13 10:02   ` Alan BRASLAU
@ 2016-02-13 10:20     ` Pablo Rodriguez
  0 siblings, 0 replies; 10+ messages in thread
From: Pablo Rodriguez @ 2016-02-13 10:20 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On 02/13/2016 11:02 AM, Alan BRASLAU wrote:
> On Sat, 13 Feb 2016 02:14:10 +0100 Pablo Rodriguez wrote:
> 
>> I guess \em is your friend here:
> 
> Yes, silly me, of course \em nests well with bold
> as does mathematics:
> [...]

Alan, please, no derogatory remarks about list members :-).

There is a Latin quote from Horace («Ars poetica», 359,
http://www.perseus.tufts.edu/hopper/text?doc=Hor.+Ars+369&fromdoc=Perseus%3Atext%3A1999.02.0064
[of course, Thomas knows way better than myself, since I’m not even an
amateur]):

    quandoque bonus dormitat Homerus

which translates (according to Merriam-Webster
[http://www.merriam-webster.com/dictionary/aliquando%20bonus%20dormitat%20homerus]):

    sometimes (even) good Homer nods

We are all human beings (although ones more perfect and with more
ConTeXt knowledge than others :-)).

Cheers,

Pablo
-- 
http://www.ousia.tk
___________________________________________________________________________________
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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: font switches: bold, slanted, etc.
  2016-02-13  9:53 ` Wolfgang Schuster
@ 2016-02-13 10:30   ` Alan BRASLAU
  2016-02-13 10:47     ` Wolfgang Schuster
  0 siblings, 1 reply; 10+ messages in thread
From: Alan BRASLAU @ 2016-02-13 10:30 UTC (permalink / raw)
  To: Wolfgang Schuster; +Cc: mailing list for ConTeXt users

On Sat, 13 Feb 2016 10:53:22 +0100
Wolfgang Schuster <schuster.wolfgang@gmail.com> wrote:

> There are a few font switches which change the style dependant on the
> current style

Thanks for this table; I wikified it (under Font Switches, of course).
It mysteriously introduces \typeface, \swapface and \boldface.

I wonder, though, is there anything similar to boldsmallcapitals?
Does this even exist in any fonts?


> but I guess you’re looking for something like this (similar to the
> LaTeX font system):

I wouldn't dream of something similar to LaTeX...

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

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: font switches: bold, slanted, etc.
  2016-02-13 10:30   ` Alan BRASLAU
@ 2016-02-13 10:47     ` Wolfgang Schuster
  2016-02-13 15:55       ` Alan BRASLAU
  0 siblings, 1 reply; 10+ messages in thread
From: Wolfgang Schuster @ 2016-02-13 10:47 UTC (permalink / raw)
  To: Alan BRASLAU; +Cc: mailing list for ConTeXt users


[-- Attachment #1.1: Type: text/plain, Size: 1140 bytes --]

> Alan BRASLAU <mailto:alan.braslau@cea.fr>
> 13. Februar 2016 um 11:30
> On Sat, 13 Feb 2016 10:53:22 +0100
> Wolfgang Schuster<schuster.wolfgang@gmail.com>  wrote:
>
>> There are a few font switches which change the style dependant on the
>> current style
>
> Thanks for this table; I wikified it (under Font Switches, of course).
> It mysteriously introduces \typeface, \swapface and \boldface.
>
> I wonder, though, is there anything similar to boldsmallcapitals?
> Does this even exist in any fonts?
It depends on the font, with Latin Modern this isn’t possible because it 
uses
a separate font for smallcaps but with TeX Gyre you can do this:

\setupbodyfont[pagella]

\starttext

Text {\feature[+][smallcaps]Text} {\bf Text \feature[+][smallcaps]Text}

Text {\feature[+][smallcaps]Text \bf Text}

\stoptext

>> but I guess you’re looking for something like this (similar to the
>> LaTeX font system):
>
> I wouldn't dream of something similar to LaTeX...
The font switches aren't that bad but as I have shown there is no need
to have different commands for \XXX{....} and {\XXX ...}.

Wolfgang

[-- Attachment #1.2: Type: text/html, Size: 2644 bytes --]

[-- Attachment #2: Type: text/plain, Size: 485 bytes --]

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

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: font switches: bold, slanted, etc.
  2016-02-12 23:23 font switches: bold, slanted, etc Alan BRASLAU
  2016-02-13  1:14 ` Pablo Rodriguez
  2016-02-13  9:53 ` Wolfgang Schuster
@ 2016-02-13 11:42 ` Hans Hagen
  2 siblings, 0 replies; 10+ messages in thread
From: Hans Hagen @ 2016-02-13 11:42 UTC (permalink / raw)
  To: ntg-context

On 2/13/2016 12:23 AM, Alan BRASLAU wrote:
> Hi,
>
> Basic font switches are bold (\bf), italic (\it), slanted (\sl), ...
> and one can have bolditalic (\bi), boldslated (\bs), etc.
> We also have style=bold, style=slanted, etc.
>
> Is there some way to manipulate font switches so that
> \bold{This text is \slated{bold}}
> for example, would put the word "bold" into boldslanted?

normally \em will adapt itself

> A natural use of this is, e.g. headers that get typeset in bold. What
> if the title contains a word, say, in slanted (or, worse, some
> mathematics)?

guess why we need real 'bold math fonts' (a project related to the gyre 
fonts but not yet started)

Hans

-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
       tel: 038 477 53 69 | www.pragma-ade.com | www.pragma-pod.nl
-----------------------------------------------------------------
___________________________________________________________________________________
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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: font switches: bold, slanted, etc.
  2016-02-13 10:47     ` Wolfgang Schuster
@ 2016-02-13 15:55       ` Alan BRASLAU
  2016-02-13 17:11         ` Wolfgang Schuster
  0 siblings, 1 reply; 10+ messages in thread
From: Alan BRASLAU @ 2016-02-13 15:55 UTC (permalink / raw)
  To: Wolfgang Schuster; +Cc: mailing list for ConTeXt users

On Sat, 13 Feb 2016 11:47:52 +0100
Wolfgang Schuster <schuster.wolfgang@gmail.com> wrote:

> > Alan BRASLAU <mailto:alan.braslau@cea.fr>
> > 13. Februar 2016 um 11:30
> >
> > I wonder, though, is there anything similar to boldsmallcapitals?
> > Does this even exist in any fonts?  
> It depends on the font, with Latin Modern this isn’t possible because
> it uses
> a separate font for smallcaps but with TeX Gyre you can do this:
> 
> \setupbodyfont[pagella]
> 
> \starttext
> 
> Text {\feature[+][smallcaps]Text} {\bf Text
> \feature[+][smallcaps]Text}
> 
> Text {\feature[+][smallcaps]Text \bf Text}
> 
> \stoptext

Thank you.

This is nice, as TeX Gyre is a very good base for most use (unless one
specifically needs/wants a different font). So I wonder if \smallcaps
could be easily made to use this \feature automagically if it exists in
the font? Maybe it does this already:

\setupbodyfont[pagella]

\starttext

Text {\bf Text \feature[+][smallcaps]Text}

Text {\bf Text \smallcaps Text}

\stoptext


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

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: font switches: bold, slanted, etc.
  2016-02-13 15:55       ` Alan BRASLAU
@ 2016-02-13 17:11         ` Wolfgang Schuster
  0 siblings, 0 replies; 10+ messages in thread
From: Wolfgang Schuster @ 2016-02-13 17:11 UTC (permalink / raw)
  To: Alan BRASLAU; +Cc: mailing list for ConTeXt users


[-- Attachment #1.1: Type: text/plain, Size: 1054 bytes --]

> Alan BRASLAU <mailto:alan.braslau@cea.fr>
> 13. Februar 2016 um 16:55
> On Sat, 13 Feb 2016 11:47:52 +0100
>
> Thank you.
>
> This is nice, as TeX Gyre is a very good base for most use (unless one
> specifically needs/wants a different font). So I wonder if \smallcaps
> could be easily made to use this \feature automagically if it exists in
> the font? Maybe it does this already:
>
> \setupbodyfont[pagella]
>
> \starttext
>
> Text {\bf Text \feature[+][smallcaps]Text}
>
> Text {\bf Text \smallcaps Text}
>
> \stoptext
The \smallcaps command only enables the feature in the font but it 
performs no check.

You can use the \doifelsecurrentfonthasfeatur command to check if a 
feature is present
in the currently used font.

\def\autosmallcaps
   {\doifelsecurrentfonthasfeature{smcp}\setsmallcaps\sc}

\starttext

{Text \autosmallcaps Text} {\it Text \autosmallcaps Text} {\bf Text 
\autosmallcaps Text}

\blank \setupbodyfont[pagella]

{Text \autosmallcaps Text} {\it Text \autosmallcaps Text} {\bf Text 
\autosmallcaps Text}

\stoptext

Wolfgang

[-- Attachment #1.2: Type: text/html, Size: 2178 bytes --]

[-- Attachment #2: Type: text/plain, Size: 485 bytes --]

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

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2016-02-13 17:11 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-02-12 23:23 font switches: bold, slanted, etc Alan BRASLAU
2016-02-13  1:14 ` Pablo Rodriguez
2016-02-13 10:02   ` Alan BRASLAU
2016-02-13 10:20     ` Pablo Rodriguez
2016-02-13  9:53 ` Wolfgang Schuster
2016-02-13 10:30   ` Alan BRASLAU
2016-02-13 10:47     ` Wolfgang Schuster
2016-02-13 15:55       ` Alan BRASLAU
2016-02-13 17:11         ` Wolfgang Schuster
2016-02-13 11:42 ` Hans Hagen

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).