Open phronmophobic opened 2 years ago
I'm confused. You say that FontMetrics is used in the java2d backend but I'm still only seeing LineMetrics used there. In searching the repo, I did find a use of FontMetrics in the cljfx backend though. https://github.com/phronmophobic/membrane/blob/d3198021d793fac0e3eac0500996f536076087f7/src/membrane/cljfx.clj#L465
Yes, you're right. I guess I was a little too hasty with my diagnosis.
line height decremented in LabelRaw draw https://github.com/phronmophobic/membrane/blob/87c8ec2d0e749c9ccc6eaeb3ede432f3fd8c3b33/src/membrane/java2d.clj#L280
line height decremented in text-bounds https://github.com/phronmophobic/membrane/blob/e547cdcec33239b3920428a47b9966b93d300be8/src/membrane/java2d.clj#L251
Oh, actually line height is decremented in additional places...
Currently,
.getHeight
from FontMetrics is used for line height (see here), but.getHeight
returns an integer which is subtly wrong. Instead, the line height should be calculated using LineMetrics (see here).This also affects text measurement and text selection.