Skip to content
This repository has been archived by the owner on Oct 26, 2021. It is now read-only.

Use Monospace font for Address Labels #127

Open
wants to merge 4 commits into
base: develop
Choose a base branch
from

Conversation

borwahs
Copy link
Contributor

@borwahs borwahs commented Mar 30, 2019

  • Set font for Address UILabels to monospace (Menlo).

Copy link
Contributor

@einsteinx2 einsteinx2 left a comment

Choose a reason for hiding this comment

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

I noticed you're using Menlo here. There are other various places in the code that use monospacedDigitSystemFont, which I think doesn't look as good as Menlo. We should standardize on one or the other, so can you please replace those with Menlo as well?

A clean way to do this that would allow us to easily change the font in the future would be to add an extension file called UIFont+Monospaced.swift in the extensions folder, and add a class func balanceMonospacedDigitSystemFont(ofSize fontSize: CGFloat, weight: UIFont.Weight) -> UIFont function so we only have to change the font in one place.

@@ -14,9 +14,10 @@ class WalletTableViewCell: UITableViewCell {

let addressLabel: UILabel = {
let label = UILabel()
label.font = UIFont.systemFont(ofSize: 12)
label.font = UIFont.init(name: "Menlo", size: 12.0)
Copy link
Contributor

Choose a reason for hiding this comment

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

the .init can be removed

@@ -35,7 +35,7 @@ class WalletInfoView: UIView {

private let addressLabel: UILabel = {
let addressLabel = UILabel()
addressLabel.font = UIFont.monospacedDigitSystemFont(ofSize: 12, weight: .regular)
addressLabel.font = UIFont.init(name: "Menlo", size: 12.0)
Copy link
Contributor

Choose a reason for hiding this comment

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

the .init can be removed

@borwahs
Copy link
Contributor Author

borwahs commented Mar 30, 2019

On it. Was debating whether to build an extension and change the existing ones.

@borwahs
Copy link
Contributor Author

borwahs commented Mar 30, 2019

See comparison of pre and post Menlo usage below.

Couple of notes:

  • Menlo only has Bold and Regular for the font weight so I use Bold if medium/heavy/bold are set.
  • There is no "light" option so I default to Regular.

pre-new
prepost2

@borwahs
Copy link
Contributor Author

borwahs commented Mar 30, 2019

Thoughts on changing the CDP Modal Info view numbers to the monospace font?

@ricburton
Copy link
Member

Totally agree @borwahs. There are lots of places where I want to use monospaced fonts and this really helps me see how to do it. Thanks!

I'll let Ben review this before merging.

@ricburton
Copy link
Member

Really interesting discussion here: https://stackoverflow.com/questions/38148073/uifont-monospaceddigitsystemfontofsize-not-really-monospaced

In all the designs I use SF Mono but that is actually not allowed apart from on Apple's products.

I think we need to find a monospaced font that works well for the project.

I tweeted about this before. Will look at the suggestions.

@borwahs
Copy link
Contributor Author

borwahs commented Mar 31, 2019

@ricburton // nice find on that SO question. I was confused why monospaced system don’t was not actually using it. Looks like the adjust font to size of container option breaks it.

@einsteinx2
Copy link
Contributor

Yeah it’s really annoying they don’t make it available... we snuck it into balance for Mac and they approved it but they could reject at any time so it’s better to find a different one that’s fully allowed

@einsteinx2
Copy link
Contributor

Will hold off on merging this until we settle on the font we want.

@einsteinx2
Copy link
Contributor

Also for the name of the extension swift file, I accidentally wrote UIFont-Monospaced.swift when it should be UIFont+Monospaced.swift

@borwahs borwahs force-pushed the set-address-font-to-monospace branch from 7295798 to c133646 Compare April 2, 2019 02:20
@borwahs
Copy link
Contributor Author

borwahs commented Apr 2, 2019

I did something odd here. I think I might have not branched off of develop. Not sure why there are so many conflicts. Going to look into it and repush.

@borwahs borwahs force-pushed the set-address-font-to-monospace branch from c133646 to 7d0f64e Compare April 2, 2019 02:36
@borwahs borwahs force-pushed the set-address-font-to-monospace branch from 7d0f64e to 1db3eac Compare April 2, 2019 02:40
@borwahs
Copy link
Contributor Author

borwahs commented Apr 2, 2019

fixed merge issues. think i accidentally rebased master at some point.

@einsteinx2
Copy link
Contributor

@ricburton are you happy with Menlo as the font?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants