diff --git a/.gitmodules b/.gitmodules index 3048e4eee1..915a6b5915 100644 --- a/.gitmodules +++ b/.gitmodules @@ -6,7 +6,3 @@ path = externals/depot_tools url = https://chromium.googlesource.com/chromium/tools/depot_tools.git branch = master -[submodule "docs"] - path = docs - url = https://github.com/mono/SkiaSharp-API-docs - branch = master diff --git a/benchmarks/SkiaSharp.Benchmarks/SkiaSharp.Benchmarks.csproj b/benchmarks/SkiaSharp.Benchmarks/SkiaSharp.Benchmarks.csproj index c71f6dfa9f..f9891b84e6 100644 --- a/benchmarks/SkiaSharp.Benchmarks/SkiaSharp.Benchmarks.csproj +++ b/benchmarks/SkiaSharp.Benchmarks/SkiaSharp.Benchmarks.csproj @@ -6,7 +6,6 @@ SkiaSharp.Benchmarks SkiaSharp.Benchmarks true - true pdbonly true diff --git a/binding/HarfBuzzSharp/Blob.cs b/binding/HarfBuzzSharp/Blob.cs index 12888988c0..06fc3ae510 100644 --- a/binding/HarfBuzzSharp/Blob.cs +++ b/binding/HarfBuzzSharp/Blob.cs @@ -5,10 +5,16 @@ namespace HarfBuzzSharp { + /// + /// Represents a blob of data in memory. + /// public unsafe class Blob : NativeObject { private static readonly Lazy emptyBlob = new Lazy (() => new StaticBlob (HarfBuzzApi.hb_blob_get_empty ())); + /// + /// Gets a reference to the empty instance. + /// public static Blob Empty => emptyBlob.Value; internal Blob (IntPtr handle) @@ -16,11 +22,30 @@ internal Blob (IntPtr handle) { } + /// + /// Creates a new instance, wrapping the specified data. + /// + /// The data to wrap. + /// The length of the data being wrapped. + /// The memory mode to use. + /// + /// If there was a problem creating the blob, or if the data length was zero, then an empty blob will be created. + /// public Blob (IntPtr data, int length, MemoryMode mode) : this (data, length, mode, null) { } + /// + /// Creates a new instance, wrapping the specified data. + /// + /// The data to wrap. + /// The length of the data being wrapped. + /// The memory mode to use. + /// The delegate to invoke when the data is not needed anymore. + /// + /// If there was a problem creating the blob, or if the data length was zero, then an empty blob will be created. + /// public Blob (IntPtr data, int length, MemoryMode mode, ReleaseDelegate releaseDelegate) : this (Create (data, length, mode, releaseDelegate)) { @@ -36,14 +61,33 @@ protected override void DisposeHandler () } } + /// + /// Gets the length of blob data in bytes. + /// public int Length => (int)HarfBuzzApi.hb_blob_get_length (Handle); + /// + /// Gets the number of faces in this blob. + /// public int FaceCount => (int)HarfBuzzApi.hb_face_count (Handle); + /// + /// Gets the value indicating whether the blob is immutable. + /// public bool IsImmutable => HarfBuzzApi.hb_blob_is_immutable (Handle); + /// + /// Makes the blob immutable. + /// public void MakeImmutable () => HarfBuzzApi.hb_blob_make_immutable (Handle); + /// + /// Returns a stream that wraps the data. + /// + /// Returns the stream that wraps the data. + /// + /// If the data is released, then the stream becomes invalid. + /// public unsafe Stream AsStream () { uint length; @@ -51,6 +95,13 @@ public unsafe Stream AsStream () return new UnmanagedMemoryStream ((byte*)dataPtr, length); } + /// + /// Returns a span that wraps the data. + /// + /// Returns the span that wraps the data. + /// + /// If the data is released, then the span becomes invalid. + /// public unsafe Span AsSpan () { uint length; @@ -58,6 +109,11 @@ public unsafe Span AsSpan () return new Span (dataPtr, (int)length); } + /// + /// Creates a new instance from the contents of the file. + /// + /// The path to the file to load. + /// Returns the new instance. public static Blob FromFile (string fileName) { if (!File.Exists (fileName)) { @@ -68,6 +124,11 @@ public static Blob FromFile (string fileName) return new Blob (blob); } + /// + /// Creates a new instance from the contents of the stream. + /// + /// The stream to use. + /// Returns the new instance. public static unsafe Blob FromStream (Stream stream) { // TODO: check to see if we can avoid the second copy (the ToArray) diff --git a/binding/HarfBuzzSharp/Buffer.cs b/binding/HarfBuzzSharp/Buffer.cs index f34c24b139..f947b44c20 100644 --- a/binding/HarfBuzzSharp/Buffer.cs +++ b/binding/HarfBuzzSharp/Buffer.cs @@ -7,6 +7,9 @@ namespace HarfBuzzSharp { + /// + /// Represents a text buffer in memory. + /// public unsafe class Buffer : NativeObject { public const int DefaultReplacementCodepoint = '\uFFFD'; @@ -16,6 +19,9 @@ internal Buffer (IntPtr handle) { } + /// + /// Creates a new with default values. + /// public Buffer () : this (HarfBuzzApi.hb_buffer_create ()) { @@ -26,6 +32,12 @@ public ContentType ContentType { set => HarfBuzzApi.hb_buffer_set_content_type (Handle, value); } + /// + /// Get or sets the text flow direction of the buffer. + /// + /// + /// No shaping can happen without setting the direction, or invoking . + /// public Direction Direction { get => HarfBuzzApi.hb_buffer_get_direction (Handle); set => HarfBuzzApi.hb_buffer_set_direction (Handle, value); @@ -61,6 +73,12 @@ public Script Script { set => HarfBuzzApi.hb_buffer_set_script (Handle, value); } + /// + /// Gets or sets the size of the buffer. + /// + /// + /// If the new length is greater that the current length, more memory will be allocated. If the new length is less than the current length, the extra items will be cleared. + /// public int Length { get => (int)HarfBuzzApi.hb_buffer_get_length (Handle); set => HarfBuzzApi.hb_buffer_set_length (Handle, (uint)value); @@ -71,6 +89,12 @@ public UnicodeFunctions UnicodeFunctions { set => HarfBuzzApi.hb_buffer_set_unicode_funcs (Handle, value.Handle); } + /// + /// Gets the buffer glyph information array. + /// + /// + /// The information is valid as long as buffer contents are not modified. + /// public GlyphInfo[] GlyphInfos { get { var array = GetGlyphInfoSpan ().ToArray (); @@ -79,6 +103,12 @@ public GlyphInfo[] GlyphInfos { } } + /// + /// Gets the buffer glyph position array. + /// + /// + /// The positions are valid as long as buffer contents are not modified. + /// public GlyphPosition[] GlyphPositions { get { var array = GetGlyphPositionSpan ().ToArray (); @@ -89,6 +119,14 @@ public GlyphPosition[] GlyphPositions { public void Add (int codepoint, int cluster) => Add ((uint)codepoint, (uint)cluster); + /// + /// Appends a character with the Unicode value and gives it the initial cluster value. + /// + /// The Unicode code point. + /// The cluster value of the code point. + /// + /// This function does not check the validity of the codepoint. + /// public void Add (uint codepoint, uint cluster) { if (Length != 0 && ContentType != ContentType.Unicode) @@ -99,8 +137,16 @@ public void Add (uint codepoint, uint cluster) HarfBuzzApi.hb_buffer_add (Handle, codepoint, cluster); } + /// + /// Appends the specified text to the buffer. + /// + /// The array of UTF-8 characters to append. public void AddUtf8 (string utf8text) => AddUtf8 (Encoding.UTF8.GetBytes (utf8text), 0, -1); + /// + /// Appends the specified text bytes to the buffer. + /// + /// The array of UTF-8 character bytes to append. public void AddUtf8 (byte[] bytes) => AddUtf8 (new ReadOnlySpan (bytes)); public void AddUtf8 (ReadOnlySpan text) => AddUtf8 (text, 0, -1); @@ -208,6 +254,13 @@ public void AddUtf32 (IntPtr text, int textLength, int itemOffset, int itemLengt HarfBuzzApi.hb_buffer_add_utf32 (Handle, (uint*)text, textLength, (uint)itemOffset, itemLength); } + /// + /// Appends characters from the span to the buffer. + /// + /// The span of Unicode code points to append. + /// + /// This function does not check the validity of the characters. + /// public void AddCodepoints (ReadOnlySpan text) => AddCodepoints (text, 0, -1); public unsafe void AddCodepoints (ReadOnlySpan text, int itemOffset, int itemLength) @@ -254,6 +307,9 @@ public unsafe ReadOnlySpan GetGlyphPositionSpan () return new ReadOnlySpan (infoPtrs, (int)length); } + /// + /// Sets the unset buffer segment properties based on the buffer's Unicode contents. + /// public void GuessSegmentProperties () { if (ContentType != ContentType.Unicode) @@ -262,6 +318,12 @@ public void GuessSegmentProperties () HarfBuzzApi.hb_buffer_guess_segment_properties (Handle); } + /// + /// Clears the buffer's contents. + /// + /// + /// This operation preserves the Unicode functions and replacement code point. + /// public void ClearContents () => HarfBuzzApi.hb_buffer_clear_contents (Handle); public void Reset () => HarfBuzzApi.hb_buffer_reset (Handle); diff --git a/binding/HarfBuzzSharp/Definitions.cs b/binding/HarfBuzzSharp/Definitions.cs index a1d61ba642..ec037808fa 100644 --- a/binding/HarfBuzzSharp/Definitions.cs +++ b/binding/HarfBuzzSharp/Definitions.cs @@ -4,8 +4,14 @@ namespace HarfBuzzSharp { + /// + /// Represents a glyph and its relation to the input text. + /// public unsafe partial struct GlyphInfo { + /// + /// Gets the for this instance. + /// public GlyphFlags GlyphFlags { get { fixed (GlyphInfo* f = &this) { diff --git a/binding/HarfBuzzSharp/DelegateProxies.cs b/binding/HarfBuzzSharp/DelegateProxies.cs index 3ce0e71303..0fb41fd00a 100644 --- a/binding/HarfBuzzSharp/DelegateProxies.cs +++ b/binding/HarfBuzzSharp/DelegateProxies.cs @@ -7,6 +7,9 @@ namespace HarfBuzzSharp { + /// + /// The delegate that will be invoked when a resource is ready to be discarded. + /// public delegate void ReleaseDelegate (); public delegate Blob GetTableDelegate (Face face, Tag tag); diff --git a/binding/HarfBuzzSharp/DelegateProxies.font.cs b/binding/HarfBuzzSharp/DelegateProxies.font.cs index e349e85a45..7d4c584a62 100644 --- a/binding/HarfBuzzSharp/DelegateProxies.font.cs +++ b/binding/HarfBuzzSharp/DelegateProxies.font.cs @@ -5,6 +5,13 @@ namespace HarfBuzzSharp { + /// + /// The delegate that is invoked when or is invoked. + /// + /// The font. + /// The additional data passed to when the functions were set. + /// The font extents. + /// Return true if the has extents, otherwise false. public delegate bool FontExtentsDelegate (Font font, object fontData, out FontExtents extents); public delegate bool NominalGlyphDelegate (Font font, object fontData, uint unicode, out uint glyph); @@ -13,6 +20,13 @@ namespace HarfBuzzSharp public delegate bool VariationGlyphDelegate (Font font, object fontData, uint unicode, uint variationSelector, out uint glyph); + /// + /// The delegate that is invoked when or is invoked. + /// + /// The font. + /// The additional data passed to when the functions were set. + /// The glyph. + /// Return the advance amount. public delegate int GlyphAdvanceDelegate (Font font, object fontData, uint glyph); public delegate void GlyphAdvancesDelegate (Font font, object fontData, uint count, ReadOnlySpan glyphs, Span advances); diff --git a/binding/HarfBuzzSharp/Face.cs b/binding/HarfBuzzSharp/Face.cs index d91e1fc9ba..16086579fd 100644 --- a/binding/HarfBuzzSharp/Face.cs +++ b/binding/HarfBuzzSharp/Face.cs @@ -4,17 +4,33 @@ namespace HarfBuzzSharp { + /// + /// Represents a typeface. + /// public unsafe class Face : NativeObject { private static readonly Lazy emptyFace = new Lazy (() => new StaticFace (HarfBuzzApi.hb_face_get_empty ())); + /// + /// Gets a reference to the empty instance. + /// public static Face Empty => emptyFace.Value; + /// + /// Creates a new instance, using the specified typeface blob. + /// + /// The typeface data. + /// The zero-based face index in a collection. public Face (Blob blob, uint index) : this (blob, (int)index) { } + /// + /// Creates a new instance, using the specified typeface blob. + /// + /// The typeface data. + /// The zero-based face index in a collection. public Face (Blob blob, int index) : this (IntPtr.Zero) { @@ -29,6 +45,10 @@ public Face (Blob blob, int index) Handle = HarfBuzzApi.hb_face_create (blob.Handle, (uint)index); } + /// + /// Creates a new instance, using the delegate to assemble the data. + /// + /// The delegate to retrieve the table data. public Face (GetTableDelegate getTable) : this (getTable, null) { @@ -51,11 +71,17 @@ internal Face (IntPtr handle) { } + /// + /// Gets or sets the zero-based face index in a collection. + /// public int Index { get => (int)HarfBuzzApi.hb_face_get_index (Handle); set => HarfBuzzApi.hb_face_set_index (Handle, (uint)value); } + /// + /// Gets or sets the units per EM. + /// public int UnitsPerEm { get => (int)HarfBuzzApi.hb_face_get_upem (Handle); set => HarfBuzzApi.hb_face_set_upem (Handle, (uint)value); diff --git a/binding/HarfBuzzSharp/Feature.cs b/binding/HarfBuzzSharp/Feature.cs index a086e004f0..cdf8f3e30e 100644 --- a/binding/HarfBuzzSharp/Feature.cs +++ b/binding/HarfBuzzSharp/Feature.cs @@ -5,20 +5,39 @@ namespace HarfBuzzSharp { + /// + /// Various font features and variations. + /// public unsafe partial struct Feature { private const int MaxFeatureStringSize = 128; + /// + /// Creates a new instance with the specified tag. + /// + /// The tag to use. public Feature (Tag tag) : this (tag, 1u, 0, uint.MaxValue) { } + /// + /// Creates a new instance with the specified tag. + /// + /// The tag to use. + /// The value to use. public Feature (Tag tag, uint value) : this (tag, value, 0, uint.MaxValue) { } + /// + /// Creates a new instance with the specified tag. + /// + /// The tag to use. + /// The value to use. + /// The start value. + /// The end value. public Feature (Tag tag, uint value, uint start, uint end) { this.tag = tag; @@ -27,26 +46,42 @@ public Feature (Tag tag, uint value, uint start, uint end) this.end = end; } + /// + /// Gets or sets the tag. + /// public Tag Tag { readonly get => tag; set => tag = value; } + /// + /// Gets or sets the value. + /// public uint Value { readonly get => value; set => this.value = value; } + /// + /// Gets or sets the start. + /// public uint Start { readonly get => start; set => start = value; } + /// + /// Gets or sets the end. + /// public uint End { readonly get => end; set => end = value; } + /// + /// Returns the string representation of the feature. + /// + /// Returns the string representation of the feature. public override string ToString () { fixed (Feature* f = &this) { @@ -58,6 +93,12 @@ public override string ToString () } } + /// + /// Tries to parse the feature string. + /// + /// The feature string to parse. + /// The feature. + /// Returns true on success, otherwise false. public static bool TryParse (string s, out Feature feature) { fixed (Feature* f = &feature) { @@ -65,6 +106,11 @@ public static bool TryParse (string s, out Feature feature) } } + /// + /// Parses a feature string. + /// + /// The feature string to parse. + /// Returns the new feature. public static Feature Parse (string s) => TryParse (s, out var feature) ? feature : throw new FormatException ("Unrecognized feature string format."); } diff --git a/binding/HarfBuzzSharp/Font.cs b/binding/HarfBuzzSharp/Font.cs index 13b6676aa3..4ca5f16c12 100644 --- a/binding/HarfBuzzSharp/Font.cs +++ b/binding/HarfBuzzSharp/Font.cs @@ -8,10 +8,17 @@ namespace HarfBuzzSharp { + /// + /// Represents a specific font face. + /// public unsafe class Font : NativeObject { internal const int NameBufferLength = 128; + /// + /// Creates a new using a specific font face. + /// + /// The face to use. public Font (Face face) : base (IntPtr.Zero) { @@ -57,6 +64,11 @@ public void SetFontFunctions (FontFunctions fontFunctions, object fontData, Rele HarfBuzzApi.hb_font_set_funcs (Handle, fontFunctions.Handle, (void*)ctx, DelegateProxies.DestroyProxyForMulti); } + /// + /// Retrieves the font scale. + /// + /// The scale along the x-axis. + /// The scale along the y-axis. public void GetScale (out int xScale, out int yScale) { fixed (int* x = &xScale) @@ -65,6 +77,11 @@ public void GetScale (out int xScale, out int yScale) } } + /// + /// Sets the font scale. + /// + /// The scale along the x-axis. + /// The scale along the y-axis. public void SetScale (int xScale, int yScale) => HarfBuzzApi.hb_font_set_scale (Handle, xScale, yScale); @@ -291,9 +308,17 @@ public bool TryGetGlyphFromString (string s, out uint glyph) } } + /// + /// Sets the font functions to that of OpenType. + /// public void SetFunctionsOpenType () => HarfBuzzApi.hb_ot_font_set_funcs (Handle); + /// + /// Shapes the specified buffer using the current font. + /// + /// The buffer to shape. + /// The features to control the shaping process. public void Shape (Buffer buffer, params Feature[] features) => Shape (buffer, features, null); diff --git a/binding/HarfBuzzSharp/HarfBuzzApi.generated.cs b/binding/HarfBuzzSharp/HarfBuzzApi.generated.cs index 871ebbf231..c26ccf62fe 100644 --- a/binding/HarfBuzzSharp/HarfBuzzApi.generated.cs +++ b/binding/HarfBuzzSharp/HarfBuzzApi.generated.cs @@ -6484,6 +6484,9 @@ namespace HarfBuzzSharp { namespace HarfBuzzSharp { // hb_feature_t + /// + /// Various font features and variations. + /// [StructLayout (LayoutKind.Sequential)] public unsafe partial struct Feature : IEquatable { // public hb_tag_t tag @@ -6667,10 +6670,19 @@ public readonly override int GetHashCode () } // hb_glyph_info_t + /// + /// Represents a glyph and its relation to the input text. + /// [StructLayout (LayoutKind.Sequential)] public unsafe partial struct GlyphInfo : IEquatable { // public hb_codepoint_t codepoint private UInt32 codepoint; + /// + /// Gets or sets the Unicode code point (or the glyph index after shaping). + /// + /// + /// This represents either a Unicode code point (before shaping) or a glyph index (after shaping). + /// public UInt32 Codepoint { readonly get => codepoint; set => codepoint = value; @@ -6678,6 +6690,9 @@ public UInt32 Codepoint { // public hb_mask_t mask private UInt32 mask; + /// + /// Gets or sets the glyph mask. + /// public UInt32 Mask { readonly get => mask; set => mask = value; @@ -6685,6 +6700,9 @@ public UInt32 Mask { // public uint32_t cluster private UInt32 cluster; + /// + /// Gets or sets the index of the character in the original text. + /// public UInt32 Cluster { readonly get => cluster; set => cluster = value; @@ -6724,10 +6742,16 @@ public readonly override int GetHashCode () } // hb_glyph_position_t + /// + /// Represents the position of a glyph, relative to the current point. + /// [StructLayout (LayoutKind.Sequential)] public unsafe partial struct GlyphPosition : IEquatable { // public hb_position_t x_advance private Int32 x_advance; + /// + /// Gets or sets how much the line advances after drawing this glyph when setting text in horizontal direction. + /// public Int32 XAdvance { readonly get => x_advance; set => x_advance = value; @@ -6735,6 +6759,9 @@ public Int32 XAdvance { // public hb_position_t y_advance private Int32 y_advance; + /// + /// Gets or sets how much the line advances after drawing this glyph when setting text in vertical direction. + /// public Int32 YAdvance { readonly get => y_advance; set => y_advance = value; @@ -6742,6 +6769,12 @@ public Int32 YAdvance { // public hb_position_t x_offset private Int32 x_offset; + /// + /// Gets or sets how much the glyph moves horizontally before drawing it. + /// + /// + /// This should not affect how much the line advances. + /// public Int32 XOffset { readonly get => x_offset; set => x_offset = value; @@ -6749,6 +6782,12 @@ public Int32 XOffset { // public hb_position_t y_offset private Int32 y_offset; + /// + /// Gets or sets how much the glyph moves horizontally before drawing it. + /// + /// + /// This should not affect how much the line advances. + /// public Int32 YOffset { readonly get => y_offset; set => y_offset = value; @@ -7179,24 +7218,51 @@ public readonly override int GetHashCode () namespace HarfBuzzSharp { // hb_buffer_cluster_level_t + /// + /// The various levels of buffer clustering. + /// public enum ClusterLevel { // HB_BUFFER_CLUSTER_LEVEL_MONOTONE_GRAPHEMES = 0 + /// + /// Cluster values grouped by graphemes into monotone order. + /// MonotoneGraphemes = 0, // HB_BUFFER_CLUSTER_LEVEL_MONOTONE_CHARACTERS = 1 + /// + /// Cluster values grouped into monotone order. + /// MonotoneCharacters = 1, // HB_BUFFER_CLUSTER_LEVEL_CHARACTERS = 2 + /// + /// Don't group cluster values. + /// Characters = 2, // HB_BUFFER_CLUSTER_LEVEL_DEFAULT = HB_BUFFER_CLUSTER_LEVEL_MONOTONE_GRAPHEMES + /// + /// Default cluster level (). + /// Default = 0, } // hb_buffer_content_type_t + /// + /// The various types of buffer contents. + /// public enum ContentType { // HB_BUFFER_CONTENT_TYPE_INVALID = 0 + /// + /// Initial value for new buffer. + /// Invalid = 0, // HB_BUFFER_CONTENT_TYPE_UNICODE = 1 + /// + /// The buffer contains input characters (before shaping). + /// Unicode = 1, // HB_BUFFER_CONTENT_TYPE_GLYPHS = 2 + /// + /// The buffer contains output glyphs (after shaping). + /// Glyphs = 2, } @@ -7240,66 +7306,147 @@ public enum BufferFlags { } // hb_buffer_serialize_flags_t + /// + /// The various flags that control what glyph information are serialized by . + /// [Flags] public enum SerializeFlag { // HB_BUFFER_SERIALIZE_FLAG_DEFAULT = 0x00000000u + /// + /// Serialize glyph names, clusters and position information. + /// Default = 0, // HB_BUFFER_SERIALIZE_FLAG_NO_CLUSTERS = 0x00000001u + /// + /// Do not serialize glyph clusters. + /// NoClusters = 1, // HB_BUFFER_SERIALIZE_FLAG_NO_POSITIONS = 0x00000002u + /// + /// Do not serialize glyph position information. + /// NoPositions = 2, // HB_BUFFER_SERIALIZE_FLAG_NO_GLYPH_NAMES = 0x00000004u + /// + /// Do not serialize glyph names. + /// NoGlyphNames = 4, // HB_BUFFER_SERIALIZE_FLAG_GLYPH_EXTENTS = 0x00000008u + /// + /// Serialize glyph extents. + /// GlyphExtents = 8, // HB_BUFFER_SERIALIZE_FLAG_GLYPH_FLAGS = 0x00000010u + /// + /// Serialize glyph flags. + /// GlyphFlags = 16, // HB_BUFFER_SERIALIZE_FLAG_NO_ADVANCES = 0x00000020u + /// + /// Do not serialize glyph advances (glyph offsets will reflect absolute glyph positions). + /// NoAdvances = 32, } // hb_buffer_serialize_format_t + /// + /// The various serialization and de-serialization formats. + /// public enum SerializeFormat { // HB_BUFFER_SERIALIZE_FORMAT_TEXT = 1413830740 + /// + /// A human-readable, plain text format. + /// Text = 1413830740, // HB_BUFFER_SERIALIZE_FORMAT_JSON = 1246973774 + /// + /// A machine-readable JSON format. + /// Json = 1246973774, // HB_BUFFER_SERIALIZE_FORMAT_INVALID = 0 + /// + /// The format is invalid. + /// Invalid = 0, } // hb_direction_t + /// + /// Various text directions that can be set via . + /// public enum Direction { // HB_DIRECTION_INVALID = 0 + /// + /// Initial, unset direction. + /// Invalid = 0, // HB_DIRECTION_LTR = 4 + /// + /// Text is set horizontally from left to right. + /// LeftToRight = 4, // HB_DIRECTION_RTL = 5 + /// + /// Text is set horizontally from right to left. + /// RightToLeft = 5, // HB_DIRECTION_TTB = 6 + /// + /// Text is set vertically from top to bottom. + /// TopToBottom = 6, // HB_DIRECTION_BTT = 7 + /// + /// Text is set vertically from bottom to top. + /// BottomToTop = 7, } // hb_glyph_flags_t + /// + /// Represents the various glyph flags of a . + /// [Flags] public enum GlyphFlags { // HB_GLYPH_FLAG_UNSAFE_TO_BREAK = 0x00000001 + /// + /// If input text is broken at the beginning of the cluster this glyph is part of, then both sides need to be re-shaped, as the result might be different. + /// UnsafeToBreak = 1, // HB_GLYPH_FLAG_DEFINED = 0x00000001 + /// + /// All the currently defined flags. + /// Defined = 1, } // hb_memory_mode_t + /// + /// Various memory modes for + /// + /// + /// In no case shall the HarfBuzz client modify memory that is passed to HarfBuzz in a blob. If there is any such possibility, should be used such that HarfBuzz makes a copy immediately. + /// public enum MemoryMode { // HB_MEMORY_MODE_DUPLICATE = 0 + /// + /// HarfBuzz makes a copy immediately. + /// Duplicate = 0, // HB_MEMORY_MODE_READONLY = 1 + /// + /// Default mode indicating that the memory won't be changed. + /// ReadOnly = 1, // HB_MEMORY_MODE_WRITABLE = 2 + /// + /// Indicates that the data was copied solely for the purpose of passing to HarfBuzz. + /// Writeable = 2, // HB_MEMORY_MODE_READONLY_MAY_MAKE_WRITABLE = 3 + /// + /// The font file was mmap()ed, but should still be used. + /// ReadOnlyMayMakeWriteable = 3, } diff --git a/binding/HarfBuzzSharp/NativeObject.cs b/binding/HarfBuzzSharp/NativeObject.cs index 8ffb1b44a9..f0454e7dcf 100644 --- a/binding/HarfBuzzSharp/NativeObject.cs +++ b/binding/HarfBuzzSharp/NativeObject.cs @@ -6,6 +6,9 @@ namespace HarfBuzzSharp { + /// + /// Represents a native object. + /// public class NativeObject : IDisposable { private bool isDisposed; @@ -28,6 +31,9 @@ internal NativeObject (IntPtr handle, bool zero) Dispose (false); } + /// + /// Gets or sets the handle to the underlying native object. + /// public virtual IntPtr Handle { get; protected set; } // Dispose method - always called @@ -56,6 +62,12 @@ protected virtual void DisposeHandler () { } + /// + /// Releases all resources used by this . + /// + /// + /// Always dispose the object before you release your last reference to the . Otherwise, the resources it is using will not be freed until the garbage collector calls the finalizer. + /// public void Dispose () { Dispose (true); diff --git a/binding/HarfBuzzSharp/Script.cs b/binding/HarfBuzzSharp/Script.cs index 9c49b411d7..f607a5fe3d 100644 --- a/binding/HarfBuzzSharp/Script.cs +++ b/binding/HarfBuzzSharp/Script.cs @@ -4,6 +4,9 @@ namespace HarfBuzzSharp { + /// + /// Represents a particular Unicode script. + /// public partial struct Script : IEquatable