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 incorrect font-weight mapping based on Mozilla documentation #35

Merged
merged 2 commits into from
Sep 3, 2023

Conversation

5anniversary
Copy link
Contributor

Summary

This PR aims to fix the incorrect mapping of font-weight values in the switch statement. The original implementation had an issue where UIFont.Weight.medium.rawValue would incorrectly map to a bold weight due to the raw value being 0.23000000417232513.

Changes

  • Updated the switch statement to map the font-weight values correctly based on Mozilla's documentation (MDN Web Docs).

Why this is important

The issue can cause unexpected behavior in text rendering, especially when comparing UIFont.Weight.medium.rawValue and weight.rawValue.

Test Plan

  1. Validate the new font-weight values against Mozilla's documentation.
  2. Run existing unit tests to ensure no regressions.
  3. Add new unit tests to confirm the correct mapping of font-weight values.

Checklist

  • I have tested these changes locally
  • I have updated the documentation accordingly

@zhgchgli0718 zhgchgli0718 self-requested a review August 28, 2023 07:58
Copy link
Member

@zhgchgli0718 zhgchgli0718 left a comment

Choose a reason for hiding this comment

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

Thank you for your contribution.

@zhgchgli0718 zhgchgli0718 reopened this Aug 28, 2023
@zhgchgli0718 zhgchgli0718 merged commit 9f70d94 into ZhgChgLi:main Sep 3, 2023
1 check failed
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

Successfully merging this pull request may close these issues.

2 participants