ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Wolfgang Schuster <schuster.wolfgang@gmail.com>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>
Subject: Re: Mixing math and text font
Date: Thu, 9 Jan 2014 22:41:14 +0100	[thread overview]
Message-ID: <4CC1D5F1-EB9C-48AE-83BD-1AAA9AEE2CD0@gmail.com> (raw)
In-Reply-To: <20140109223049.0c0b89f9@Klapprechner1.site>


Am 09.01.2014 um 22:30 schrieb Joshua Krämer <joshua.kraemer@gmail.com>:

> Am Thu, 9 Jan 2014 20:41:15 +0100
> schrieb Wolfgang Schuster <schuster.wolfgang@gmail.com>:
> 
>>> (3) I have a typeface that uses unusual style names: "roman1",
>>> "roman2", "italic1", "italic2";  1 is regular, 2 is bold weight.
>>> The following works:
>>> 
>>> \definefontfamily[xxxface][serif][xxx][regularfont=xxxroman1, 
>>> italicfont=xxxitalic1, boldfont=xxxroman2]
>>> \setupbodyfont[xxxface]
>>> \starttext
>>> abc {\it abc} {\bf abc}
>>> \stoptext
>>> 
>>> This works for roman1 only:
>>> 
>>> \definefontfamily[xxxface][serif][xxx][regularfont=spec:roman1, 
>>> italicfont=spec:italic1, boldfont=spec:roman2]
>>> 
>>> Even this works for roman1 only:
>>> 
>>> \definefontfamily[xxxface][serif][xxx][regularfont=spec:roman1, 
>>> italicfont=xxxitalic1, boldfont=xxxroman2]
>> 
>> The name of the font files has nothing to do with way how
>> \definefontfamily collects the individual files for each style, to do
>> this it uses internal names and values from the font.
> 
> I've got the values from the output of "mtxrun --script fonts --list
> --all --pattern=xxx" (and compared with the name/style values in
> Fontforge), so I don't understand why "spec:roman1" works, but
> "spec:italic1" doesn't.
> 
> Additionally, what I think must be a bug is that
> "italicfont=file:xxxitalic1, boldfont=file:xxxroman2" works but stops
> working if I add "regularfont=spec:roman1":
> 
> \definefontfamily[xxxface][serif][xxx][regularfont=spec:roman1,
> italicfont=file:xxxitalic1, boldfont=file:xxxroman2]
> 
> Maybe if one of the values uses the "spec:" selector, all the values
> are treated as spec values despite the "file:" selector given?

What you try can’t work because spec is one of context three methods to load a font,
the first two are “file:…” and “name:…”. With the spec method you give context a list
of features for the font you want to load, the spec specifier has 5 argument:

1. The family name of the font
2. The weight of the font (light, normal, medium, bold, …)
3. The style of the font (normal, italic, slanted, …)
4. The width of the font (condensed, normal, expanded, …)
5. The variant of the font (normal, old style or smallcaps)

When you load a font you separate all arguments by a hyphen, when you leave
arguments out they get normal as default values. Below is a example how to load
TeX Gyre Pagella Regular and Bold with the spec method:

\starttext

{\definedfont[spec:texgyrepagella-normal]TeX Gyre Pagella Regular}

{\definedfont[spec:texgyrepagella-bold]TeX Gyre Pagella Bold}

\stoptext

When you want now the bolditalic form of the font you have to set the third argument
for the style:

\starttext

{\definedfont[spec:texgyrepagella-bold-normal]TeX Gyre Pagella Bold}

{\definedfont[spec:texgyrepagella-bold-italic]TeX Gyre Pagella Bolditalic}

\stoptext

When you now use the spec method with \definefontfamily nearly the same thing
happens but you set only the argument 2–5 because the name of the font was
already set.

>> When you use a opentype math font the upright, italic, bold etc.
>> characters are all in the same file which uses only the regular style
>> (a few math fonts provide also a bold style which can be useful in
>> headings).
>> 
>> Because there is only a upright math font you have to set a fallbacks
>> also for the upright style even when the font you’re using is italic,
>> e.g.
>> 
>> \definefallbackfamily[xxxface][math][xxx][tf=file:xxxitalic1,preset=math:lowercaseitalic]
> 
> Thanks, this works.  For some reason, "tf=" works, but "regularfont="
> doesn't.
> 
> And by the way, this works:
> \definefontfamily[leitura][serif][Leitura News][regularfont=spec:roman2]
> 
> and this doesn't work:
> \definefontfamily[leitura][serif][Leitura News][tf=spec:roman2]
> 
> So in some cases only "regularfont" seems to work, and in some cases only "tf“.

Just avoid the spec method, it depends a lot on the information in the font
and is not always reliable, because of this I don’t use it as default method
to search for all files in a font family.

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:[~2014-01-09 21:41 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-04 15:04 Joshua Krämer
2014-01-04 16:44 ` Wolfgang Schuster
2014-01-04 17:22   ` Joshua Krämer
2014-01-04 18:50     ` Wolfgang Schuster
2014-01-08 10:52       ` Joshua Krämer
2014-01-08 19:39         ` Wolfgang Schuster
2014-01-09 11:01           ` Joshua Krämer
2014-01-09 11:14             ` Joshua Krämer
2014-01-09 19:41             ` Wolfgang Schuster
2014-01-09 21:30               ` Joshua Krämer
2014-01-09 21:41                 ` Wolfgang Schuster [this message]
2014-01-09 22:12                   ` Joshua Krämer
2014-01-09 22:11                     ` Wolfgang Schuster
2014-01-04 17:47 ` Aditya Mahajan
2014-01-04 18:11   ` Joshua Krämer

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=4CC1D5F1-EB9C-48AE-83BD-1AAA9AEE2CD0@gmail.com \
    --to=schuster.wolfgang@gmail.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).