便携式Swift(例如Ubuntu等)中的CGFont和CTFont功能?

时间:2019-06-26 23:14:25

标签: swift fonts core-graphics core-text

在macOS上快速运行,import Foundation语句足以链接CGFont,CTFont和相关功能。

import Foundation

public struct FontMetric {

    let cgFont: CGFont
    private let ctFont: CTFont
    // ... 

但是,对于Ubuntu上的Swift,CGFont,CTFont和相关函数会导致“未声明类型”错误:

FontMetric.swift:21:17: error: use of undeclared type 'CGFont'
    let cgFont: CGFont
                ^~~~~~
FontMetric.swift:24:25: error: use of undeclared type 'CTFont'
    private let ctFont: CTFont
                        ^~~~~~

是否可以在其他(非Apple)平台(如Ubuntu)上安装CoreGraphics / CoreText库?

或者,是否有一些可移植的开源swift兼容(例如C)库,其功能类似于CGFontCTFont


类似coregraphics on gnustep ubuntu的回答将表明CoreGraphics不在GNUStep中。

0 个答案:

没有答案