Closed Bug 1154402 Opened 9 years ago Closed 9 years ago

Use system font instead of hardcoded Helvetica Neue

Categories

(Firefox for iOS :: General, defect)

x86
macOS
defect
Not set
normal

Tracking

()

RESOLVED FIXED
Tracking Status
fennec + ---

People

(Reporter: st3fan, Assigned: st3fan)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

We have a lot of places where we hardcode Helvetica Neue and for example do things like:

  cell.textLabel?.font = UIFont(name: UIAccessibilityIsBoldTextEnabled()
      ? "HelveticaNeue-Medium" : "HelveticaNeue", size: 17)

I found out that when we replace this with:

  cell.textLabel?.font = UIFont.systemFontOfSize(17, weight: UIFontWeightMedium)

iOS will automatically do the right thing when accessibility 'bold fonts' is enabled.

So I am going to suggest to change the hardcoded occurences of Helvetica Neue to UIFont.systemFont(_ size:, weight:)
Sorry so the above example would actually be:

  cell.textLabel?.font = UIFont.systemFontOfSize(17, weight: UIFontWeightNormal)
tracking-fennec: --- → +
I ran into UIFont.preferredFontForTextStyle today. That would also allow our font sizes to adjust to the system setting for size (not just bold). Do we want that?
We should be good citizens and respect the user choices from Settings/General/Accessibility. With an adaptive layout this should indeed not be a problem at all. So I'd vote for "yes, we want that!"
I agree with Marco. In general, it would be best for consistency on many levels (including accessibility) to use Dynamic Type (i.e. UIFont.preferredFontForTextStyle) where possible and where the designers allow that / OK that :-)
Assignee: nobody → sarentz
Status: NEW → ASSIGNED
This patch replaces calls to `UIFont(name:size:)` with `UIFont.systemFontWithSize(,weight:)`. This also replaces the usage of `UIAccessibilityIsBoldTextEnabled()` because systemFontWithName() will automatically return a bolder font when the user has enabled that feature.
Attachment #8614837 - Flags: review?(sleroux)
The UIFont.preferredFontForTextStyle() call looks interesting. If we can use this then lets do this in a followup bug. I see it uses text styles like 'Heading', 'Body' and 'Footnote'. I am not entirely sure how that would map to our designs. Maybe that is more for structured content?
Ya I've heard good things about UIFont.preferredFontForTextStyle but also have heard that the number of sizes you can choose from is limited to the following choices:

let UIFontTextStyleHeadline: String
let UIFontTextStyleSubheadline: String
let UIFontTextStyleBody: String
let UIFontTextStyleFootnote: String
let UIFontTextStyleCaption1: String
let UIFontTextStyleCaption2: String 

The other thing to watch out for is the font sizes can change depending on the user's text size preferences which can cause layouts to break if we made any assumptions about the size of any labels.
Status: ASSIGNED → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: