public void setAttribute(Element el, String fontName) { // could a document fragment contain just a #text node? if (outputType== RunFontActionType.DISCOVERY) { return; } else if (outputType==RunFontActionType.XHTML) { if (spacePreserve) { /* * Convert @xml:space='preserve' to style="white-space:pre-wrap;" which is good for FF3, and WebKit; not honoured by IE7 though. */ el.setAttribute("style", getCssProperty(fontName) + "white-space:pre-wrap;"); } else { el.setAttribute("style", getCssProperty(fontName)); } } else if (outputType==RunFontActionType.XSL_FO) { String val = getPhysicalFont(fontName); if (val==null) { // Avoid @font-family="", which FOP doesn't like el.setAttribute("font-family", fallbackFont ); } else { el.setAttribute("font-family", val ); } // Any reason not to always do this? // el.setAttribute( "white-space-collapse", "false"); // el.setAttribute( "white-space", "pre"); } }