Added fonts and provided previews.
This commit is contained in:
@@ -11,30 +11,53 @@ import UIKit
|
||||
import AppKit
|
||||
#endif
|
||||
|
||||
public enum MathFont: String, CaseIterable {
|
||||
public enum MathFont: String, CaseIterable, Identifiable {
|
||||
|
||||
public var id: Self { self } // Makes things simpler for SwiftUI
|
||||
|
||||
case latinModernFont = "latinmodern-math"
|
||||
case kpMathLightFont = "KpMath-Light"
|
||||
case kpMathSansFont = "KpMath-Sans"
|
||||
case xitsFont = "xits-math"
|
||||
case termesFont = "texgyretermes-math"
|
||||
case asanaFont = "Asana-Math"
|
||||
case eulerFont = "Euler-Math"
|
||||
case firaFont = "FiraMath-Regular"
|
||||
case notoSansFont = "NotoSansMath-Regular"
|
||||
case libertinusFont = "LibertinusMath-Regular"
|
||||
case garamondFont = "Garamond-Math"
|
||||
case leteSansFont = "LeteSansMath"
|
||||
|
||||
var fontFamilyName: String {
|
||||
switch self {
|
||||
case .latinModernFont: return "Latin Modern Math"
|
||||
case .kpMathLightFont: return "KpMath"
|
||||
case .kpMathSansFont: return "KpMath"
|
||||
case .xitsFont: return "XITS Math"
|
||||
case .termesFont: return "TeX Gyre Termes Math"
|
||||
case .latinModernFont: "Latin Modern Math"
|
||||
case .kpMathLightFont: "KpMath"
|
||||
case .kpMathSansFont: "KpMath"
|
||||
case .xitsFont: "XITS Math"
|
||||
case .termesFont: "TeX Gyre Termes Math"
|
||||
case .asanaFont: "Asana Math"
|
||||
case .eulerFont: "Euler Math"
|
||||
case .firaFont: "Fira Math"
|
||||
case .notoSansFont: "Noto Sans Math"
|
||||
case .libertinusFont: "Libertinus Math"
|
||||
case .garamondFont: "Garamond Math"
|
||||
case .leteSansFont: "Lete Sans Math"
|
||||
}
|
||||
}
|
||||
var fontName: String {
|
||||
switch self {
|
||||
case .latinModernFont: return "LatinModernMath-Regular"
|
||||
case .kpMathLightFont: return "KpMath-Light"
|
||||
case .kpMathSansFont: return "KpMath-Sans"
|
||||
case .xitsFont: return "XITSMath"
|
||||
case .termesFont: return "TeXGyreTermesMath-Regular"
|
||||
case .latinModernFont: "LatinModernMath-Regular"
|
||||
case .kpMathLightFont: "KpMath-Light"
|
||||
case .kpMathSansFont: "KpMath-Sans"
|
||||
case .xitsFont: "XITSMath"
|
||||
case .termesFont: "TeXGyreTermesMath-Regular"
|
||||
case .asanaFont: "Asana Math"
|
||||
case .eulerFont: "Euler Math"
|
||||
case .firaFont: "Fira Math"
|
||||
case .notoSansFont: "Noto Sans Math"
|
||||
case .libertinusFont: "Libertinus Math"
|
||||
case .garamondFont: "Garamond Math"
|
||||
case .leteSansFont: "Lete Sans Math"
|
||||
}
|
||||
}
|
||||
public func cgFont() -> CGFont {
|
||||
|
||||
@@ -56,6 +56,34 @@ public class MTFontManager {
|
||||
MTFontManager.fontManager.font(withName: "texgyretermes-math", size: size)
|
||||
}
|
||||
|
||||
public func asanaFont(withSize size:CGFloat) -> MTFont? {
|
||||
MTFontManager.fontManager.font(withName: "Asana-Math", size: size)
|
||||
}
|
||||
|
||||
public func eulerFont(withSize size:CGFloat) -> MTFont? {
|
||||
MTFontManager.fontManager.font(withName: "Euler-Math", size: size)
|
||||
}
|
||||
|
||||
public func firaRegularFont(withSize size:CGFloat) -> MTFont? {
|
||||
MTFontManager.fontManager.font(withName: "FiraMath-Regular", size: size)
|
||||
}
|
||||
|
||||
public func notoSansRegularFont(withSize size:CGFloat) -> MTFont? {
|
||||
MTFontManager.fontManager.font(withName: "NotoSansMath-Regular", size: size)
|
||||
}
|
||||
|
||||
public func libertinusRegularFont(withSize size:CGFloat) -> MTFont? {
|
||||
MTFontManager.fontManager.font(withName: "LibertinusMath-Regular", size: size)
|
||||
}
|
||||
|
||||
public func garamondMathFont(withSize size:CGFloat) -> MTFont? {
|
||||
MTFontManager.fontManager.font(withName: "Garamond-Math", size: size)
|
||||
}
|
||||
|
||||
public func leteSansFont(withSize size:CGFloat) -> MTFont? {
|
||||
MTFontManager.fontManager.font(withName: "LeteSansMath", size: size)
|
||||
}
|
||||
|
||||
public var defaultFont: MTFont? {
|
||||
MTFontManager.fontManager.latinModernFont(withSize: kDefaultFontSize)
|
||||
}
|
||||
|
||||
BIN
Sources/SwiftMath/mathFonts.bundle/Asana-Math.otf
Normal file
BIN
Sources/SwiftMath/mathFonts.bundle/Asana-Math.otf
Normal file
Binary file not shown.
4343
Sources/SwiftMath/mathFonts.bundle/Asana-Math.plist
Normal file
4343
Sources/SwiftMath/mathFonts.bundle/Asana-Math.plist
Normal file
File diff suppressed because it is too large
Load Diff
BIN
Sources/SwiftMath/mathFonts.bundle/Euler-Math.otf
Normal file
BIN
Sources/SwiftMath/mathFonts.bundle/Euler-Math.otf
Normal file
Binary file not shown.
2165
Sources/SwiftMath/mathFonts.bundle/Euler-Math.plist
Normal file
2165
Sources/SwiftMath/mathFonts.bundle/Euler-Math.plist
Normal file
File diff suppressed because it is too large
Load Diff
BIN
Sources/SwiftMath/mathFonts.bundle/FiraMath-Regular.otf
Normal file
BIN
Sources/SwiftMath/mathFonts.bundle/FiraMath-Regular.otf
Normal file
Binary file not shown.
3064
Sources/SwiftMath/mathFonts.bundle/FiraMath-Regular.plist
Normal file
3064
Sources/SwiftMath/mathFonts.bundle/FiraMath-Regular.plist
Normal file
File diff suppressed because it is too large
Load Diff
BIN
Sources/SwiftMath/mathFonts.bundle/Garamond-Math.otf
Normal file
BIN
Sources/SwiftMath/mathFonts.bundle/Garamond-Math.otf
Normal file
Binary file not shown.
7910
Sources/SwiftMath/mathFonts.bundle/Garamond-Math.plist
Normal file
7910
Sources/SwiftMath/mathFonts.bundle/Garamond-Math.plist
Normal file
File diff suppressed because it is too large
Load Diff
BIN
Sources/SwiftMath/mathFonts.bundle/LeteSansMath.otf
Normal file
BIN
Sources/SwiftMath/mathFonts.bundle/LeteSansMath.otf
Normal file
Binary file not shown.
5393
Sources/SwiftMath/mathFonts.bundle/LeteSansMath.plist
Normal file
5393
Sources/SwiftMath/mathFonts.bundle/LeteSansMath.plist
Normal file
File diff suppressed because it is too large
Load Diff
BIN
Sources/SwiftMath/mathFonts.bundle/LibertinusMath-Regular.otf
Normal file
BIN
Sources/SwiftMath/mathFonts.bundle/LibertinusMath-Regular.otf
Normal file
Binary file not shown.
4276
Sources/SwiftMath/mathFonts.bundle/LibertinusMath-Regular.plist
Normal file
4276
Sources/SwiftMath/mathFonts.bundle/LibertinusMath-Regular.plist
Normal file
File diff suppressed because it is too large
Load Diff
BIN
Sources/SwiftMath/mathFonts.bundle/NotoSansMath-Regular.otf
Normal file
BIN
Sources/SwiftMath/mathFonts.bundle/NotoSansMath-Regular.otf
Normal file
Binary file not shown.
9356
Sources/SwiftMath/mathFonts.bundle/NotoSansMath-Regular.plist
Normal file
9356
Sources/SwiftMath/mathFonts.bundle/NotoSansMath-Regular.plist
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user