LoadFlags.cs 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178
  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>
  24. /// A list of bit-field constants used with <see cref="Face.LoadGlyph"/> to indicate what kind of operations to
  25. /// perform during glyph loading.
  26. /// </summary>
  27. /// <remarks><para>
  28. /// By default, hinting is enabled and the font's native hinter (see <see cref="FaceFlags.Hinter"/>) is preferred
  29. /// over the auto-hinter. You can disable hinting by setting <see cref="LoadFlags.NoHinting"/> or change the
  30. /// precedence by setting <see cref="LoadFlags.ForceAutohint"/>. You can also set
  31. /// <see cref="LoadFlags.NoAutohint"/> in case you don't want the auto-hinter to be used at all.
  32. /// </para><para>
  33. /// See the description of <see cref="FaceFlags.Tricky"/> for a special exception (affecting only a handful of
  34. /// Asian fonts).
  35. /// </para><para>
  36. /// Besides deciding which hinter to use, you can also decide which hinting algorithm to use. See
  37. /// <see cref="LoadTarget"/> for details.
  38. /// </para></remarks>
  39. [Flags]
  40. [CLSCompliant(false)]
  41. public enum LoadFlags : uint
  42. {
  43. /// <summary>
  44. /// Corresponding to 0, this value is used as the default glyph load operation. In this case, the following
  45. /// happens:
  46. /// <list type="number">
  47. /// <item><description>
  48. /// FreeType looks for a bitmap for the glyph corresponding to the face's current size. If one is found, the
  49. /// function returns. The bitmap data can be accessed from the glyph slot (see note below).
  50. /// </description></item>
  51. /// <item><description>
  52. /// If no embedded bitmap is searched or found, FreeType looks for a scalable outline. If one is found, it is
  53. /// loaded from the font file, scaled to device pixels, then ‘hinted’ to the pixel grid in order to optimize
  54. /// it. The outline data can be accessed from the glyph slot (see note below).
  55. /// </description></item>
  56. /// </list>
  57. /// Note that by default, the glyph loader doesn't render outlines into bitmaps. The following flags are used
  58. /// to modify this default behaviour to more specific and useful cases.
  59. /// </summary>
  60. Default = 0x0000,
  61. /// <summary><para>
  62. /// Don't scale the outline glyph loaded, but keep it in font units.
  63. /// </para><para>
  64. /// This flag implies <see cref="LoadFlags.NoHinting"/> and <see cref="LoadFlags.NoBitmap"/>, and unsets
  65. /// <see cref="LoadFlags.Render"/>.
  66. /// </para></summary>
  67. NoScale = 0x0001,
  68. /// <summary><para>
  69. /// Disable hinting. This generally generates ‘blurrier’ bitmap glyph when the glyph is rendered in any of the
  70. /// anti-aliased modes. See also the note below.
  71. /// </para><para>
  72. /// This flag is implied by <see cref="LoadFlags.NoScale"/>.
  73. /// </para></summary>
  74. NoHinting = 0x0002,
  75. /// <summary><para>
  76. /// Call <see cref="GlyphSlot.RenderGlyph"/> after the glyph is loaded. By default, the glyph is rendered in
  77. /// <see cref="RenderMode.Normal"/> mode. This can be overridden by <see cref="LoadTarget"/> or
  78. /// <see cref="LoadFlags.Monochrome"/>.
  79. /// </para><para>
  80. /// This flag is unset by <see cref="LoadFlags.NoScale"/>.
  81. /// </para></summary>
  82. Render = 0x0004,
  83. /// <summary><para>
  84. /// Ignore bitmap strikes when loading. Bitmap-only fonts ignore this flag.
  85. /// </para><para>
  86. /// <see cref="LoadFlags.NoScale"/> always sets this flag.
  87. /// </para></summary>
  88. NoBitmap = 0x0008,
  89. /// <summary>
  90. /// Load the glyph for vertical text layout. Don't use it as it is problematic currently.
  91. /// </summary>
  92. VerticalLayout = 0x0010,
  93. /// <summary>
  94. /// Indicates that the auto-hinter is preferred over the font's native hinter. See also the note below.
  95. /// </summary>
  96. ForceAutohint = 0x0020,
  97. /// <summary>
  98. /// Indicates that the font driver should crop the loaded bitmap glyph (i.e., remove all space around its black
  99. /// bits). Not all drivers implement this.
  100. /// </summary>
  101. CropBitmap = 0x0040,
  102. /// <summary>
  103. /// Indicates that the font driver should perform pedantic verifications during glyph loading. This is mostly
  104. /// used to detect broken glyphs in fonts. By default, FreeType tries to handle broken fonts also.
  105. /// </summary>
  106. Pedantic = 0x0080,
  107. /// <summary>
  108. /// Ignored. Deprecated.
  109. /// </summary>
  110. IgnoreGlobalAdvanceWidth = 0x0200,
  111. /// <summary><para>
  112. /// This flag is only used internally. It merely indicates that the font driver should not load composite
  113. /// glyphs recursively. Instead, it should set the ‘num_subglyph’ and ‘subglyphs’ values of the glyph slot
  114. /// accordingly, and set ‘glyph->format’ to <see cref="GlyphFormat.Composite"/>.
  115. /// </para><para>
  116. /// The description of sub-glyphs is not available to client applications for now.
  117. /// </para><para>
  118. /// This flag implies <see cref="LoadFlags.NoScale"/> and <see cref="LoadFlags.IgnoreTransform"/>.
  119. /// </para></summary>
  120. NoRecurse = 0x0400,
  121. /// <summary>
  122. /// Indicates that the transform matrix set by <see cref="Face.SetTransform"/> should be ignored.
  123. /// </summary>
  124. IgnoreTransform = 0x0800,
  125. /// <summary><para>
  126. /// This flag is used with <see cref="LoadFlags.Render"/> to indicate that you want to render an outline glyph
  127. /// to a 1-bit monochrome bitmap glyph, with 8 pixels packed into each byte of the bitmap data.
  128. /// </para><para>
  129. /// Note that this has no effect on the hinting algorithm used. You should rather use
  130. /// <see cref="LoadTarget.Mono"/> so that the monochrome-optimized hinting algorithm is used.
  131. /// </para></summary>
  132. Monochrome = 0x1000,
  133. /// <summary>
  134. /// Indicates that the ‘linearHoriAdvance’ and ‘linearVertAdvance’ fields of <see cref="GlyphSlot"/> should be
  135. /// kept in font units. See <see cref="GlyphSlot"/> for details.
  136. /// </summary>
  137. LinearDesign = 0x2000,
  138. /// <summary>
  139. /// Disable auto-hinter. See also the note below.
  140. /// </summary>
  141. NoAutohint = 0x8000,
  142. /// <summary><para>
  143. /// A bit-flag to be OR-ed with the ‘flags’ parameter of the <see cref="Face.GetAdvance"/> and
  144. /// <see cref="Face.GetAdvances"/> functions.
  145. /// </para><para>
  146. /// If set, it indicates that you want these functions to fail if the corresponding hinting mode or font driver
  147. /// doesn't allow for very quick advance computation.
  148. /// </para><para>
  149. /// Typically, glyphs which are either unscaled, unhinted, bitmapped, or light-hinted can have their advance
  150. /// width computed very quickly.
  151. /// </para><para>
  152. /// Normal and bytecode hinted modes, which require loading, scaling, and hinting of the glyph outline, are
  153. /// extremely slow by comparison.
  154. /// </para></summary>
  155. AdvanceFlagFastOnly = 0x20000000
  156. }
  157. }