CGFont and CTFont functionality in portable Swift (e.g. Ubuntu, etc)?

三世轮回 提交于 2019-12-02 16:48:33

问题


Swift on macOS, the import Foundation statement is sufficient to link with CGFont, CTFont and related functions.

import Foundation

public struct FontMetric {

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

However, for Swift on Ubuntu, the CGFont, CTFont and related functions cause "undeclared type" errors:

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
                        ^~~~~~

Is there a way to either install the CoreGraphics/CoreText libraries on other (non-Apple) platforms like Ubuntu?

Alternately, is there some portable open-source swift-compatible (e.g. C) library that offers functionality similar to CGFont and CTFont?


Answers like coregraphics on gnustep ubuntu would indicate that CoreGraphics is not in GNUStep.

来源:https://stackoverflow.com/questions/56782036/cgfont-and-ctfont-functionality-in-portable-swift-e-g-ubuntu-etc

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!