dotnet / dotnet/macios

Modernize UIFont/NSFont

Open
#16,926 0 comments 1 reaction 0 assignees View on GitHub
api-bindings enhancement good first issue
Dominant language
C#
Stars
2.9k
Forks
576
Avg merge
2d 17h
Merged PRs (30d)
108

Description

Our bindings for UIFont/NSFont are *old*, and that shows.

We can improve these bindings in numerous ways:

* Share the source code between these two types, the API is quite similar:
* Merge the api definitions and moving them into src/xkit.cs
* Merge src/AppKit/NSFont.cs and src/UIKit/UIFont.cs into a new src/XKit/XFont.cs
* Fix/enable nullability.
* Improve naming to our current standards:
* Methods should have a verb: `SystemFontOfSize` -> `CreateSystemFontOfSize`.
* Methods should not have unnecessary suffixes: `SystemFontOfSize` -> `SystemFont`.
* The actual method name in this case should be: `SystemFontOfSize` -> `CreateSystemFont`.
* Ensure that all static methods returning fonts return a new instance.
* Also add tests that calls these static methods and dispose the return value.
* This should also likely affect naming: these methods should use the `Create` verb (which implies that something got created), vs `Get` (which makes it sound like a lighter-weight property getter).
* In general try to have the same API in both UIFont and NSFont (for instance UIFont implements the == and != operators, while NSFont doesn't - this involves figuring out whether the UIFont operators are really necessary, if so, if the same applies to NSFont, and if so, implement the operators for NSFont as well).

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.