Skip to content

CoreText note: Client requested name ".SFUI-Regular" #72

@nivbp7

Description

@nivbp7

Describe the bug

I'm trying to set a strikethrough on text, to indicate that this item is complete.
I am using this code snippet to add the strikethrough
let struckText = NSAttributedString(string: todoText, attributes: [NSAttributedString.Key.nantesLabelStrikeOut: true])
When the label is rendered the following message appears in the console:
CoreText note: Client requested name ".SFUI-Regular", it will get TimesNewRomanPSMT rather than the intended font. All system UI font access should be through proper APIs such as CTFontCreateUIFontForLanguage() or +[UIFont systemFontOfSize:]. CoreText note: Set a breakpoint on CTFontLogSystemFontNameRequest to debug.

When setting the CTFontLogSystemFontNameRequest breakpoint, this is the first line in the stack trace.
method - drawStrike(frame: CTFrame, inRect: CGRect, context: CGContext)
file - Drawing.swift
let font = CTFontCreateWithName(myFont.fontName as CFString, myFont.pointSize, nil)

To Reproduce
Steps to reproduce the behavior:

let label: NantesLabel = .init(frame: CGRect(x: 20, y: 100, width: view.frame.width, height: 100)) let attributedText = NSMutableAttributedString(string: text, attributes: [NSAttributedString.Key.backgroundColor: UIColor.lightGray]) let struckText = NSAttributedString(string: text, attributes: [NSAttributedString.Key.nantesLabelStrikeOut: true]) attributedText.append(struckText) label.attributedText = attributedText view.addSubview(label)

Expected behavior
The font passed in with the attributes or the system font should be used

Desktop (please complete the following information):

  • OS: iOS14

Smartphone (please complete the following information):

  • Device: iPhone11
  • OS: iOS14.3

Additional context
NA

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions