On Sun, Aug 29, 2010 at 12:17:38PM -0400, Alan Munn wrote: > 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. > > I couldn't find anything in either the fontspec and xetex documentation.
I don't have a xetex answer, sorry, but I find it interesting, so I tried something luatexy, just in case some one else is interested. It should be self explanatory: \input luaotfload.sty \directlua { local name = 'Latin Modern Roman' % should be found % local name = 'cmr10' % tfm font % local name = 'foobar' % non-existent font local spec = fonts.define.analyze(name) local file = fonts.names.resolve(spec) % if the font is not found the asked name is returned if file == name then % it can be a tfm font, just in case local tfm = kpse.find_file(file, "ofm") if tfm then tex.sprint("font is found and is a tfm font") else tex.sprint("font not found") end else tex.sprint("font is found") end } \bye Regards, Khaled -- Khaled Hosny Arabic localiser and member of Arabeyes.org team Free font developer -------------------------------------------------- Subscriptions, Archive, and List information, etc.: http://tug.org/mailman/listinfo/xetex