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:



  • 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 '14 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 '14 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 '14 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 '14 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 '14 at 3:00

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
% There are some extra spaces before and after "1", but it works...
\XeTeXinterchartoks 0 \msub = {\begingroup\mfont}
\XeTeXinterchartoks 255 \msub = {\begingroup\mfont}
\XeTeXinterchartoks \msub 0 = {\endgroup}
\XeTeXinterchartoks \msub 255 = {\endgroup}


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"
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
% RawFeature=+onum,

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
  • 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 '14 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 '14 at 5:12
  • 1
    I see. Could you elaborate on why pdflatex is history? – Leandro M. May 21 '14 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 '14 at 6:42

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.

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.