private void processForeground(int startOffset, Color foreground) {
   if (myForeground == null && foreground != null) {
     addTextIfPossible(startOffset);
     myForeground = foreground;
     builder.addForeground(foreground);
   } else if (myForeground != null) {
     Color c = foreground == null ? myDefaultForeground : foreground;
     if (!myForeground.equals(c)) {
       addTextIfPossible(startOffset);
       builder.addForeground(c);
       myForeground = c;
     }
   }
 }