2

So here is the problem I have: I am using fontspec and a number of my fonts have lining figure only in the small caps font. So my question is how can I tell XeLaTeX that when it comes to numbers (section numbering, footnotes, ...) to get it from those files? Rather than the regular font file it uses for everything else? Is there a command like \setfigurefont?

  • Can you give a Minimal Working Example? Your question is tagged as opentype but the fonts you are describing sound more like traditionally arranged type 1 fonts with a separate "expert" font - except that the oldstyle figures are often the ones in that font. (There is a straightforward solution for such cases in regular LaTeX, at least, though maybe not XeLaTeX.) In any case, an example will help people play around with ideas. – cfr Dec 24 '13 at 0:50
  • Some fonts, (Scala & Eureka for example), have separate .otf files for small caps and the lining figures only appear in those. The .otf file for the regular font, has only old style numbers in it. So for example '1' produces an old style number while '{\sc 1}' produces a lining version of it. – Hesam Dec 24 '13 at 4:58
  • As for an example, it depends on the font, so I don't know what I should post. Fonts with better structured .otf files (for example they have separate fontLF.otf files for the version with lining figures) don't have this problem. Essentially I am asking whether XeLaTeX or fontspec have some tool that I can use to overcome the way .otf files are set. – Hesam Dec 24 '13 at 5:02
  • Well FF Eureka opentype fonts seem to include the small-caps and alternate figure styles in the same font as the standard upper and lower case. – cfr Dec 24 '13 at 23:30
  • Yes, that is my problem! The regular figure style only appears in the small caps .otf file. – Hesam Dec 25 '13 at 20:46
1

It’s probably better to patch the commands that output numbers (alongside punctuation and maybe uppercase letters). It might become tedious to list them all, though, so perhaps you should go for \arabic directly:

\newfontfamily\myLFfont[Numbers=Lining]{fontLF.otf} 
\let\arabicnumber\arabic
\def\arabic{\myLFfont\arabicnumber}
  • I doubt you need Numbers=Lining and I doubt it will have any effect. Would it work without that? – cfr Jan 1 '14 at 23:30
  • I actually agree this is a better idea although it means that typing 0123456789 in your document will require typing {\myLFfont 0123456789) or whatever. But if what you want is to just be able to make your choice once and forget about it, you have to do something much more elaborate. (Unless I've really misunderstood your suggestion.) And I took it that the OP was not content with the idea of having a command to get lining figures which I suggested would be pretty straightforward in a comment on the original question. – cfr Jan 1 '14 at 23:56
  • Sure, this only deals with the examples the OP gave (“section numbering, footnotes, …”). If Hesam is using siunitx some more numbers can be dealt with, because that package lets users choose different fonts for number and unit, e.g. \sisetup{number-text-rm = \myLFfont, …, unit-math-rm = \myfont, …}. Alas, the question lacks details in this regard. – Crissov Jan 2 '14 at 9:51
0

Posting this here so I can include code.

Does this question (especially the second answer) help at all? If you have a setup for LaTeX, it looks like you might be able to combine that with fontspec using something like the code suggested here:

\documentclass{article}
\usepackage{fontspec}
\newfontfamily\unicodefont{Lucida Grande}
\usepackage{mathpazo}
\usepackage[T1]{fontenc}
\begin{document}
A legacy \TeX\ font. {\unicodefont A unicode font.}
\end{document}

If the licence allows it, converting the fonts to type1 format and generating support files for LaTeX or pdfLaTeX would likely be easiest since there are no real advantages to using the opentype fonts and XeLaTeX in this situation and doing so just complicates things.

Whether you can convert the fonts themselves to type1 or not, you could do the following:

  1. Generate .afm files for the fonts. This will give you something which e.g. fontinst knows how to deal with.
  2. Use the instructions in Philipp Lehman's Font Installation Guide but create virtual fonts which take the lining (rather than oldstyle) figures from the small-caps fonts since that's how your files are organised. Tutorial 3 explains how to do this though you will need to read through the earlier tutorials if you are not familiar with fontinst.
  3. This will allow you to create the files you need to use virtual fonts containing the lining figures and you can then simply use the appropriate families when typesetting your document.
  4. You will want to install the fonts properly for TeX although for testing you can just have everything in your working directory and it should work.

I assume that if you are using XeLaTeX this will let you utilise the lining figures from the opentype sc font together with the regular upper and lower case from the standard upright opentype font. If you are permitted to convert them, creating type1 fonts will give you greater flexibility since you'll be able to use them with regular LaTeX as well.

I understand LuaTeX can create virtual fonts on the fly so you might also look into that possibility although I don't know how that works or if it would offer you an easier solution in this particular case.

You will lose access to any opentype features of the fonts you have. However, from your description of the fonts I suspect that this will lose you little if anything. It doesn't sound as if the fonts have been configured to make use of the features opentype offers and you can't use features the fonts don't have in any case. (If they were constructed with opentype in mind, I'd expect the different styles of figures to be included in the same font and enabled as opentype features. That would make things much easier but is not, unfortunately, what you actually have.)

  • XeTeX can use any type of fonts. There can be some problems when output font encodings are involved, because fontspec expects EU1. – egreg Jan 1 '14 at 10:19
  • If you are taking the trouble to modify the font, then why not just generate an OpenType fonts instead of going backwards are writing tens of support files in arcane formats? – Khaled Hosny Jan 1 '14 at 23:02
  • @KhaledHosny You are not modifying the fonts themselves. It is likely that the licence of these fonts prohibits modifying them. However, it is usually permitted to generate AFM/TFM files and VF fonts provided you don't interfere with the original type1/truetype/opentype fonts themselves. Not necessarily, of course. But often this is the case. This is why it is OK to install commercial fonts bringing characters from expert-encoded type1 together with those from the regular font in a virtual font even though it would be illegal to actually create a type1 font with the characters you need. – cfr Jan 1 '14 at 23:23
  • @KhaledHosny IF the licence permits modification of the original fonts, obviously you could instead combine characters from the two fonts to create a new font containing regular lower and upper case with lining figures. But these are not free fonts and it is likely that their licence is somewhat restrictive. Now it might be that the fonts allow modification for personal use. But that would be unusual - I've never seen a font licence of that sort for commercial, shareware or even freeware fonts. Moreover, you can probably share the generated TFM and VF files legally. – cfr Jan 1 '14 at 23:25
  • Converting from CFF-OTF (or TrueType) to Type1 is modification, so there is no difference unless the license permits this but not other types of modification (which is unlikely). BTW, Adobe license usually permits modifying their fonts for internal use (i.e. as long as you don’t distribute it to others, including other licensees). – Khaled Hosny Jan 2 '14 at 11:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.