void CompilePreviewPages(System.Drawing.Printing.PrintPageEventArgs e) { Application.DoEvents(); Font printFont = FontProvider.GetFont(document.Cpi); string source = document.ToString(fromPage); System.IO.StringReader sr = new System.IO.StringReader(source); float height = e.MarginBounds.Height / document.PageHeight; float leftMargin = e.MarginBounds.Left; float topMargin = e.MarginBounds.Top; float yPos = topMargin; while (true) { string line = sr.ReadLine(); if (line != null) { e.Graphics.DrawString(line, printFont, Brushes.Black, leftMargin, yPos); //yPos += (printFont.GetHeight(e.Graphics)-3); yPos += height; } else { break; } } e.HasMorePages = ++fromPage < document.Count; printFont.Dispose(); sr.Close(); sr.Dispose(); }
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))); } }
protected GameViewBase(ILog log, FontTarget font = FontTarget.Interface) : base( log, FontProvider.GetScreenWidth(font), FontProvider.GetScreenHeight(font), FontProvider.GetFont(font)) { }
public static void LoadContent(ContentManager content) { FontProvider.AddFont("Mono14", content.Load <SpriteFont>(@"fonts/mono14")); FontProvider.AddFont("Mono8", content.Load <SpriteFont>(@"fonts/mono8")); FontProvider.AddFont("Mono21", content.Load <SpriteFont>(@"fonts/mono21")); Titlescreen.TitleTexture = content.Load <Texture2D>(@"textures/titlescreen"); new TileMap <Map <TileCode>, TileCode>(8, 8, 0, FontProvider.GetFont("Mono8"), content.Load <Texture2D>(@"textures/spritesheets/tilesheet"), 3); BulletInformationProvider.LoadBulletData(content); AnimationDictionaryProvider.Content = content; }
public override void Draw(SpriteBatch spriteBatch) { base.Draw(spriteBatch); spriteBatch.DrawString( FontProvider.GetFont(fontName), confirmText + GameVariableProvider.SaveState.PlayerName + "?", ShortcutProvider.Vector2Point(menuItems[0].ItemPosition - itemOffset - new Vector2(ShortcutProvider.GetFontCenter(fontName, confirmText + GameVariableProvider.SaveState.PlayerName + "?").X, 0)), Color.White, 0, Vector2.Zero, 1, SpriteEffects.None, .2f); }
void CompilePreviewPagesEx(System.Drawing.Printing.PrintPageEventArgs e) { Application.DoEvents(); float height = e.MarginBounds.Height / document.PageHeight; float leftMargin = e.MarginBounds.Left; float topMargin = e.MarginBounds.Top; float yPos = topMargin; Font printFont = FontProvider.GetFont(document.Cpi); ClassicReportPage page = document[fromPage]; for (int rowIndex = 0; rowIndex < document.PageHeight; rowIndex++) { string rowString = page.ToString(rowIndex); rowString = rowString.Replace(' ', 'M'); foreach (ClassicReportPageItem item in page.GetItems(rowIndex)) { float xPos = leftMargin; if (item.Offset > 0) { string trailer = rowString.Substring(0, item.Offset - 1); xPos += e.Graphics.MeasureString(trailer, printFont).Width; } FontStyle fontStyle = FontStyle.Regular; if (item.IsBold) { fontStyle |= FontStyle.Bold; } if (item.IsItalic) { fontStyle |= FontStyle.Italic; } if (item.IsUnderline) { fontStyle |= FontStyle.Underline; } Font itemFont = new Font(printFont, fontStyle); e.Graphics.DrawString(item.Value, itemFont, Brushes.Black, xPos, yPos); itemFont.Dispose(); } yPos += height; } e.HasMorePages = ++fromPage <= toPage; printFont.Dispose(); }
public override void Draw(SpriteBatch spriteBatch) { if (Confirmation) { confirmDialog.Draw(spriteBatch); return; } base.Draw(spriteBatch); spriteBatch.DrawString( FontProvider.GetFont(fontName), TextBuffer, ShortcutProvider.Vector2Point(menuLabels[0].Position + new Vector2(FontProvider.GetFont(fontName).MeasureString(menuLabels[0].Text).X + 14, 0)), Color.White, 0, Vector2.Zero, 1, SpriteEffects.None, .2f); }
protected override void Draw() { base.Draw(); _spriteBatch.Begin(); _spriteBatch.DrawString(Editor.Font, "Hello World", new Vector2(150, 150), Color.White); _spriteBatch.End(); return; GraphicsDevice.SetRenderTarget(_renderTarget); GraphicsDevice.Viewport = _standardViewport; GraphicsDevice.Clear(Color.Black); _spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp, null, null); if (!MapLoaded) { _spriteBatch.DrawString(FontProvider.GetFont("Mono8"), "Please load a map.", ShortCuts.ScreenCenter - ShortCuts.GetFontCenter("Mono8", "Please load a map."), Color.Green); } else if (DrawAll) { TileMap.Draw(); } else { TileMap.Draw(Layer); } EntityManager.Draw(); _bulletManager.Draw(); _spriteBatch.End(); DrawHelper.Draw(); GraphicsDevice.SetRenderTarget(null); GraphicsDevice.Viewport = _renderViewport; GraphicsDevice.Clear(Color.LightBlue); _spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp, null, null); _spriteBatch.Draw(_renderTarget, new Rectangle(0, 0, _renderViewport.Width, _renderViewport.Height), Color.White); _spriteBatch.End(); }
public MenuItem(string itemName, string fontName, bool isSelected, Color selectedColor, Color unSelectedColor) : this(itemName, Vector2.Zero, isSelected, FontProvider.GetFont(fontName)) { SelectedColor = selectedColor; UnSelectedcolor = unSelectedColor; }
public MenuItem(string itemName, string fontName, bool isSelected) : this(itemName, Vector2.Zero, isSelected, FontProvider.GetFont(fontName)) { }
public MenuItem(string itemName, string fontName) : this(itemName, Vector2.Zero, false, FontProvider.GetFont(fontName)) { }
public MenuItem(string itemName) : this(itemName, Vector2.Zero, false, FontProvider.GetFont("Pericles14")) { }
public MenuItem(string itemName, Vector2 itemPosition) : this(itemName, itemPosition, false, FontProvider.GetFont("Pericles14")) { }
public MenuLabel(string text, string fontName) { Text = text; font = FontProvider.GetFont(fontName); }
public MenuLabel(string text, string fontName) { _spriteBatch = VariableProvider.SpriteBatch; Text = text; _font = FontProvider.GetFont(fontName); }
public static void Initialize() { font = FontProvider.GetFont("Mono14"); }
public IntPtr GetFont(string fontFile, int fontSize) => FontProvider.GetFont(fontFile, fontSize);
private DialogManager() { _spriteBatch = VariableProvider.SpriteBatch; _font = FontProvider.GetFont("Mono14"); }