Skip to content

Swift调用下,垂直情况出现问题 #2

@zhoulijun12315

Description

@zhoulijun12315

首先,非常感谢您的写出这么棒的代码。

我在使用Swift调用的时候:

let myString = "测试测试"
        
let myAttribute = [NSAttributedString.Key.foregroundColor: UIColor.red]
let myAttrString = NSAttributedString(string: myString, attributes: myAttribute)
        
hintLabel = FOTextView()
hintLabel.isVertical = true
hintLabel.attString = myAttrString
hintLabel.backgroundColor = UIColor.clear
self.view.addSubview(hintLabel)

发现在垂直排布的时候,无法正常显示我设置的文字颜色。

调试发现,在 'FOTextLayout.m'中,下列的fillColor为nil,无法获取到字体颜色。

CGColorRef fillColor = (CGColorRef)CFDictionaryGetValue(runAttrs, kCTForegroundColorAttributeName);
fillColor = FOTextGetCGColor(fillColor);
NSNumber *strokeWidth = CFDictionaryGetValue(runAttrs, kCTStrokeWidthAttributeName);

对Coretext不熟悉,请问该如何解决

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions