Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I am using the excellent Heuristica typeface, but I don't like the way the old style "1" looks. It looks more like an "I" in small caps than an actual number, unlike the Adobe original. Like so:

enter image description here

Is there a way to remap this single character to use a different font, or a not incredibly painful way to edit the font itself? (since I'm using the text figures for section numberings and the like, I would prefer a document wide solution)

EDIT: Minimal working example:

\documentclass[letterpaper,12pt]{amsart}

\usepackage[osf,scaled=.92]{heuristica}

\begin{document}
  012782
\end{document}
share|improve this question
4  
Please provide a short, compilable document demonstrating your configuration. We don't know, for example, whether you are using TeX, pdfTeX, ConTeXt, XeTeX or LuaTeX, among other things. This essentially means that we don't know which of several questions you are asking. If the licence allows it, you can edit the font using FontForge, for example. (Best to make a local copy, of course, rather than editing the one included in your TeX distribution since your changes will survive updates that way.) Any other option will be dependent on the engine you're using and maybe your document font config. –  cfr May 19 at 23:24
1  
Thanks for the response, I added a small example. My concern with tools like FontForge is that TeX seems to spread font stuff all over its folder structure, would just editing the font binaries be enough? –  Leandro M. May 19 at 23:41
3  
May I point that a truly old style 1 does look like a small cap I? Just take a look at the excellent ebgaramond font for another example. –  Bernard May 19 at 23:48
1  
It would not be enough to do it right, given your configuration. It would probably give a passable result provided the width of the oldstyle 1 did not differ too much from the width of the substitute. (TeX will still be using the original TeX Font Metric files and so will typeset the figure as a box of the old size.) The 'right' way (insofar as there is one which I doubt - mixing glyphs from different designs is not a great idea), would be to generate new TFM files with a virtual (or new virtual) font which incorporated the relevant glyph. Or edit the font & regenerate the TFM etc. Not simple. –  cfr May 20 at 1:15
1  
Would what still be an issue? Even if the OSF are tabular, you are going to take a glyph from another font. Unless the dimensions of that glyph match the dimensions of the tabular figures, the box will not be the correct size for the glyph. However, if they are too different and Heuristica uses tabular OSF, it will look awful anyway. If they are sufficiently similar, the result will probably be passable even though not quite right. –  cfr May 20 at 3:00

2 Answers 2

I've found some inspiration in the XeTeX reference guide (Character Classes, pages 14 and 15) and in these Q+A, Font substitution with XeLaTeX and Replacing "a" in latin modern. This is my try. I've installed http://www.ctan.org/tex-archive/fonts/heuristica by unzipping+copying files into my TeX distribution's local directory followed by mktexlsr and I am using the OTF file directly. I am using scaling of 0.86, 0.92 didn't look right.

By the way, I like the approach with \xeCJKDeclareSubCJKBlock from xeCJK package, but it's adding some extra spaces before and after digit 1, so please find it among the commented lines. There is an extended example of using this method, Combining Chinese, Japanese and Korean text with xeCJK.

% run: xelatex mal-one.tex
\documentclass[letterpaper,12pt]{article}%amsart
\pagestyle{empty}
% There are some extra spaces before and after "1", but it works...
%\usepackage{xeCJK}
%\xeCJKDeclareSubCJKBlock{one}{"0031}
%\setmainfont[Scale=0.92,RawFeature=+onum]{Heuristica-Regular.otf}
%\setCJKmainfont[one,Scale=0.86,RawFeature=-onum]{Heuristica-Regular.otf}
%\ifx
\usepackage{fontspec}
\setmainfont[RawFeature=+onum,Scale=0.92]{Heuristica-Regular.otf}
\newfontfamily{\mfont}[RawFeature=-onum,Scale=0.86]{Heuristica-Regular.otf}
\XeTeXinterchartokenstate=1
\newXeTeXintercharclass\msub
\XeTeXcharclass"0031=\msub
\XeTeXinterchartoks 0 \msub = {\begingroup\mfont}
\XeTeXinterchartoks 255 \msub = {\begingroup\mfont}
\XeTeXinterchartoks \msub 0 = {\endgroup}
\XeTeXinterchartoks \msub 255 = {\endgroup}
%\fi
\begin{document}
  012782
\end{document}

mwe


Next option would be to use mapping file (teckit_compile). I enclose the mapping file (mal-one-bonus.map) which is first processed by:

teckit_compile -o mal-one-bonus.tec mal-one-bonus.map

Instead of activating +onum we defined own character mapping. The source code is:

; This is mal-one-bonus.map file...
LHSName "input"
RHSName "output"
pass(Unicode)
UniClass [inputs] = (U+0030 U+0032..U+0039)
UniClass [outputs] = (U+F643 U+F645..U+F64C)
[inputs] <> [outputs]

Then we run xelatex mal-one-a.tex (it doesn't work with lualatex):

% run: xelatex mal-one-a.tex
\documentclass[letterpaper,12pt]{article}%amsart
\pagestyle{empty}
\usepackage{fontspec}
\setmainfont[Scale=0.92,Mapping=mal-one-bonus]{Heuristica-Regular.otf}
% RawFeature=+onum,
\begin{document}
  012782
\end{document}

I am thinking if a ligature (FeatureFile) could be used to solve this problem in lualatex. This is it, a new feature file (mal-feature.fea):

languagesystem DFLT dflt;
languagesystem latn dflt;
# A new ligature...
feature liga {
  sub one.taboldstyle by one;
  } liga;

We active it by lualatex mal-one-b.tex (it doesn't work with xelatex):

% run: lualatex mal-one-b.tex
\documentclass[letterpaper,12pt]{article}%amsart
\pagestyle{empty}
\usepackage{fontspec}
\usepackage{luatextra}
\setmainfont[Scale=0.92,FeatureFile=mal-feature.fea,RawFeature=+liga;+onum]{Heuristica-Regular.otf}
\begin{document}
  012782
\end{document}
share|improve this answer
    
Unfortunately I don't use either lualatex or xelatex, so this is of limited usefulness to me at the moment. But I thank you anyway, since this will be very handy if I decide to make the switch! –  Leandro M. May 21 at 4:55
    
@LeandroM. From my point of view, pdflatex engine is history. I see, switching from pdflatex to lualatex is rather easy. Just change prefix pdf to lua in your latex engine and instead of inputenc we use packages like luainputenc or luatextra instead of it with default utf-8 encoding. –  Malipivo May 21 at 5:12
    
I see. Could you elaborate on why pdflatex is history? –  Leandro M. May 21 at 5:38
    
@LeandroM. I'm sure I'm not the right person to start a topic of this magnitude (esp. as I'm not using LaTeX3+ConTeXt regularly). However, I can provide you several tips what XeTeX+LuaTeX can do, please take them as a starting point for further reading about the TeX successors: tex.stackexchange.com/questions/36/…, tex.stackexchange.com/questions/2984/… and tex.stackexchange.com/questions/28642/… –  Malipivo May 21 at 6:42
up vote 2 down vote accepted

Following cfr's suggestion I edited the Type 1 binaries in FontForge to make the OSF look more like the lining figures. Here's what my final result looks like:

enter image description here

This shows both the virtues (consistency with fractions and superior figures) and the vices — poor spacing in numbers like 2011, although it was that way in the original also.

Heuristica is licensed under the OFL so my modified version should be okay to share in case someone from the future wants it. The only caveat is that the modified version can't be called "Heuristica" anymore. At least that's my interpretation of the license, and I welcome corrections.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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