Skip to content

Commit db29502

Browse files
committed
Fix Linux build
1 parent 7f34a8d commit db29502

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

ShapeScript/EvaluationContext.swift

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -501,14 +501,22 @@ extension EvaluationContext {
501501
}
502502
case _ where url.isFontFile:
503503
do {
504+
#if canImport(CoreGraphics) && canImport(CoreText)
504505
guard let dataProvider = CGDataProvider(url: url as CFURL) else {
505-
throw RuntimeErrorType.fileNotFound(for: name, at: url)
506+
throw RuntimeErrorType.fileNotFound(for: path, at: url)
506507
}
507508
guard let cgFont = CGFont(dataProvider), let fullName = cgFont.fullName as? String,
508509
CGFont(fullName as CFString) != nil || CTFontManagerRegisterGraphicsFont(cgFont, nil)
509510
else {
510-
throw RuntimeErrorType.fileParsingError(for: name, at: url, message: "")
511+
throw RuntimeErrorType.fileParsingError(
512+
for: path,
513+
at: url,
514+
message: ""
515+
)
511516
}
517+
#else
518+
let fullName = url.lastPathComponent
519+
#endif
512520
let value = Value.font(fullName)
513521
importCache.store[url] = .value(value)
514522
return value

ShapeScript/URL+FileType.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
// Created by Nick Lockwood on 15/01/2026.
66
//
77

8+
import Foundation
9+
810
#if canImport(UniformTypeIdentifiers)
911
import UniformTypeIdentifiers
1012
#endif

0 commit comments

Comments
 (0)