public void CanLoadAllNecessaryFonts() { var fontProvider = new FontProvider(); foreach (var fontName in _fontNames) { Assert.NotNull(fontProvider.GetFontFamily(fontName)); } foreach (var fontName in _fontNames) { Assert.NotNull(fontProvider.GetFont(fontName, FontSize.FromPixels(23))); } foreach (var fontName in _fontNames) { Assert.NotNull(fontProvider.GetFont(fontProvider.GetFontFamily(fontName), FontSize.FromPixels(23))); } }
public override void DoCommand(IImageRender imageRender) { var text = PreproccessText(_args["@main_argument"]); var fontSize = int.Parse(_args["fontSize"]); var font = _serviceProvider.GetService <IFontProvider>().GetFont("PF Agora Slab Pro Medium", FontSize.FromPixels(fontSize)); var x = int.Parse(_args["x"]); var y = int.Parse(_args["y"]); var alignment = TextAlignment.Left; switch (_args["align"]) { case "left": alignment = TextAlignment.Left; break; case "center": alignment = TextAlignment.Center; break; case "right": alignment = TextAlignment.Right; break; } imageRender.DrawString(text, font, Color.Black, x, y, alignment); }
private Font GetDefaultFont(float fontSize) { return(_fontProvider.GetFont("PF Agora Slab Pro Medium", FontSize.FromPixels(fontSize))); }
private Font GetQuoteFont(float fontSize) { return(_fontProvider.GetFont("Carefree Cyrillic", FontSize.FromPixels(fontSize))); }
private Font GetFontForWeather(float fontSize) { return(_fontProvider.GetFont("Collect Em All BB(RUS BY LYAJKA", FontSize.FromPixels(fontSize))); }