Struct Emu
- Namespace
- DocWright.Core.Primitives
- Assembly
- DocWright.Core.dll
A length in English Metric Units (EMU), the unit DrawingML uses for image and shape extents. 914400 EMU = 1 inch; 12700 EMU = 1 point; 635 EMU = 1 twip.
public readonly struct Emu : IEquatable<Emu>, IComparable<Emu>
- Implements
- Inherited Members
Remarks
See ECMA-376 Part 1 §20.1.2.1 (EMU usage in DrawingML). EMU values are exact integers for all common physical units, which is why OOXML uses them; DocWright converts them to twips (round-half-away-from-zero) before any layout arithmetic.
Constructors
- Emu(long)
Initializes a new value from a raw EMU count.
Fields
- PerCentimeter
EMU per centimeter.
- PerInch
EMU per inch.
- PerMillimeter
EMU per millimeter.
- PerPoint
EMU per typographic point.
- PerTwip
EMU per twip.
- Zero
A zero-length value.
Properties
- Value
Gets the length in EMU.
Methods
- FromCentimeters(double)
Creates a value from centimeters, rounding half away from zero.
- FromInches(double)
Creates a value from inches, rounding half away from zero.
- FromPoints(double)
Creates a value from typographic points, rounding half away from zero.
- FromTwips(Twips)
Creates a value from twips (exact; 635 EMU per twip).
- ToString()
Returns the value formatted with the invariant culture, suffixed with "emu" (for example "12700emu").
- ToTwips()
Converts this length to twips, rounding half away from zero.
Operators
- operator +(Emu, Emu)
Adds two lengths (checked).
- operator ==(Emu, Emu)
Determines whether two lengths are equal.
- operator >(Emu, Emu)
Determines whether one length is greater than another.
- operator >=(Emu, Emu)
Determines whether one length is greater than or equal to another.
- operator !=(Emu, Emu)
Determines whether two lengths are not equal.
- operator <(Emu, Emu)
Determines whether one length is less than another.
- operator <=(Emu, Emu)
Determines whether one length is less than or equal to another.
- operator -(Emu, Emu)
Subtracts one length from another (checked).
- operator -(Emu)
Negates a length (checked).