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

Fix incorrect calc width in WrapTextSegment #997

Open
wants to merge 3 commits into
base: dev
Choose a base branch
from

Conversation

KirillSerogodsky
Copy link

MeasureString incorrectly calculates space width.

GameService.Content.DefaultFont16.MeasureString(" ").Width = 3
there's no problem with
GameService.Content.DefaultFont16.MeasureString("_").Width = 21

Discussion Reference

No

Is this a breaking change?

No

@KirillSerogodsky
Copy link
Author

KirillSerogodsky commented Jan 10, 2025

before
image
image
after
image
image

It's not perfect, but it works better

@dlamkins
Copy link
Member

Could you please share some more comparison screenshots of other wrapped text in Blish HUD (and perhaps in a module or two)? I want to make sure this doesn't look weird with anything existing.

@KirillSerogodsky
Copy link
Author

I found a better solution

DefaultFont12
image
DefaultFont14
image
DefaultFont16
image
DefaultFont18
image
DefaultFont32
image

@KirillSerogodsky
Copy link
Author

Module list before
image
image

Mystic Crafting before
image
image
image

Module info before
image

Pathing markers before
image

@KirillSerogodsky
Copy link
Author

Module list after
image
image

Mystic Crafting after
image
image
image

Module info after
image

Pathing markers after
image

@KirillSerogodsky
Copy link
Author

Legendary crafting before
image
after
image

@KirillSerogodsky
Copy link
Author

Farming Tracker before
image
after
image

@KirillSerogodsky KirillSerogodsky changed the title Fix incorrect calc space width in WrapTextSegment Fix incorrect calc width in WrapTextSegment Jan 12, 2025
@Flyga-M
Copy link
Contributor

Flyga-M commented Jan 12, 2025

While this seems to fix the issue well enough, I think it does make sense to implement a custom MeasureString(..) method (in the future?) that uses XAdvance instead of Width to determine glyph sizes.

MeasureString(..) is just used in so many places, that a change like that would affect many places in Core.

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

Successfully merging this pull request may close these issues.

3 participants