Re: [XeTeX] Checking if a font exists
On 30 Aug 2010, at 05:56, Wilfred van Rooijen wrote: The (more dificult) solution could be to make a shell script which will run the compilation of the xelatex source and detect whether or not the run was succesfull - if not, change the input file to the other font and retry. I'm surprised no-one has suggested the straightforward, pure-xetex approach: something along these lines (untested). \def\myfont{Myriad Pro} \def\myfallback{Arial} \count255=\interactionmode \batchmode \font\foo=\myfont\space at 10pt \ifx\foo\nullfont \font\foo = \myfallback\space at 10pt \ifx\foo\nullfont \errorstopmode \errmessage{no suitable font found} \else \let\myfont=\myfallback \fi \fi \interactionmode=\count255 % and now proceed to use \myfont. JK -- Subscriptions, Archive, and List information, etc.: http://tug.org/mailman/listinfo/xetex
Re: [XeTeX] Checking if a font exists
On Sun, Aug 29, 2010 at 10:55:10PM +0100, Philip Taylor (Webmaster, Ret'd) wrote: Grzegorz Murzynowski wrote: And when the 18th output is on (writing to shell), you can put \immediate\write 18{fc-list Myriad Pro fontcheck.tex} \newread\fontcheck \immediate\openin\fontcheck=fontcheck.tex \ifeof \fontcheck ??? Is the \immediate necessary before the \openin at line 3 ? No. (But it doesn't any harm either.) There are lots of other problems (apart from the question, whether fc-list is the correct test): * \write18 might be disabled, then the write line isn't executed. At least this can be tested by \pdfshellescape (0 is disabled, 1 is unrestricted enabled, 2 is restricted enabled) * \write18 can be enabled, but restricted (\pdfshellescape is 2). The command might not be part of the allowed program list. There is no way to test it except trying the feature. * fontcheck.tex is generated in the current directory. However it can be read from a different directory, depending on the TeX configuration (TEXINPUTS, ...). Especially problematic if \write18 is not enabled and the existence of the file is used as check, whether the \write18 line has worked. This can be cured by the pipe feature: \openin\fontcheck |fc-list 'Myriad Pro' Does it (especially the single quotes) work in Windows? * A first line is also read, if the file is empty. The macro that stores the line contains the character, configured by \endlinechar and is empty if \endlinechar=-1. * ... Yours sincerely Heiko Oberdiek -- Subscriptions, Archive, and List information, etc.: http://tug.org/mailman/listinfo/xetex
Re: [XeTeX] Checking if a font exists
On Mon, Aug 30, 2010 at 08:22:53AM +0100, Jonathan Kew wrote: On 30 Aug 2010, at 05:56, Wilfred van Rooijen wrote: The (more dificult) solution could be to make a shell script which will run the compilation of the xelatex source and detect whether or not the run was succesfull - if not, change the input file to the other font and retry. I'm surprised no-one has suggested the straightforward, pure-xetex approach: something along these lines (untested). \def\myfont{Myriad Pro} \def\myfallback{Arial} \count255=\interactionmode \batchmode \font\foo=\myfont\space at 10pt \ifx\foo\nullfont \font\foo = \myfallback\space at 10pt \ifx\foo\nullfont \errorstopmode \errmessage{no suitable font found} \else \let\myfont=\myfallback \fi \fi \interactionmode=\count255 % and now proceed to use \myfont. * It takes lots of time if the font cannot be found. * kpsathea complains Invalid fontname `Myriad Pro', contains ' ' * The error code is set because of the error message, if the font cannot be found. Yours sincerely Heiko Oberdiek -- Subscriptions, Archive, and List information, etc.: http://tug.org/mailman/listinfo/xetex
Re: [XeTeX] Checking if a font exists
Heiko Oberdiek wrote: On Mon, Aug 30, 2010 at 08:22:53AM +0100, Jonathan Kew wrote: I'm surprised no-one has suggested the straightforward, pure-xetex approach: something along these lines (untested). snip * It takes lots of time if the font cannot be found. * kpsathea complains Invalid fontname `Myriad Pro', contains ' ' * The error code is set because of the error message, if the font cannot be found. None the less, it still seems to be the philosophically correctly approach (IMHO, of course). Philip Taylor -- Subscriptions, Archive, and List information, etc.: http://tug.org/mailman/listinfo/xetex
Re: [XeTeX] Checking if a font exists
On Mon, Aug 30, 2010 at 09:58:20AM +0100, Philip Taylor (Webmaster, Ret'd) wrote: Heiko Oberdiek wrote: On Mon, Aug 30, 2010 at 08:22:53AM +0100, Jonathan Kew wrote: I'm surprised no-one has suggested the straightforward, pure-xetex approach: something along these lines (untested). snip * It takes lots of time if the font cannot be found. * kpsathea complains Invalid fontname `Myriad Pro', contains ' ' * The error code is set because of the error message, if the font cannot be found. None the less, it still seems to be the philosophically correctly approach (IMHO, of course). What kind of philosophy? An error as part of normal behaviour? ;-) Yours sincerely Heiko Oberdiek -- Subscriptions, Archive, and List information, etc.: http://tug.org/mailman/listinfo/xetex
Re: [XeTeX] Checking if a font exists
On Mon, Aug 30, 2010 at 08:22:53AM +0100, Jonathan Kew wrote: On 30 Aug 2010, at 05:56, Wilfred van Rooijen wrote: The (more dificult) solution could be to make a shell script which will run the compilation of the xelatex source and detect whether or not the run was succesfull - if not, change the input file to the other font and retry. I'm surprised no-one has suggested the straightforward, pure-xetex approach: something along these lines (untested). Well, I thought about comparing to nullfont, but I don't know enough TeX to know how to do it (I didn't even know there a \nullfont CS :). 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
Re: [XeTeX] Checking if a font exists
Heiko Oberdiek wrote: * It takes lots of time if the font cannot be found. * kpsathea complains Invalid fontname `Myriad Pro', contains ' ' * The error code is set because of the error message, if the font cannot be found. None the less, it still seems to be the philosophically correctly approach (IMHO, of course). What kind of philosophy? An error as part of normal behaviour? ;-) I meant the philosophy of Jonathan's approach (use only [Xe]TeX) rather than [Xe]TeX's behaviour in the presence of his approach and in the absence of one of more fonts ... ** Phil. -- Subscriptions, Archive, and List information, etc.: http://tug.org/mailman/listinfo/xetex
Re: [XeTeX] Checking if a font exists
2010/8/30 Heiko Oberdiek heiko.oberd...@googlemail.com: What kind of philosophy? An error as part of normal behaviour? ;-) If you want to know if XeTeX knows a font you should ask XeTeX and not fontcache. If that's hard, XeTeX should be improved. Best Martin -- Subscriptions, Archive, and List information, etc.: http://tug.org/mailman/listinfo/xetex
Re: [XeTeX] Checking if a font exists
* The error code is set because of the error message, if the font cannot be found. Doesn't XeTeX implement \suppressfontnotfounderror that was added to pdfTeX two or three years ago, precisely to deal with this kind of problem? Arthur -- Subscriptions, Archive, and List information, etc.: http://tug.org/mailman/listinfo/xetex
Re: [XeTeX] Checking if a font exists
On Mon, Aug 30, 2010 at 01:21:11PM +0200, Arthur Reutenauer wrote: * The error code is set because of the error message, if the font cannot be found. Doesn't XeTeX implement \suppressfontnotfounderror that was added to pdfTeX two or three years ago, precisely to deal with this kind of problem? I thought it is a luatex-only addition (it is implied in the manual). I found this pdftex tracker issue which gives some background: http://sarovar.org/tracker/?func=detailatid=495aid=864group_id=106 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
Re: [XeTeX] Checking if a font exists
You can edit the file fonts.conf (for example in /etc/fonts or /usr/X11/lib/X11/fontconfig) or ~/.fonts.conf, your personal copy that fonts are searched additionally in particular places. Certainly, but on a standard system this may not be set. Thus testing in fc-list would return a negative, even if the font is installed (and with the proper settings in fontspec, available to xelatex). But I subscribe to Martin's statement: let xelatex report which fonts it knows, rather than an auxiliary program. Wilfred -- Greetings Pete Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. – Rich Cook -- Subscriptions, Archive, and List information, etc.: http://tug.org/mailman/listinfo/xetex -- Subscriptions, Archive, and List information, etc.: http://tug.org/mailman/listinfo/xetex
Re: [XeTeX] Checking if a font exists
On 08/30/2010 01:21 PM, Arthur Reutenauer wrote: * The error code is set because of the error message, if the font cannot be found. Doesn't XeTeX implement \suppressfontnotfounderror that was added to pdfTeX two or three years ago, precisely to deal with this kind of problem? To the best of my knowledge, it does. But an explicit \errmessage was given in the example code. Best wishes, Taco -- Subscriptions, Archive, and List information, etc.: http://tug.org/mailman/listinfo/xetex
Re: [XeTeX] Checking if a font exists
* The error code is set because of the error message, if the font cannot be found. Doesn't XeTeX implement \suppressfontnotfounderror that was added to pdfTeX two or three years ago, precisely to deal with this kind of problem? The primitive exists in 1.50.0-alpha-20080414 in the trunk. However 1.50.0 is not maintained recently. For example, 1.50.0 does not merge the new synctex. Best, Akira -- Subscriptions, Archive, and List information, etc.: http://tug.org/mailman/listinfo/xetex
Re: [XeTeX] Checking if a font exists
Doesn't XeTeX implement \suppressfontnotfounderror that was added to pdfTeX two or three years ago, precisely to deal with this kind of problem? To the best of my knowledge, it does. But an explicit \errmessage was given in the example code. Thanks. There is a difference between \suppressfontnotfounderror0 \font\xx=Foo Bar \xx test \bye and \suppressfontnotfounderror1 \font\xx=Foo Bar \xx test \bye Best, Akira -- Subscriptions, Archive, and List information, etc.: http://tug.org/mailman/listinfo/xetex
Re: [XeTeX] Checking if a font exists
Wow, I never imagined my question would produce such a flurry of responses (and since I was without internet access for a mere 18 hours, I've not been able to respond.) Thanks to everyone for their suggestions; as others have noted, Jonathan's approach is certainly the kind that I would prefer to use, especially since I have no knowledge of how Windows machines work... Thanks again to everyone. Alan -- Alan Munn am...@gmx.com -- Subscriptions, Archive, and List information, etc.: http://tug.org/mailman/listinfo/xetex
Re: [XeTeX] Checking if a font exists
Akira Kakuto wrote: Thanks. There is a difference between \suppressfontnotfounderror0 and \suppressfontnotfounderror1 I think it might be helpful for those unfamiliar with the most terse form of TeX syntax to explain that these are more conventionally written : \suppressfontnotfounderror = 0 and \suppressfontnotfounderror = 1 i.e., one variable, two possible values to be assigned, rather than (as some less experienced TeXxies might conceivably think) two variables differing subtly in name ... ** Phil. -- Subscriptions, Archive, and List information, etc.: http://tug.org/mailman/listinfo/xetex
Re: [XeTeX] Checking if a font exists
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. Well, at the risk of impertinence (since I can't directly address your question), if you have Adobe Reader, you've got Myriad Pro (as well as Minion Pro). I don't know what OS you have, but here's where I find it on the Mac: /Applications/Adobe Reader 9/Adobe Reader.app/Contents/MacOS/Resource/Font/ HTH. -- United in adoration of Jesus, fr. michael gilmary, mma Most Holy Trinity Monastery 67 Dugway Road Petersham, MA 01366-9725 www.MaroniteMonks.org -- Subscriptions, Archive, and List information, etc.: http://tug.org/mailman/listinfo/xetex
Re: [XeTeX] Checking if a font exists
On Aug 29, 2010, at 12:25 PM, Fr. Michael Gilmary wrote: 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. Well, at the risk of impertinence (since I can't directly address your question), if you have Adobe Reader, you've got Myriad Pro (as well as Minion Pro). I don't know what OS you have, but here's where I find it on the Mac: /Applications/Adobe Reader 9/Adobe Reader.app/Contents/MacOS/ Resource/Font/ Yes, I know that. I'm trying to produce a package that will work on any OS; alternatively, since most people will have Adobe Reader installed on their system I should just find out the absolute locations of the font on Windows and Linux and hard code the location with a user set flag for OS. This would certainly avoid needing to default to Arial. Alan -- Alan Munn am...@gmx.com -- Subscriptions, Archive, and List information, etc.: http://tug.org/mailman/listinfo/xetex
Re: [XeTeX] Checking if a font exists
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? 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. 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? - Mike Pomax Kamermans nihongoresources.com -- Subscriptions, Archive, and List information, etc.: http://tug.org/mailman/listinfo/xetex
Re: [XeTeX] Checking if a font exists
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 -- Alan Munn am...@gmx.com -- Subscriptions, Archive, and List information, etc.: http://tug.org/mailman/listinfo/xetex
Re: [XeTeX] Checking if a font exists
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 0x923B4C8D.asc Description: application/pgp-keys -- Subscriptions, Archive, and List information, etc.: http://tug.org/mailman/listinfo/xetex
Re: [XeTeX] Checking if a font exists
W dniu 29.08.2010 19:18, Barry MacKichan pisze: Some variation of fc-list Myriad Pro somefile should get you a file you can run a test on. And when the 18th output is on (writing to shell), you can put \immediate\write 18{fc-list Myriad Pro fontcheck.tex} \newread\fontcheck \immediate\openin\fontcheck=fontcheck.tex \ifeof \fontcheck … in your main TeX file. (I tested only the first line). and of course test the font names listed in that file in any way you please. (Note I'm a Linux (Ubuntu) user and know not much about what font-list command is available in other OS-es (and if any)). Anyway, thank you Barry MacKichan for the tip: I asked the same question on this list some months (years?) ago and the aswers were rather unsatisfactory. *This* looks it could work. Rgds — Grzegorz Murzynowski. --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 -- Subscriptions, Archive, and List information, etc.: http://tug.org/mailman/listinfo/xetex -- Subscriptions, Archive, and List information, etc.: http://tug.org/mailman/listinfo/xetex
Re: [XeTeX] Checking if a font exists
Since xetex uses fontcache, a extra benefit for Windows users is that they now have a version. By default it looks at the Windows font directory among others. --Barry On 8/29/2010 3:39 PM, Grzegorz Murzynowski wrote: W dniu 29.08.2010 19:18, Barry MacKichan pisze: Some variation of fc-list Myriad Pro somefile should get you a file you can run a test on. And when the 18th output is on (writing to shell), you can put \immediate\write 18{fc-list Myriad Pro fontcheck.tex} \newread\fontcheck \immediate\openin\fontcheck=fontcheck.tex \ifeof \fontcheck … in your main TeX file. (I tested only the first line). and of course test the font names listed in that file in any way you please. (Note I'm a Linux (Ubuntu) user and know not much about what font-list command is available in other OS-es (and if any)). Anyway, thank you Barry MacKichan for the tip: I asked the same question on this list some months (years?) ago and the aswers were rather unsatisfactory. *This* looks it could work. Rgds — Grzegorz Murzynowski. --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 -- Subscriptions, Archive, and List information, etc.: http://tug.org/mailman/listinfo/xetex -- Subscriptions, Archive, and List information, etc.: http://tug.org/mailman/listinfo/xetex 0x923B4C8D.asc Description: application/pgp-keys -- Subscriptions, Archive, and List information, etc.: http://tug.org/mailman/listinfo/xetex
Re: [XeTeX] Checking if a font exists
Hi, I am not 100% sure, but fc-list and friends might not always list the fonts even if they are on the user's system. For example, on my gentoo linux desktop, fonts for Adobe Acrobat are installed in a specific directory and are not included in the system-wide fonts by default. In fact, I have had to copy some of the Adobe fonts to my $HOME/.fonts to do some testing. The (more dificult) solution could be to make a shell script which will run the compilation of the xelatex source and detect whether or not the run was succesfull - if not, change the input file to the other font and retry. Regards, Wilfred --- On Mon, 30/8/10, Barry MacKichan barry.mackic...@mackichan.com wrote: From: Barry MacKichan barry.mackic...@mackichan.com Subject: Re: [XeTeX] Checking if a font exists To: Unicode-based TeX for Mac OS X and other platforms xetex@tug.org Date: Monday, 30 August, 2010, 12:08 PM Since xetex uses fontcache, a extra benefit for Windows users is that they now have a version. By default it looks at the Windows font directory among others. --Barry On 8/29/2010 3:39 PM, Grzegorz Murzynowski wrote: W dniu 29.08.2010 19:18, Barry MacKichan pisze: Some variation of fc-list Myriad Pro somefile should get you a file you can run a test on. And when the 18th output is on (writing to shell), you can put \immediate\write 18{fc-list Myriad Pro fontcheck.tex} \newread\fontcheck \immediate\openin\fontcheck=fontcheck.tex \ifeof \fontcheck … in your main TeX file. (I tested only the first line). and of course test the font names listed in that file in any way you please. (Note I'm a Linux (Ubuntu) user and know not much about what font-list command is available in other OS-es (and if any)). Anyway, thank you Barry MacKichan for the tip: I asked the same question on this list some months (years?) ago and the aswers were rather unsatisfactory. *This* looks it could work. Rgds — Grzegorz Murzynowski. --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 -- Subscriptions, Archive, and List information, etc.: http://tug.org/mailman/listinfo/xetex -- Subscriptions, Archive, and List information, etc.: http://tug.org/mailman/listinfo/xetex -Inline Attachment Follows