Closed
Bug 1154402
Opened 10 years ago
Closed 10 years ago
Use system font instead of hardcoded Helvetica Neue
Categories
(Firefox for iOS :: General, defect)
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:)
Assignee | ||
Comment 1•10 years ago
|
||
Sorry so the above example would actually be:
cell.textLabel?.font = UIFont.systemFontOfSize(17, weight: UIFontWeightNormal)
Assignee | ||
Updated•10 years ago
|
tracking-fennec: --- → +
Comment 2•10 years ago
|
||
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?
Comment 3•10 years ago
|
||
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!"
Comment 4•10 years ago
|
||
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 | ||
Updated•10 years ago
|
Assignee: nobody → sarentz
Assignee | ||
Updated•10 years ago
|
Status: NEW → ASSIGNED
Assignee | ||
Comment 5•10 years ago
|
||
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)
Assignee | ||
Comment 6•10 years ago
|
||
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?
Comment 7•10 years ago
|
||
Comment on attachment 8614837 [details] [review]
PR: https://github.com/mozilla/firefox-ios/pull/553
LGTM!
Attachment #8614837 -
Flags: review?(sleroux) → review+
Comment 8•10 years ago
|
||
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.
Assignee | ||
Updated•10 years ago
|
Status: ASSIGNED → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•