// Copyright (c) Six Labors. // Licensed under the Six Labors Split License. using SixLabors.Fonts.Tables.TrueType.Glyphs; namespace SixLabors.Fonts.Tables.Woff { /// /// A glyph loader for WOFF2 fonts that wraps a pre-parsed /// from the transformed glyph data stream. /// See: . /// internal sealed class Woff2GlyphLoader : GlyphLoader { /// /// The glyph vector containing the decoded outline data. /// private GlyphVector glyphVector; /// /// Initializes a new instance of the class. /// /// The pre-parsed glyph vector from the WOFF2 transformed glyph stream. public Woff2GlyphLoader(GlyphVector glyphVector) => this.glyphVector = glyphVector; /// /// Creates a glyph vector, computing bounding box on demand if not already set. /// /// The glyph table. /// The . public override GlyphVector CreateGlyph(GlyphTable table) { if (this.glyphVector.Bounds == default) { this.glyphVector.Bounds = Bounds.Load(this.glyphVector.ControlPoints); } return this.glyphVector; } } }