static void configContext(Context2d ctx, TextFormat format) { Font font = getFont(format); String style = ""; switch (font.style()) { case BOLD: style = "bold"; break; case ITALIC: style = "italic"; break; case BOLD_ITALIC: style = "bold italic"; break; default: break; // nada } ctx.setFont(style + " " + font.size() + "px " + font.name()); ctx.setTextBaseline(Context2d.TextBaseline.TOP); }