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

iOS: Fix font weight resolution #15162

Closed
wants to merge 1 commit into from
Closed

iOS: Fix font weight resolution #15162

wants to merge 1 commit into from

Commits on Jul 24, 2017

  1. iOS: Fix font weight resolution

    **Issue:**
    Some fonts are defined with weights that don't match with the UIFontWeight constants.
    
    **Example:**
    UIFontWeightTraits for Roboto font
    Light: -0.230
    Thin: -0.365
    
    Currently, the UIFontWeightTrait is always used if it != 0.0, and given the UIFontWeight constants for Light and Thin:
    UIFontWeightThin -0.6
    UIFontWeightLight -0.4
    
    A style font weight of "300" or "200" will both resolve to Roboto-Thin as its weight -0.365 is closer to -0.4 (UIFontWeightLight) and -0.6 (UIFontWeightThin) than -0.230 (Roboto-Light).
    
    **Proposed fix:**
    When resolving `getWeightOfFont` try to match the name of weight to the name of the font first, and guess the font with UIFontWeightTrait as the fall back.
    
    **Test Plan:**
    Attempt to display Roboto at weights "200" and "300" and Roboto-Thin and Roboto-Light should be displayed correctly.
    Kip Ricker committed Jul 24, 2017
    Configuration menu
    Copy the full SHA
    05c3755 View commit details
    Browse the repository at this point in the history