SKFourByteTag Struct
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Represents a four-byte OpenType tag used to identify tables, axes, and scripts.
public readonly struct SKFourByteTag : IEquatable<SkiaSharp.SKFourByteTag>
- Inheritance
-
SKFourByteTag
- Implements
Examples
Creating a tag from a string and from individual characters:
var wghtFromString = SKFourByteTag.Parse("wght");
var wghtFromChars = new SKFourByteTag('w', 'g', 'h', 't');
Console.WriteLine(wghtFromString == wghtFromChars); // True
Console.WriteLine(wghtFromString); // wght
Remarks
`SKFourByteTag` is a read-only struct that wraps a 32-bit unsigned integer whose four bytes correspond to four ASCII characters. This matches the `SkFourByteTag` representation used throughout the Skia/OpenType APIs for table identifiers (e.g., `cmap`, `GSUB`) and variation axis tags (e.g., `wght`, `wdth`).
When constructed from four `char` values, the first character (`c1`) occupies the high byte and the last (`c4`) the low byte: `(c1 << 24) | (c2 << 16) | (c3 << 8) | c4`.
`Parse` accepts a string of 1–4 ASCII characters, right-padding with spaces if shorter than 4 characters.
`ToString` returns the four-character ASCII string representation.
Constructors
| Name | Description |
|---|---|
| SKFourByteTag(Char, Char, Char, Char) |
Initializes a new instance of the SKFourByteTag struct from four ASCII characters. |
| SKFourByteTag(UInt32) |
Initializes a new instance of the SKFourByteTag struct from a raw 32-bit value. |
Methods
| Name | Description |
|---|---|
| Equals(Object) |
Indicates whether this tag is equal to the specified object. |
| Equals(SKFourByteTag) |
Indicates whether this tag is equal to another SKFourByteTag. |
| GetHashCode() |
Returns a hash code for this tag. |
| Parse(String) |
Parses a string of up to four ASCII characters into an SKFourByteTag. |
| ToString() |
Returns the four-character ASCII string representation of this tag. |
Operators
| Name | Description |
|---|---|
| Equality(SKFourByteTag, SKFourByteTag) |
Determines whether two SKFourByteTag values are equal. |
| Implicit(SKFourByteTag to UInt32) |
Implicitly converts an SKFourByteTag to its underlying 32-bit unsigned integer value. |
| Implicit(UInt32 to SKFourByteTag) |
Implicitly converts a 32-bit unsigned integer to an SKFourByteTag. |
| Inequality(SKFourByteTag, SKFourByteTag) |
Determines whether two SKFourByteTag values are not equal. |