-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathFontLibrary.IFont.cs
More file actions
57 lines (47 loc) · 2.21 KB
/
FontLibrary.IFont.cs
File metadata and controls
57 lines (47 loc) · 2.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
using System.Collections.Generic;
using Microsoft.Xna.Framework;
using System;
using Microsoft.Xna.Framework.Graphics;
namespace FNT
{
public partial class FontLibrary
{
/// <summary>
/// Represents a configuration of a given font face with a specific size.
/// </summary>
public interface IFont : IDisposable
{
/// <summary>The character to render in the event that a given character is not found in the font</summary>
char? DefaultCharacter { get; set; }
/// <summary>The nominal height of one line of text</summary>
int LineHeight { get; }
/// <summary>Font Face size</summary>
int Size { get; }
/// <summary>How many spaces should be advanced for one occurrence of the '\t' character</summary>
int TabSpaces { get; set; }
/// <summary> Create a text object that can be rendered or measured</summary>
/// <param name="text">The string to convert into a text object</param>
IText MakeText(string text);
/// <summary>Render all given characters to the internal glyph cache</summary>
/// <param name="chars">Characters to precache</param>
void PreheatCache(IEnumerable<char> chars);
}
/// <summary>Represents an object that can be rendered as text</summary>
public interface IText
{
/// <summary>Width of the given string</summary>
float Width { get; }
/// <summary>Height of the given string</summary>
float Height { get; }
/// <summary>The string that produced this text object</summary>
string String { get; }
/// <summary>
/// Render this text with the given SpriteBatch
/// </summary>
/// <param name="spriteBatch">SpriteBatch to render to</param>
/// <param name="position">Position at which to render the text</param>
/// <param name="color">Color to render the text with</param>
void Draw(SpriteBatch spriteBatch, Vector2 position, Color color);
}
}
}