Added fonts and provided previews.

This commit is contained in:
Michael Griebling
2024-10-08 19:35:42 -04:00
parent de4484382d
commit 7799485428
19 changed files with 36580 additions and 14 deletions

View File

@@ -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 {

View File

@@ -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)
}

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff