草庐IT

c++ - 获取 NSGlyph 的大纲

使用CoreText可以通过CTFontCreatePathForGlyph(...)获取CGGlyph的轮廓。现在我想从CoreText移植到Cocoa的字体引擎,所以问题是:有没有办法获取NSGlyph的轮廓? 最佳答案 是的,你可以使用NSBezierPath的-appendBezierPathWithGlyph:inFont:.我想补充一点,您也可以将CoreText与Cocoa结合使用。所以从这个意义上说,您根本不需要移植。 关于c++-获取NSGlyph的大纲,我们在Stac

ios - Swift 中的 NSGlyph 到 CGGlyph(UInt32 到 UInt16)

如何从NSGlyph转换为CGGlyph?letctGlyph=glyphasCGGlyph我看到了:typealiasCGGlyph=CGFontIndextypealiasCGFontIndex=UInt16typealiasNSGlyph=UInt32那么我该如何进行类型转换呢?我试过:letctGlyph=glyphasCGGlyph但它给了我:error:'NSGlyph'isnotconvertibleto'CGGlyph' 最佳答案 你不能转换,但你可以使用初始化器:letctGlyph=CGGlyph(glyph)