Search in sources :

Example 1 with Style

use of org.metaborg.core.style.Style in project spoofax by metaborg.

the class StylerFacetFromESV method style.

private static IStyle style(IStrategoAppl attribute) {
    final Color color = color((IStrategoAppl) attribute.getSubterm(0));
    final Color backgroundColor = color((IStrategoAppl) attribute.getSubterm(1));
    final boolean bold;
    final boolean italic;
    final boolean underline = false;
    final boolean strikeout = false;
    final IStrategoAppl fontSetting = (IStrategoAppl) attribute.getSubterm(2);
    final String fontSettingCons = fontSetting.getConstructor().getName();
    switch(fontSettingCons) {
        case "BOLD":
            bold = true;
            italic = false;
            break;
        case "ITALIC":
            bold = false;
            italic = true;
            break;
        case "BOLD_ITALIC":
            bold = true;
            italic = true;
            break;
        default:
            bold = false;
            italic = false;
            break;
    }
    return new Style(color, backgroundColor, bold, italic, underline, strikeout);
}
Also used : Color(java.awt.Color) IStrategoAppl(org.spoofax.interpreter.terms.IStrategoAppl) IStyle(org.metaborg.core.style.IStyle) Style(org.metaborg.core.style.Style)

Aggregations

Color (java.awt.Color)1 IStyle (org.metaborg.core.style.IStyle)1 Style (org.metaborg.core.style.Style)1 IStrategoAppl (org.spoofax.interpreter.terms.IStrategoAppl)1