jfxtras-styles icon indicating copy to clipboard operation
jfxtras-styles copied to clipboard

Text kerning on Button changes when Button shrinks (after it's pressed)

Open dukke opened this issue 6 years ago • 8 comments

Text kerning on Button changes when Button shrinks (after it's pressed). I think this might be because JavaFX tries to preserve the same font size on a smaller space. Maybe changing the font size when the Button shrinks could be a solution.

  • In the following I'm pressing the top left button Normal Button: image

Button pressed: image

dukke avatar Dec 30 '18 19:12 dukke

...Not sure if this is actually that much important

dukke avatar Dec 30 '18 19:12 dukke

Hi @dukke , on screenshots not see difference, you can make gif? If i not mistake kerning also exists when click on fluent design button? No?

MairwunNx avatar Dec 30 '18 21:12 MairwunNx

Look at the position of the "B". Compare the distance on both screenshots between the "B" and the "u"

dukke avatar Dec 30 '18 21:12 dukke

@dukke Hi, yes, i see your small problem, you tried JVM font improve args?

-Dprism.lcdtext=false - it can be solution for it problem, see please and reply me :)

Usage Example: java -Dprism.lcdtext=false -jar JarExecutableFile.jar

Also, if you not like arguments, you can use System.setProperty("prism.lcdtext", "false")

MairwunNx avatar Jan 01 '19 17:01 MairwunNx

Yep, I already do that.

If you look at the code in the samples you'll see that flag being used. In my PC, a laptop, I needed that to fix the quality of the text rendering. That might not be needed on other monitors. That actually fixes text quality rendering only (I think). I don't think it interferes with anything else, like kerning and such. Anyway this is how I'm running JMetro's samples so it still has this problem with that flag set.

To fix this issue (although this issue might not be actually relevant) I think we might need to change the text size when the button shrinks. My thinking is that this happens because JavaFX tries to preserve the text size that was set and as the button shrinks the only way for the text to be smaller while preserving the text size is to mess with the kerning (making letters closer to each other). This is just an hypothesis, haven't actually verified it.

Thanks Pavel! 👍

dukke avatar Jan 01 '19 23:01 dukke

@dukke ok, i think it not critical bug :), it can be bug in JavaFx, not in your lib, i think it need to close :), or need do solution for it issue, e.g set font size +0.1, or other ways))) good luck with it !

MairwunNx avatar Jan 04 '19 15:01 MairwunNx

Yeah, it's probably not critical.

Setting font size to being a bit smaller might do the trick.

dukke avatar Jan 04 '19 15:01 dukke

Try :) Maybe it be normal solution :))

MairwunNx avatar Jan 04 '19 16:01 MairwunNx