[tex-live] Fontconfig for XeTeX versus regular fontconfig

Jonathan Kew jfkthame at googlemail.com
Sat Oct 29 09:40:35 CEST 2011

On 28 Oct 2011, at 22:44, Khaled Hosny wrote:

> On Thu, Oct 27, 2011 at 10:39:13PM +0100, Jonathan Kew wrote:
>> I believe the worst of the problems with xetex/xdvipdfmx font
>> mismatches due to multiple versions of the same-named font could
>> actually be fixed fairly easily, by modifying xetex so that (when
>> using fontconfig to find fonts) it always writes the absolute path to
>> the font file into the xdv output (as if the font had been specified
>> by absolute pathname in the source document).
> It turned out not that hard, the attached (very minimal patch) will
> cause xetex to always write the full path to the XDV file (or so shows
> the dviasm I patched, which makes me feel very confident :p) No idea
> how this would affect xdv2pdf, though.

It would break xetex on macosx (whether using xdvipdfmx or xdv2pdf), where getFontFilename(engine) will often return NULL.

Yes, the change is not hard, as I said earlier, but it does need to be done with care. Probably something like this (untested) would work:

 		engine = (XeTeXLayoutEngine)fontlayoutengine[f];
-		fontRef = getFontRef(engine);
-		if (fontRef != 0)
-			getNames(fontRef, &psName, &famName, &styName);
-		else {
-			psName = getFontFilename(engine);
+		psName = getFontFilename(engine);
+		if (psName) {
 			famName = "";
 			styName = "";
+		else {
+			getNames(getFontRef(engine), &psName, &famName, &styName);
+		}

(BTW, the xetex list would be a better forum to discuss xetex bugs and patches.)


More information about the tex-live mailing list