From d1c4ac77a600ef9a4aac80102ac2abd02bc327ea Mon Sep 17 00:00:00 2001 From: Peter Tang Date: Tue, 12 Sep 2023 08:28:24 +0800 Subject: [PATCH] embedded GlyphPart within MathTable, MTTypesetter is not yet using this GlyphPart. --- Sources/SwiftMath/MathBundle/MathTable.swift | 36 +++++++++++--------- 1 file changed, 19 insertions(+), 17 deletions(-) diff --git a/Sources/SwiftMath/MathBundle/MathTable.swift b/Sources/SwiftMath/MathBundle/MathTable.swift index 0f8a604..1c2028f 100644 --- a/Sources/SwiftMath/MathBundle/MathTable.swift +++ b/Sources/SwiftMath/MathBundle/MathTable.swift @@ -8,23 +8,6 @@ import Foundation import CoreText -// struct GlyphPart { -// /// The glyph that represents this part -// var glyph: CGGlyph! -// -// /// Full advance width/height for this part, in the direction of the extension in points. -// var fullAdvance: CGFloat = 0 -// -// /// Advance width/ height of the straight bar connector material at the beginning of the glyph in points. -// var startConnectorLength: CGFloat = 0 -// -// /// Advance width/ height of the straight bar connector material at the end of the glyph in points. -// var endConnectorLength: CGFloat = 0 -// -// /// If this part is an extender. If set, the part can be skipped or repeated. -// var isExtender: Bool = false -// } - /** This class represents the Math table of an open type font. The math table is documented here: https://www.microsoft.com/typography/otspec/math.htm @@ -306,3 +289,22 @@ internal struct MathTable { } } +extension MathTable { + + struct GlyphPart { + /// The glyph that represents this part + var glyph: CGGlyph! + + /// Full advance width/height for this part, in the direction of the extension in points. + var fullAdvance: CGFloat = 0 + + /// Advance width/ height of the straight bar connector material at the beginning of the glyph in points. + var startConnectorLength: CGFloat = 0 + + /// Advance width/ height of the straight bar connector material at the end of the glyph in points. + var endConnectorLength: CGFloat = 0 + + /// If this part is an extender. If set, the part can be skipped or repeated. + var isExtender: Bool = false + } +}