void (int startOffset, int endOffset) { boolean formattedText = myForeground != myDefaultForeground || myBackground != myDefaultBackground || myFontFamily != myDefaultFontFamily || myBold || myItalic; if (!formattedText) { escapeAndAdd(startOffset, endOffset); return; } myResultBuffer.append("<span style=\""); if (myForeground != myDefaultForeground) { defineForeground(myForeground, myResultBuffer); } if (myBackground != myDefaultBackground) { defineBackground(myBackground, myResultBuffer); } if (myBold) { defineBold(myResultBuffer); } if (myItalic) { defineItalic(myResultBuffer); } if (myFontFamily != myDefaultFontFamily) { appendFontFamilyRule(myResultBuffer, myFontFamily); } myResultBuffer.append("\">"); escapeAndAdd(startOffset, endOffset); myResultBuffer.append("</span>"); }