Skip to content
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

Fix deprecated API usage for embedded fonts on iOS/Catalyst 18.0+ #25025

Closed

Conversation

drasticactions
Copy link
Contributor

Description of Change

CTFontManager.RegisterGraphicsFont throws a deprecation warning for iOS 18+. This was breaking my build.

https://github.com/xamarin/xamarin-macios/blob/main/src/CoreText/CTFontManager.cs#L445-L462

This PR attempts to change it to a supported API for these platforms, using CTFontManager.RegisterFontsForUrl. To do this, I believe, we need to write the font to a file on disk (in this case, in temp storage in the users application cache) and then register it.

@drasticactions drasticactions requested a review from a team as a code owner October 1, 2024 12:33
@rmarinho
Copy link
Member

rmarinho commented Oct 1, 2024

I think this should target to net9 when we merge the #25017

@PureWeen
Copy link
Member

PureWeen commented Oct 2, 2024

/rebase

@github-actions github-actions bot force-pushed the dev/timill/embedded-font-ios branch from 7cff256 to 4b9e5e3 Compare October 2, 2024 16:29
@rmarinho
Copy link
Member

rmarinho commented Oct 2, 2024

Net9 is on iOS18 XCODE16 can we target that branch ?

@PureWeen
Copy link
Member

PureWeen commented Oct 2, 2024

Net9 is on iOS18 XCODE16 can we target that branch ?

I think this is fine for main so that if anyone is on XCODE 16 locally they are still able to compile main until we merge net9.0 into main

@PureWeen
Copy link
Member

PureWeen commented Oct 2, 2024

/backport to net9.0

Copy link
Contributor

github-actions bot commented Oct 2, 2024

Started backporting to net9.0: https://github.com/dotnet/maui/actions/runs/11148029710

Copy link
Contributor

github-actions bot commented Oct 2, 2024

@PureWeen backporting to net9.0 failed, the patch most likely resulted in conflicts:

$ git am --3way --empty=keep --ignore-whitespace --keep-non-patch changes.patch

Applying: Fix deprecated API usage for embedded fonts on iOS/Catalyst
.git/rebase-apply/patch:41: trailing whitespace.
				
warning: 1 line adds whitespace errors.
Using index info to reconstruct a base tree...
M	src/Core/src/Fonts/EmbeddedFontLoader.iOS.cs
Falling back to patching base and 3-way merge...
Auto-merging src/Core/src/Fonts/EmbeddedFontLoader.iOS.cs
CONFLICT (content): Merge conflict in src/Core/src/Fonts/EmbeddedFontLoader.iOS.cs
error: Failed to merge in the changes.
hint: Use 'git am --show-current-patch=diff' to see the failed patch
hint: When you have resolved this problem, run "git am --continue".
hint: If you prefer to skip this patch, run "git am --skip" instead.
hint: To restore the original branch and stop patching, run "git am --abort".
hint: Disable this message with "git config advice.mergeConflict false"
Patch failed at 0001 Fix deprecated API usage for embedded fonts on iOS/Catalyst
Error: The process '/usr/bin/git' failed with exit code 128

Please backport manually!

Copy link
Contributor

github-actions bot commented Oct 2, 2024

@PureWeen an error occurred while backporting to net9.0, please check the run log for details!

Error: git am failed, most likely due to a merge conflict.

Copy link
Member

@PureWeen PureWeen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't merge until
#25055

is green and merged

@PureWeen
Copy link
Member

PureWeen commented Oct 4, 2024

Because we merged
#25092 to fix the compile error on main

I'm going to close this PR in favor of
#25055

@PureWeen PureWeen closed this Oct 4, 2024
@github-actions github-actions bot locked and limited conversation to collaborators Nov 6, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants