[XeTeX] Checking if a font exists
Barry MacKichan
barry.mackichan at mackichan.com
Sun Aug 29 19:18:08 CEST 2010
Some variation of
fc-list "Myriad Pro" > somefile
should get you a file you can run a test on.
--Barry macKichan
On 8/29/2010 10:56 AM, Alan Munn wrote:
>
> On Aug 29, 2010, at 12:24 PM, Michiel Kamermans wrote:
>
>> Hi Alan,
>>
>>> Is there a way to check whether a font is present in a user's
>>> system? I need to generate a document with Myriad Pro if it exists,
>>> Arial otherwise, and if neither, exit with an error.
>>
>> Myriad Pro is nothing like Arial, though... but just to make your
>> life worse: thought about version numbers? There are many versions of
>> Myriad Pro, and many versions of Arial. How do you know which version
>> numbers are permissible?
>
> Well, since I have no information on that, I'll assume that all are
> useable.
>
>>
>> But let's step back for a moment because there's a fundamental
>> problem with your question: if you're using TeX, you're implicitly
>> saying you care deeply about the typesetting of your document, which
>> includes being particular about which stretches of text use what
>> font. Not just "which various fonts look good for this text", but
>> "which font is the one I intend to use for this bit of my document".
>> Rather than testing for several fonts on a user's machine, and
>> picking "the best match", like if the content were styled via
>> (X)HTML+CSS, with a font rule that specifies various fonts with
>> fallbals, part of the power of TeX is the fact that it will always
>> look the same on any machine it's compiled on, provided the
>> dependencies are met. So, either your document will look the same no
>> matter what machine it's compiled on, or it doesn't compile. The idea
>> that it will compile with Myriad Pro on one machine, and Arial on
>> another, basically violates the very idea of TeX.
>
> Sure, in an ideal world. But this particular application is to
> conform to standards set by my university, and for better or for
> worse, they've allowed Arial to substitute for Myriad Pro if the
> latter is not available. And it may turn out that since I can
> reasonably assume that Myriad Pro should be available, I can fix
> things so that it is the only font used, as long as it can be found.
>
>>
>> The better way to solve whatever problem you're having that made you
>> wonder how to detect certain fonts is to simply supply those fonts
>> along with your .tex source. If other people need to compile your
>> source, simply ensure that they have everything they need to compile it?
>
> Well I don't know if redistribution of Adobe fonts is permitted (I
> would assume not) so this really isn't a (legal) option.
>
> Alan
>
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0x923B4C8D.asc
Type: application/pgp-keys
Size: 1754 bytes
Desc: not available
URL: <http://tug.org/pipermail/xetex/attachments/20100829/fd1ad721/attachment.bin>
More information about the XeTeX
mailing list