bitburner-official / bitburner-src

Bitburner source code.
Other
837 stars 273 forks source link

UI: Added the ability to change the font size #1703

Closed G4mingJon4s closed 2 weeks ago

G4mingJon4s commented 1 month ago

Changed the following:

The default font size of the entire UI is different from the font size of the tail windows, because they are applied in a different way. MUI applies a scaling on the fontSize value the input sets. It has an internal font size of 16px and a fontSize value of 14 is scaled to the default rem value of 1rem. The tail window font size is applied through styles, so it is a direct pixel value. If this is something that bothers people, I can also add a scaling to the tail window font size to make it uniform with the general font size.

I also added display: inline-block to the span of each tail window line. This ensures the line height is correct for very small or very big font sizes. I couldn't find any styling implications from this, so nothing else should have changed. If I missed any issues that this creates, I'd be happy to fix them.

d0sboots commented 1 month ago

I was worried about the display: inline-block thing, but I see it only applies to string log output, and is skipped for rawPrint stuff. So that's fine.

Could you add some screenshots to the PR?

G4mingJon4s commented 1 month ago

Added Options: image

Default font size of 16px (14 in the options due to conversions): image

Setting the general font size to 10 (a displayed font size of about 11px): image

Setting the general font size to 20 (a displayed font size of about 23px): image

Default tail font size of 16px: image

Setting the tail font size to 12px: image

How the tail font size of 12px would look like without display: inline-block: image

Setting the tail font size to 20px: image

And setting the line height to 2 on top of that: image

So, after playing around a bit, I realized that it's pretty hard to get the tail and general font size to match, if it is not the default. I will convert the general font size input to be in pixels shortly.

G4mingJon4s commented 1 month ago

Also, I set a minimum font size of 5, which is about 6px. During my testing I set font sizes like 2 or 3, which made the UI unusable. To stop the user from messing up their UI to the point where they can't even revert them to the default, I found that about 6px is just on the edge where that's possible. If you think this limitation should be moved or isn't needed, I can remove it.

d0sboots commented 1 month ago

So, after playing around a bit, I realized that it's pretty hard to get the tail and general font size to match, if it is not the default. I will convert the general font size input to be in pixels shortly.

Agreed, I think it not being in pixels will confuse everyone, so I think that's the only thing I'm holding this back for.

G4mingJon4s commented 1 month ago