Play your own Switch games on iPhone/iPad — one-click macOS app, no terminal. | 把 Switch 游戏装进 iPhone:图形界面一键构建,不用命令行。Bring your own game.
Swift apple-siliconcustom-formathomebrewiosipaipadipadosiphonemetalnative-portnintendo-switchnxnativeromfsswitch-games
import CoreText
import XCTest
@testable import NX2Apple
@testable import NXCore
@testable import NXLauncher
/// Each size and weight of Manrope is made once and then reused, so a page with hundreds of labels does not
/// create hundreds of fonts each time it is drawn.
final class TypographyTests: IsolatedDefaultsTestCase {
func testTheSameSizeAndWeightGiveTheSameFont() throws {
let first = try XCTUnwrap(Typography.manropeFont(size: 13, weight: .semibold))
let second = try XCTUnwrap(Typography.manropeFont(size: 13, weight: .semibold))
XCTAssertTrue(first === second)
XCTAssertEqual(Typography.text(13, .semibold), Typography.text(13, .semibold))
}
func testSizesAndWeightsStayApart() throws {
let regular = try XCTUnwrap(Typography.manropeFont(size: 13, weight: .regular))
let semibold = try XCTUnwrap(Typography.manropeFont(size: 13, weight: .semibold))
let larger = try XCTUnwrap(Typography.manropeFont(size: 15, weight: .semibold))
XCTAssertFalse(regular === semibold)
XCTAssertEqual(CTFontGetSize(semibold), 13)
XCTAssertEqual(CTFontGetSize(larger), 15)
let wght = NSNumber(value: 0x7767_6874)
let axes = { (font: CTFont) in (CTFontCopyVariation(font) as? [NSNumber: Double])?[wght] }
XCTAssertEqual(axes(regular), 400)
XCTAssertEqual(axes(semibold), 600)
}
}