From 4d922a5638cf789cc1b575f1b71e8d9b36bc4cb1 Mon Sep 17 00:00:00 2001 From: Peter Tang Date: Tue, 12 Sep 2023 18:40:01 +0800 Subject: [PATCH] updated all resource names separate from fontName, fontFamilyName. --- Sources/SwiftMath/MathBundle/MathFont.swift | 5 +++-- Sources/SwiftMath/MathBundle/MathTable.swift | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/Sources/SwiftMath/MathBundle/MathFont.swift b/Sources/SwiftMath/MathBundle/MathFont.swift index caba500..d7abd7c 100644 --- a/Sources/SwiftMath/MathBundle/MathFont.swift +++ b/Sources/SwiftMath/MathBundle/MathFont.swift @@ -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 { @@ -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() { @@ -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() diff --git a/Sources/SwiftMath/MathBundle/MathTable.swift b/Sources/SwiftMath/MathBundle/MathTable.swift index 8740206..e86886c 100644 --- a/Sources/SwiftMath/MathBundle/MathTable.swift +++ b/Sources/SwiftMath/MathBundle/MathTable.swift @@ -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