use of javax.swing.text.SimpleAttributeSet in project omegat by omegat-org.
the class FontFallbackMarker method getAttributes.
private AttributeSet getAttributes(Font font) {
MutableAttributeSet attrs = new SimpleAttributeSet();
StyleConstants.setFontFamily(attrs, font.getFamily());
StyleConstants.setFontSize(attrs, editorFont.getSize());
return attrs;
}
use of javax.swing.text.SimpleAttributeSet in project omegat by omegat-org.
the class DefaultGlossaryRenderer method render.
@Override
public void render(GlossaryEntry entry, IRenderTarget<?> trg) {
trg.append(entry.getSrcText(), SOURCE_ATTRIBUTES);
trg.append(" = ");
String[] targets = entry.getLocTerms(false);
String[] comments = entry.getComments();
boolean[] priorities = entry.getPriorities();
String[] origins = entry.getOrigins(false);
StringBuilder commentsBuf = new StringBuilder();
for (int i = 0, commentIndex = 0; i < targets.length; i++) {
if (i > 0 && targets[i].equals(targets[i - 1])) {
if (!comments[i].equals("")) {
commentsBuf.append("\n");
commentsBuf.append(commentIndex);
commentsBuf.append(". ");
commentsBuf.append(comments[i]);
}
continue;
}
SimpleAttributeSet attrs = new SimpleAttributeSet(TARGET_ATTRIBUTES);
if (i > 0) {
trg.append(", ", attrs);
}
if (priorities[i]) {
StyleConstants.setBold(attrs, true);
}
attrs.addAttribute(TooltipAttribute.ATTRIBUTE_KEY, new TooltipAttribute(origins[i]));
trg.append(bracketEntry(targets[i]), attrs);
commentIndex++;
if (!comments[i].equals("")) {
commentsBuf.append("\n");
commentsBuf.append(commentIndex);
commentsBuf.append(". ");
commentsBuf.append(comments[i]);
}
}
trg.append(commentsBuf.toString(), NOTES_ATTRIBUTES);
}
Aggregations