Skip to content

Fix incorrect calc width in WrapTextSegment#997

Open
KirillSerogodsky wants to merge 4 commits intoblish-hud:devfrom
KirillSerogodsky:dev
Open

Fix incorrect calc width in WrapTextSegment#997
KirillSerogodsky wants to merge 4 commits intoblish-hud:devfrom
KirillSerogodsky:dev

Conversation

@KirillSerogodsky
Copy link
Contributor

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
Contributor 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
Contributor Author

I found a better solution

DefaultFont12
image
DefaultFont14
image
DefaultFont16
image
DefaultFont18
image
DefaultFont32
image

@KirillSerogodsky
Copy link
Contributor Author

Module list before
image
image

Mystic Crafting before
image
image
image

Module info before
image

Pathing markers before
image

@KirillSerogodsky
Copy link
Contributor Author

Module list after
image
image

Mystic Crafting after
image
image
image

Module info after
image

Pathing markers after
image

@KirillSerogodsky
Copy link
Contributor Author

Legendary crafting before
image
after
image

@KirillSerogodsky
Copy link
Contributor 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