public FontProvider() { _fonts = new FontCollection(); if (Directory.Exists("data/fonts")) { foreach (var file in Directory.GetFiles("data/fonts")) { _fonts.Install(file); } } NotoSans = _fonts.Find("Noto Sans"); RankFontFamily = _fonts.Find("Whitney-Bold"); }
static Fonts() { var fonts = new FontCollection(); InstallFont(fonts, EmbeddedFonts.segoeui); // Segoe UI InstallFont(fonts, EmbeddedFonts.segoeuib); // Segoe UI - Bold InstallFont(fonts, EmbeddedFonts.segoeuil); // Segoe UI Light InstallFont(fonts, EmbeddedFonts.segoeuisl); // Segoe UI Semilight InstallFont(fonts, EmbeddedFonts.seguisb); // Segoe UI Semibold SegoeUi = fonts.Find("Segoe UI"); SegoeUiLight = fonts.Find("Segoe UI Light"); SegoeUiSemilight = fonts.Find("Segoe UI Semilight"); SegoeUiSemibold = fonts.Find("Segoe UI Semibold"); }
static Fonts() { var fonts = new FontCollection(); InstallFont(fonts, FontResources.segoeui); // Segoe UI InstallFont(fonts, FontResources.segoeuib); // Segoe UI - Bold InstallFont(fonts, FontResources.segoeuil); // Segoe UI Light InstallFont(fonts, FontResources.segoeuisl); // Segoe UI Semilight InstallFont(fonts, FontResources.seguisb); // Segoe UI Semibold InstallFont(fonts, FontResources.segoemdl2); // Material Icons SegoeUi = fonts.Find("Segoe UI"); SegoeUiLight = fonts.Find("Segoe UI Light"); SegoeUiSemilight = fonts.Find("Segoe UI Semilight"); SegoeUiSemibold = fonts.Find("Segoe UI Semibold"); SegoeMdl2 = fonts.Find("Segoe MDL2 Assets"); }
private DirectBitmap TakeScreenshot() { var(w, h) = (1280, 720); if (OSInfo.IsWindows) { var dd = DisplayInfo.PrimaryDisplayDimensions; (w, h) = (dd?.Width ?? 1280, dd?.Height ?? 720); } var screen = new DirectBitmap(w, h); if (OSInfo.IsWindows) { using var gScreen = Graphics.FromImage(screen.Bitmap); gScreen.CopyFromScreen(0, 0, 0, 0, screen.Bitmap.Size); return(screen); } // Unix & Docker version renders the Sun, since screen capture doesn't work there var now = _stopwatch.Elapsed.TotalSeconds; PointF Wave(double xRate, double yRate, double offset = 0) { var(hw, hh) = (w / 2f, h / 2f); var x = hw + hw * (float)Math.Sin(now * xRate + offset); var y = hh + hh * (float)Math.Cos(now * yRate + offset); return(new PointF(x, y)); } Point SunWave(double xRate, double yRate, double offset = 0) { var(hw, hh) = ((_sun.Width - w - 1) / 2f, (_sun.Height - h - 1) / 2f); var x = hw + hw * (float)Math.Sin(now * xRate + offset); var y = hh + hh * (float)Math.Cos(now * yRate + offset); return(new Point((int)-x, (int)-y)); } var image = screen.Image; var font = _fontCollection.Find("Open Sans").CreateFont(48); var options = new DrawingOptions() { GraphicsOptions = { Antialias = true }, TextOptions = { HorizontalAlignment = HorizontalAlignment.Center, VerticalAlignment = VerticalAlignment.Center, } }; var time = DateTime.Now.ToString("HH:mm:ss.fff"); image.Mutate(x => x .DrawImage(_sun, SunWave(0.01, 0.01), 1f) .DrawText(options, $"Time: {time}", font, Color.White, Wave(0.13, 0.17, -1))); return(screen); }
private void InitializeFonts() { _usernameFontFamily = _fonts.Find("Whitney-Bold"); _clubFontFamily = _fonts.Find("Whitney-Bold"); _levelFont = _fonts.Find("Whitney-Bold").CreateFont(45); _xpFont = _fonts.Find("Whitney-Bold").CreateFont(50); _awardedFont = _fonts.Find("Whitney-Bold").CreateFont(25); _rankFont = _fonts.Find("Uni Sans Thin CAPS").CreateFont(30); _timeFont = _fonts.Find("Whitney-Bold").CreateFont(20); }
public FontProvider() { _fonts = new FontCollection(); if (Directory.Exists("data/fonts")) { foreach (var file in Directory.GetFiles("data/fonts")) { _fonts.Install(file); } } ///UsernameFontFamily = _fonts.Find("Whitney-Bold"); ///ClubFontFamily = _fonts.Find("Whitney-Bold"); ///LevelFont = _fonts.Find("Whitney-Bold").CreateFont(45); ///XpFont = _fonts.Find("Whitney-Bold").CreateFont(50); ///AwardedFont = _fonts.Find("Whitney-Bold").CreateFont(25); ///RankFont = _fonts.Find("Uni Sans Thin CAPS").CreateFont(30); ///TimeFont = _fonts.Find("Whitney-Bold").CreateFont(20); ///RipNameFont = _fonts.Find("Whitney-Bold").CreateFont(20); NotoSans = _fonts.Find("Noto Sans"); RankFontFamily = _fonts.Find("Uni Sans Thin CAPS"); }
public FontProvider() { _fonts = new FontCollection(); if (Directory.Exists("data/fonts")) { foreach (var file in Directory.GetFiles("data/fonts")) { _fonts.Install(file); } } UsernameFontFamily = _fonts.Find("Whitney-Bold"); ClubFontFamily = _fonts.Find("Whitney-Bold"); LevelFont = _fonts.Find("Whitney-Bold").CreateFont(20); XpFont = _fonts.Find("Whitney-Bold").CreateFont(25); //AwardedFont = _fonts.Find("Whitney-Bold").CreateFont(25); RankFont = _fonts.Find("Whitney-Bold").CreateFont(20); TimeFont = _fonts.Find("Whitney-Bold").CreateFont(20); RipNameFont = _fonts.Find("Whitney-Bold").CreateFont(20); }
public void InitializeFonts() { _Meme = _fonts.Find("Impact").CreateFont(20); _Spoil = _fonts.Find("Whitney-Bold").CreateFont(40); _Spoiltxt = _fonts.Find("Whitney-Bold").CreateFont(18); }