PageRenderTime 51ms CodeModel.GetById 21ms RepoModel.GetById 0ms app.codeStats 0ms

/Utilities/Graphics/FontStyle.cs

#
C# | 100 lines | 19 code | 11 blank | 70 comment | 0 complexity | 631f2c0c68dc9e78ff0351cc701992a0 MD5 | raw file
Possible License(s): Apache-2.0
  1. using System;
  2. namespace Delta.Utilities.Graphics
  3. {
  4. /// <summary>
  5. /// Font style for the font creation process, allows us to add shadow
  6. /// to the font, create an outline, use italic or bold text plus
  7. /// specifying anti aliasing. Combine these with or and pass them to
  8. /// FontGenerator.GenerateFont, but also used for creating and loading
  9. /// fonts to make sure we got the correct style.
  10. /// </summary>
  11. [Flags]
  12. public enum FontStyle
  13. {
  14. /// <summary>
  15. /// Normal is probably used by most fonts, just renders the font out
  16. /// and uses anti aliasing, no bold, no italic, no shadow and no outline.
  17. /// </summary>
  18. Normal = 0,
  19. /// <summary>
  20. /// Use italic (works only if the font has it), not used often.
  21. /// </summary>
  22. Italic = 1,
  23. /// <summary>
  24. /// Make font bold (works only if font supports this).
  25. /// </summary>
  26. Bold = 2,
  27. /// <summary>
  28. /// Add underline to the font (works only if font supports this).
  29. /// Note: This may look strange with some other effects (like shadow or
  30. /// outline) because this is not supported well and probably needs some
  31. /// fixing when rending the font.
  32. /// </summary>
  33. Underline = 4,
  34. /// <summary>
  35. /// Add shadow to the font, usually makes the font a little bigger
  36. /// to fit the shadow (which is just the font again painted in black
  37. /// with a 10% distance into the bottom right, rendered before the
  38. /// actual white font).
  39. /// </summary>
  40. AddShadow = 8,
  41. /// <summary>
  42. /// Add a black outline to the font, currently does not work well,
  43. /// especially for big fonts. Small fonts look ok. This will add some
  44. /// spacing (2px) around the font to allow an artist to add outlines
  45. /// himself if he isn't pleased with the generated texture.
  46. /// </summary>
  47. AddOutline = 16,
  48. /// <summary>
  49. /// Increase the contrast of the font rendering to its maximum value.
  50. /// This can be used the font is too blurry otherwise. Should not be
  51. /// used with NoAntiAliasing, this would not affect SingleBitPerPixel.
  52. /// </summary>
  53. HighContrast = 32,
  54. /// <summary>
  55. /// Decrease the contrast to a very low setting to make the font look more
  56. /// smooth. You should only use this for big fonts and if you think the
  57. /// font is too sharp. Should not be used with NoAntiAliasing, this would
  58. /// not affect SingleBitPerPixel rendering. Do not use together with
  59. /// HighContrast, then this setting will be ignored.
  60. /// </summary>
  61. LowContrast = 64,
  62. /// <summary>
  63. /// Instead of using the default anti aliasing (which uses
  64. /// TextRenderingHint.AntiAliasGridFit) use
  65. /// TextRenderingHint.AntiAlias (no grid fit), which produces very different
  66. /// different results on small fonts, which are usually very sharp with the
  67. /// default settings (makes sense). However if you want smooth fonts and
  68. /// ClearTypeAntiAliasing is too much, use this setting.
  69. /// </summary>
  70. SmoothAntiAliasing = 128,
  71. /// <summary>
  72. /// Disable anti aliasing (uses TextRenderingHint.SingleBitPerPixel),
  73. /// should not be necessary, even small fonts look ok with anti aliasing.
  74. /// Note: Do not use together with ClearTypeAntiAliasing, then
  75. /// this setting will be ignored (then Clear Type Anti aliasing will be
  76. /// still on, this only disables the default Anti aliasing).
  77. /// </summary>
  78. NoAntiAliasing = 256,
  79. /// <summary>
  80. /// Instead of using the default anti aliasing (which uses
  81. /// TextRenderingHint.AntiAliasGridFit) use
  82. /// TextRenderingHint.ClearTypeGridFit, which might produce slightly
  83. /// different results depending if the font and system support clear type.
  84. /// Sometimes produces less sharp fonts so this is not the default and the
  85. /// difference can usually be neglected.
  86. /// </summary>
  87. ClearTypeAntiAliasing = 512,
  88. }
  89. }