Skip to content

FB13203965: NSAttributedString.DocumentAttributeKey.defaultFontExcluded does not work when converting NSAttributedString to RTF #420

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
sindresorhus opened this issue Sep 25, 2023 · 0 comments

Comments

@sindresorhus
Copy link
Member

  • Date: 2023-09-25
  • Resolution: Open
  • Area: Foundation
  • OS: macOS 14
  • Type: Incorrect/Unexpected Behavior

Description

https://developer.apple.com/documentation/foundation/nsattributedstring/documentattributekey/4273964-defaultfontexcluded

It does not exclude the default font.

To reproduce, run the attached sample project.

The output will be:

Optional("{\\rtf1\\ansi\\ansicpg1252\\cocoartf2757\n\\cocoatextscaling0\\cocoaplatform0{\\fonttbl\\f0\\fswiss\\fcharset0 Helvetica;}\n{\\colortbl;\\red255\\green255\\blue255;}\n{\\*\\expandedcolortbl;;}\n\\pard\\tx560\\tx1120\\tx1680\\tx2240\\tx2800\\tx3360\\tx3920\\tx4480\\tx5040\\tx5600\\tx6160\\tx6720\\pardirnatural\\partightenfactor0\n\n\\f0\\fs24 \\cf0 Hello}")

Notice Helvetica; in there, which should not be there because we passed .defaultFontExcluded: true.

Files

Sample project.zip

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant