Skip to content

Commit

Permalink
updated all resource names separate from fontName, fontFamilyName.
Browse files Browse the repository at this point in the history
  • Loading branch information
petersktang committed Sep 12, 2023
1 parent 6049e93 commit 4d922a5
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions Sources/SwiftMath/MathBundle/MathFont.swift
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ private class BundleManager {
guard CTFontManagerRegisterGraphicsFont(defaultCGFont, &errorRef) else {
throw FontError.registerFailed
}
print("mathFonts bundle: \(mathFont.rawValue) registered.")
print("mathFonts bundle resource: \(mathFont.rawValue), font: \(defaultCGFont.fullName) registered.")
}

private func registerMathTable(mathFont: MathFont) throws {
Expand All @@ -119,6 +119,7 @@ private class BundleManager {
}
//FIXME: mathTable = MTFontMathTable(withFont:self, mathTable:rawMathTable)
mathTables[mathFont] = rawMathTable
print("mathFonts bundle resource: \(mathFont.rawValue).plist registered.")
}

private func registerAllBundleResources() {
Expand All @@ -128,7 +129,7 @@ private class BundleManager {
try BundleManager.manager.registerCGFont(mathFont: font)
try BundleManager.manager.registerMathTable(mathFont: font)
} catch {
fatalError("MTMathFonts:\(#function) Couldn't load math fonts \(font.rawValue), reason \(error)")
fatalError("MTMathFonts:\(#function) Couldn't load mathFont resource \(font.rawValue), reason \(error)")
}
}
initializedOnceAlready.toggle()
Expand Down
2 changes: 1 addition & 1 deletion Sources/SwiftMath/MathBundle/MathTable.swift
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ internal struct MathTable {
// If no top accent is defined then it is the center of the advance width.
var advances = CGSize.zero
guard let ctFont = font.ctFont(withSize: fontSize) else {
fatalError("\(#function) unable to obtain ctFont \(font.rawValue) with size \(fontSize)")
fatalError("\(#function) unable to obtain ctFont resource name: \(font.rawValue) with size \(fontSize)")
}
CTFontGetAdvancesForGlyphs(ctFont, .horizontal, &glyph, &advances, 1)
return advances.width/2
Expand Down

0 comments on commit 4d922a5

Please sign in to comment.