[XeTeX] fontconfig and the same name fonts

Nikola Lecic nlecic at EUnet.yu
Sun Apr 29 17:37:35 CEST 2007


On Sun, 29 Apr 2007 10:52:32 +0200
Jonathan Kew <jonathan_kew at sil.org> wrote:

> On 29 Apr 2007, at 6:16 am, Nikola Lecic wrote:
> 
> > On Sun, 29 Apr 2007 12:10:54 +0930
> > Will Robertson <wspr81 at gmail.com> wrote:
> >
> >> On 29/04/2007, at 11:50 , Nikola Lecic wrote:
> >>
> >>> Is there any recommended method in situation when we have OTF and
> >>> TTF font with the same name and need to have both installed?
> 
> My current recommendation would be "don't do this"! :)

Yes, I feel it's somehow bad idea, but if you need some fonts of that sort and try to simply and non very elegantly add 'TT' to their names in FontForge... :)
 
> >>> (GFS
> >>> fonts are a good example: download any pair from http://
> >>> www.greekfontsociety.org.) In such cases, fc-list lists only one
> >>> name, despite inspecting and registering both files. How can we be
> >>> sure what font file XeTeX actually uses and what fonts.conf or
> >>> XeTeX directives can make such a situation clear?
> 
> How can you be sure which font file *any* application uses in such a  
> case? If the OTF and TTF versions are exactly equivalent in  
> repertoire, behavior, metrics, etc., then it shouldn't matter which  
> is used (and so why bother installing both?); and if they're not  
> equivalent, then you need a way to control which is used in all
> cases (not just for XeTeX). It seems to me that if they aren't  
> interchangeable, they shouldn't have the same name.

Right, but GFS for instance must have some reason why they released 5 or 6 among their fonts in both formats with the same names; I don't know what will happen in future releases of those fonts. X applications (which are not capable of using OTF fonts or at least a lot of their features, including OpenOffice) somehow use TTF file in that case; it's easy to know that they do so because they can't handle OTF. Of course it would be better to solve this on the global level, but since (at least in my case, and the most probably in case of other non-Mac Unix users) XeTeX is the only completely OTF-capable application, I asked this qusetion here.

Anyway, I understand why you think this is irrelevant for XeTeX as such.

> >> It sounds like a funny idea to need to do this in the first place;
> >> if you need both at once, presumably it's to test them against each
> >> other. In which case, you could just load them without installing
> >> them system-wide with
> >>    \font\x="[GFS Bodoni.ttf]" at 12pt% (without fontspec)
> >> or
> >>    \newfontfamily\x[ExternalLocation]{GFS Dodoni.ttf}% (with  
> >> fontspec)
> >
> > Yes, I realised I wasn't clear enough :) Comparing fonts against  
> > each other isn't primary goal. I need OTF version for XeTeX and
> > TTF version for OpenOffice, for example.
> 
> Just curious... what's wrong with using the TTF version in XeTeX as  
> well?

Well, in my humble opinion, it indirectly does matter if authors have some reason to separate versions (as I've written above) and if they behave differently in those other applications. :)

> > So, besides a possibility to call all OTF fonts (if used in XeTeX  
> > only) by means of ExternalLocation, can fontspec/XeTeX return a  
> > real file name of font found in the system through fontconfig?
> 
> Not at the moment. (In the general case, this might be a hard  
> problem; under some operating systems, at least, fonts need not  
> actually exist on disk with a "real file name"; they could be coming  
> from some other source.)
> 
> In any case, I see relatively little benefit in returning the file  
> name unless there is also some way for you to choose among the  
> multiple fonts with the same name.
> 
> What might be possible is to provide a way to express a preference  
> for one font format or another; e.g, \XeTeXpreferredfontformat
> "OTF".

That would be exactly what I'd like to see (instead of 'real file names') in case of the  same names. In that case, XeTeX would log a warning if it couldn't find preferred format, whatever could be the reason (fontconfig or something else) and the user doesn't have to worry of particular tweaks of underlying font software.

For example, look how differently fontconfig versions (default installation) list DejaVu sans-serif fonts:

fontconfig-2.3.2:

  nikola at nyx% fc-list | grep DejaVu | grep Sans | sort
  DejaVu Sans Condensed:style=Bold
  DejaVu Sans Condensed:style=Bold Oblique
  DejaVu Sans Condensed:style=Book
  DejaVu Sans Condensed:style=Oblique
  DejaVu Sans Light:style=ExtraLight
  DejaVu Sans Mono:style=Bold
  DejaVu Sans Mono:style=Bold Oblique
  DejaVu Sans Mono:style=Book
  DejaVu Sans Mono:style=Oblique
  DejaVu Sans:style=Bold
  DejaVu Sans:style=Bold Oblique
  DejaVu Sans:style=Book
  DejaVu Sans:style=Oblique

fontconfig-2.4.2:

  nikola at nyx% fc-list | grep Deja | grep Sans | sort
  DejaVu Sans Mono:style=Bold
  DejaVu Sans Mono:style=Bold Oblique
  DejaVu Sans Mono:style=Book
  DejaVu Sans Mono:style=Oblique
  DejaVu Sans,DejaVu Sans Condensed:style=Condensed Bold Oblique,Bold Oblique
  DejaVu Sans,DejaVu Sans Condensed:style=Condensed Bold,Bold
  DejaVu Sans,DejaVu Sans Condensed:style=Condensed Oblique,Oblique
  DejaVu Sans,DejaVu Sans Condensed:style=Condensed,Book
  DejaVu Sans,DejaVu Sans Light:style=ExtraLight
  DejaVu Sans:style=Bold
  DejaVu Sans:style=Bold Oblique
  DejaVu Sans:style=Book
  DejaVu Sans:style=Oblique

Really confusing for both applications and user (in favour of older version). In such a situation, I'd like to know what file XeTeX/fontspec really used.

And to repeat a question from previous mail: Is there any other disadvantage in using ExternalLocation, i.e. in avoiding fontconfig (except that we loose regular-bold-italic font files connections)?

> Or maybe there is already a way to do this globally for
> fontconfig via settings in fonts.conf; it'd be worth checking the FC  
> documentation for this.

Fontconfig has a method to set up preference order, at least <dir>...</dir> order in fontconfig's fonts.conf/local.conf matters (as far as I know). But that helps only if your fonts have _different_ names. :)

Nikola Lečić


More information about the XeTeX mailing list