Paradox Game Engine  v1.0.0 beta06
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Events Macros Pages
CharacterSpecification.cs
Go to the documentation of this file.
1 // Copyright (c) 2014 Silicon Studio Corp. (http://siliconstudio.co.jp)
2 // This file is distributed under GPL v3. See LICENSE.md for details.
3 
4 using System.Collections.Generic;
5 
6 using SiliconStudio.Core.Mathematics;
7 
8 namespace SiliconStudio.Paradox.Graphics.Font
9 {
10  /// <summary>
11  /// A character of a specific font with a specific size.
12  /// </summary>
13  internal class CharacterSpecification
14  {
15  public CharacterSpecification(char character, string fontName, Vector2 size, FontStyle style, FontAntiAliasMode antiAliasMode)
16  {
17  Character = character;
18  FontName = fontName;
19  Size = size;
20  Style = style;
21  AntiAlias = antiAliasMode;
22  ListNode = new LinkedListNode<CharacterSpecification>(this);
23  }
24 
25  /// <summary>
26  /// Name of a system (TrueType) font.
27  /// </summary>
28  public readonly string FontName;
29 
30  /// <summary>
31  /// Size of the TrueType fonts in pixels
32  /// </summary>
33  public readonly Vector2 Size;
34 
35  /// <summary>
36  /// Style for the font. 'regular', 'bold', 'italic', 'underline', 'strikeout'. Default is 'regular
37  /// </summary>
38  public readonly FontStyle Style;
39 
40  /// <summary>
41  /// The alias mode of the font
42  /// </summary>
43  public readonly FontAntiAliasMode AntiAlias;
44 
45  /// <summary>
46  /// The bitmap of the character
47  /// </summary>
48  public CharacterBitmap Bitmap;
49 
50  /// <summary>
51  /// The glyph of the character
52  /// </summary>
53  public readonly Glyph Glyph = new Glyph();
54 
55  /// <summary>
56  /// Indicate if the current <see cref="Font.Glyph.Subrect"/> and <see cref="Font.Glyph.BitmapIndex"/> data has been uploaded to the GPU or not.
57  /// </summary>
58  public bool IsBitmapUploaded;
59 
60  /// <summary>
61  /// The node of the least recently used (LRU) list.
62  /// </summary>
63  public LinkedListNode<CharacterSpecification> ListNode;
64 
65  /// <summary>
66  /// The index of the frame where the character has been used for the last time.
67  /// </summary>
68  public int LastUsedFrame;
69 
70  public char Character
71  {
72  get { return (char)Glyph.Character; }
73  set { Glyph.Character = value; }
74  }
75 
76  public override bool Equals(object obj)
77  {
78  return Equals(this, (CharacterSpecification)obj) ;
79  }
80 
81  public static bool Equals(CharacterSpecification left, CharacterSpecification right)
82  {
83  return left.Character == right.Character && left.FontName == right.FontName && left.Size == right.Size && left.Style == right.Style && left.AntiAlias == right.AntiAlias;
84  }
85 
86  public override int GetHashCode()
87  {
88  return Character.GetHashCode();
89  }
90  }
91 }
Represents a two dimensional mathematical vector.
Definition: Vector2.cs:42
SharpDX.DirectWrite.Font Font
FontAntiAliasMode
Available antialias mode.
SiliconStudio.Paradox.Graphics.Font.FontStyle FontStyle
_In_ size_t _In_ size_t size
Definition: DirectXTexP.h:175