haganbmj / MagicSetEditor2

Magic Set Editor is a program for designing trading cards
Other
17 stars 7 forks source link

Fix single-line fields not scaling fonts #75

Open CajunAvenger opened 4 months ago

CajunAvenger commented 4 months ago

TextViewer::prepareLinesAtScale has a parameter stop_if_too_long to help it decide when to shrink text, but this is always false for text fields that aren't multi line, so autoshrink fails to apply to them. this PR sets the intial param to true for single line fields so auto-shrink will kick in as long as scale down to is defined.

the instance on line 453 remains false; this is only called when scale down to is not defined so doing the same here would cause text not to render if it overflows, instead it continues the current behavior of squishing text horizontally.

CajunAvenger commented 4 months ago

k issue with this. always-symbol fields ignore the scale down to thing, which means casting cost scales down to fit the tiny box rather than templates extending the tiny box. applied a patch fix where the new fix just skips always-symbol fields, but there's probably a better correction that should be done

haganbmj commented 4 months ago

k issue with this. always-symbol fields ignore the scale down to thing, which means casting cost scales down to fit the tiny box rather than templates extending the tiny box. applied a patch fix where the new fix just skips always-symbol fields, but there's probably a better correction that should be done

Good catch and nice find on this in the first place. I haven't really dug through that area of code much since all the text processing in MSE is pretty custom, so not sure if there's a more specific way to approach this.

I haven't looked at the code in a while so let me try and carve out some time to sit down and poke at it.

CajunAvenger commented 4 months ago

run into another issue where having scale down to on a field is scaling the font down by default, even when it doesn't need to. this occurs without these changes, but i can't find why and kinda undercuts the bug fix. might be over my head after all.