use of pl.asie.charset.module.tablet.format.words.text.StylePrinterTextFormat in project Charset by CharsetMC.
the class CharsetTablet method onInit.
@Mod.EventHandler
public void onInit(FMLInitializationEvent event) {
ICommand spaceCommand = ((typesetter, tokenizer) -> typesetter.write(new WordText(" ")));
TabletAPI.INSTANCE.registerRouter(new RouterIndex());
TabletAPI.INSTANCE.registerRouter(new RouterSearch());
TabletAPI.INSTANCE.registerRouter(new RouterModDocumentation("charset", "Book - Charset"));
TabletAPI.INSTANCE.addBook("Book of Charset", "mod://charset/index");
if (Loader.isModLoaded("simplelogic")) {
TabletAPI.INSTANCE.registerRouter(new RouterModDocumentation("simplelogic", "Book - SimpleLogic"));
TabletAPI.INSTANCE.addBook("The Rules of SimpleLogic", "mod://simplelogic/index");
}
TabletAPI.INSTANCE.registerCommand("\\", spaceCommand);
TabletAPI.INSTANCE.registerCommand("\\ ", spaceCommand);
TabletAPI.INSTANCE.registerCommand("\\nl", ((typesetter, tokenizer) -> typesetter.write(new WordNewline(1))));
TabletAPI.INSTANCE.registerCommand("\\p", ((typesetter, tokenizer) -> typesetter.write(new WordNewline(2))));
TabletAPI.INSTANCE.registerCommand("\\\\", (((typesetter, tokenizer) -> typesetter.write(new WordText("\\")))));
TabletAPI.INSTANCE.registerCommand("\\-", (((typesetter, tokenizer) -> {
String padS = tokenizer.getOptionalParameter();
typesetter.write(new WordBullet(padS != null ? Integer.parseInt(padS) : 0));
})));
TabletAPI.INSTANCE.registerCommand("\\scale", ((typesetter, tokenizer) -> {
String scaleS = tokenizer.getParameter("\\scale scaling amount");
String content = tokenizer.getParameter("\\scale content");
typesetter.pushStyle(new StyleScale(Float.parseFloat(scaleS)));
typesetter.write(content);
typesetter.popStyle(1);
}));
TabletAPI.INSTANCE.registerCommand("\\local", ((typesetter, tokenizer) -> typesetter.write(new WordTextLocalized(tokenizer.getParameter("text")))));
TabletAPI.INSTANCE.registerCommand("\\title", ((typesetter, tokenizer) -> {
typesetter.pushStyle(StyleFormat.ITALIC, StyleFormat.UNDERLINE, new StyleScale(2.0f));
typesetter.write(tokenizer.getParameter("text"));
typesetter.popStyle(3);
}));
TabletAPI.INSTANCE.registerCommand("\\header", ((typesetter, tokenizer) -> {
typesetter.pushStyle(StyleFormat.BOLD, StyleFormat.UNDERLINE);
typesetter.write(tokenizer.getParameter("text"));
typesetter.popStyle(2);
}));
TabletAPI.INSTANCE.registerCommand("\\b", ((typesetter, tokenizer) -> {
typesetter.pushStyle(StyleFormat.BOLD);
typesetter.write(tokenizer.getParameter("text"));
typesetter.popStyle();
}));
TabletAPI.INSTANCE.registerCommand("\\i", ((typesetter, tokenizer) -> {
typesetter.pushStyle(StyleFormat.ITALIC);
typesetter.write(tokenizer.getParameter("text"));
typesetter.popStyle();
}));
TabletAPI.INSTANCE.registerCommand("\\u", ((typesetter, tokenizer) -> {
typesetter.pushStyle(StyleFormat.UNDERLINE);
typesetter.write(tokenizer.getParameter("text"));
typesetter.popStyle();
}));
TabletAPI.INSTANCE.registerCommand("\\del", ((typesetter, tokenizer) -> {
typesetter.pushStyle(StyleFormat.STRIKETHROUGH);
typesetter.write(tokenizer.getParameter("text"));
typesetter.popStyle();
}));
TabletAPI.INSTANCE.registerCommand("\\checkmods", new CommandCheckMods());
TabletAPI.INSTANCE.registerCommand("\\img", new CommandImg());
TabletAPI.INSTANCE.registerCommand("\\item", new CommandItem());
TabletAPI.INSTANCE.registerCommand("\\url", new CommandURL());
TabletAPI.INSTANCE.registerCommand("\\urlmissing", new CommandURLMissing());
for (TextPrinterFormat format : TextPrinterFormat.values()) {
TabletAPI.INSTANCE.registerPrinterStyle(format, StyleFormat.class, new StylePrinterTextFormat(format));
}
TabletAPI.INSTANCE.registerPrinterText(TextPrinterFormat.HTML, WordText.class, (c, w) -> ((WordText) w).getText());
}
Aggregations