LoadTarget.cs 3.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. #region MIT License
  2. /*Copyright (c) 2012 Robert Rouhani <robert.rouhani@gmail.com>
  3. SharpFont based on Tao.FreeType, Copyright (c) 2003-2007 Tao Framework Team
  4. Permission is hereby granted, free of charge, to any person obtaining a copy of
  5. this software and associated documentation files (the "Software"), to deal in
  6. the Software without restriction, including without limitation the rights to
  7. use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
  8. of the Software, and to permit persons to whom the Software is furnished to do
  9. so, subject to the following conditions:
  10. The above copyright notice and this permission notice shall be included in all
  11. copies or substantial portions of the Software.
  12. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  13. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  14. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  15. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  16. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  17. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  18. SOFTWARE.*/
  19. #endregion
  20. using System;
  21. namespace SharpFont
  22. {
  23. /// <summary><para>
  24. /// A list of values that are used to select a specific hinting algorithm to use by the hinter. You should OR one
  25. /// of these values to your ‘load_flags’ when calling <see cref="Face.LoadGlyph"/>.
  26. /// </para><para>
  27. /// Note that font's native hinters may ignore the hinting algorithm you have specified (e.g., the TrueType
  28. /// bytecode interpreter). You can set <see cref="LoadFlags.ForceAutohint"/> to ensure that the auto-hinter is
  29. /// used.
  30. /// </para><para>
  31. /// Also note that <see cref="LoadTarget.Light"/> is an exception, in that it always implies
  32. /// <see cref="LoadFlags.ForceAutohint"/>.
  33. /// </para></summary>
  34. /// <remarks><para>
  35. /// You should use only one of the <see cref="LoadTarget"/> values in your ‘load_flags’. They can't be ORed.
  36. /// </para><para>
  37. /// If <see cref="LoadFlags.Render"/> is also set, the glyph is rendered in the corresponding mode (i.e., the mode
  38. /// which matches the used algorithm best) unless <see cref="LoadFlags.Monochrome"/> is set.
  39. /// </para><para>
  40. /// You can use a hinting algorithm that doesn't correspond to the same rendering mode. As an example, it is
  41. /// possible to use the ‘light’ hinting algorithm and have the results rendered in horizontal LCD pixel mode, with
  42. /// code like:
  43. /// <code>
  44. /// FT_Load_Glyph( face, glyph_index,
  45. /// load_flags | FT_LOAD_TARGET_LIGHT );
  46. ///
  47. /// FT_Render_Glyph( face->glyph, FT_RENDER_MODE_LCD );
  48. /// </code>
  49. /// </para></remarks>
  50. public enum LoadTarget
  51. {
  52. /// <summary>
  53. /// This corresponds to the default hinting algorithm, optimized for standard gray-level rendering. For
  54. /// monochrome output, use <see cref="LoadTarget.Mono"/> instead.
  55. /// </summary>
  56. Normal = (RenderMode.Normal & 15) << 16,
  57. /// <summary><para>
  58. /// A lighter hinting algorithm for non-monochrome modes. Many generated glyphs are more fuzzy but better
  59. /// resemble its original shape. A bit like rendering on Mac OS X.
  60. /// </para><para>
  61. /// As a special exception, this target implies <see cref="LoadFlags.ForceAutohint"/>.
  62. /// </para></summary>
  63. Light = (RenderMode.Light & 15) << 16,
  64. /// <summary>
  65. /// Strong hinting algorithm that should only be used for monochrome output. The result is probably unpleasant
  66. /// if the glyph is rendered in non-monochrome modes.
  67. /// </summary>
  68. Mono = (RenderMode.Mono & 15) << 16,
  69. /// <summary>
  70. /// A variant of <see cref="LoadTarget.Normal"/> optimized for horizontally decimated LCD displays.
  71. /// </summary>
  72. Lcd = (RenderMode.Lcd & 15) << 16,
  73. /// <summary>
  74. /// A variant of <see cref="LoadTarget.Normal"/> optimized for vertically decimated LCD displays.
  75. /// </summary>
  76. VerticalLcd = (RenderMode.VerticalLcd & 15) << 16
  77. }
  78. }