Search in sources :

Example 1 with FontNameRegistry

use of com.intellij.openapi.editor.richcopy.model.FontNameRegistry in project intellij-community by JetBrains.

the class RtfTransferableData method build.

@Override
protected void build(@NotNull final StringBuilder holder, final int maxLength) {
    holder.append(HEADER_PREFIX);
    holder.append("{\\colortbl;");
    ColorRegistry colorRegistry = mySyntaxInfo.getColorRegistry();
    for (int id : colorRegistry.getAllIds()) {
        Color color = colorRegistry.dataById(id);
        int[] components = getAdjustedColorComponents(color);
        holder.append(String.format("\\red%d\\green%d\\blue%d;", components[0], components[1], components[2]));
    }
    holder.append("}\n");
    holder.append("{\\fonttbl");
    FontNameRegistry fontNameRegistry = mySyntaxInfo.getFontNameRegistry();
    for (int id : fontNameRegistry.getAllIds()) {
        String fontName = fontNameRegistry.dataById(id);
        holder.append(String.format("{\\f%d %s;}", id, fontName));
    }
    holder.append("}\n");
    holder.append("\n\\s0\\box").append("\\cbpat").append(mySyntaxInfo.getDefaultBackground()).append("\\cb").append(mySyntaxInfo.getDefaultBackground()).append("\\cf").append(mySyntaxInfo.getDefaultForeground());
    addFontSize(holder, mySyntaxInfo.getFontSize());
    holder.append('\n');
    mySyntaxInfo.processOutputInfo(new MyVisitor(holder, myRawText, mySyntaxInfo, maxLength));
    holder.append("\\par");
    holder.append(HEADER_SUFFIX);
}
Also used : FontNameRegistry(com.intellij.openapi.editor.richcopy.model.FontNameRegistry) ColorRegistry(com.intellij.openapi.editor.richcopy.model.ColorRegistry)

Aggregations

ColorRegistry (com.intellij.openapi.editor.richcopy.model.ColorRegistry)1 FontNameRegistry (com.intellij.openapi.editor.richcopy.model.FontNameRegistry)1