Open vlsi opened 4 years ago
Does this happen with the default font size or only a specific one? I'm not getting this behaviour in windows with the default size.
You may also try to remove #patchMacOsFonts
to see is related to the system font.
This happens with the default font in macOS.
You may also try to remove #patchMacOsFonts to see is related to the system font.
I've removed patchMacOsFonts
and the issue is still there.
What baseline does the macOS system font have for standard text characters i.e.
what does Font#getBaselineFor
return?
font.getBaselineFor('a') = 0 javax.swing.plaf.FontUIResource[family=Lucida Grande,name=Lucida Grande,style=plain,size=12]
font.getBaselineFor('a') = 0 javax.swing.plaf.FontUIResource[family=Dialog,name=Dialog,style=plain,size=12]
How about the font height? I suspect that the issue is that the font is generally shifted in textfields with odd height.
Font f = defaults.getFont("Table.font");
System.out.println("f = " + f);
System.out.println("font.getBaselineFor('a') = " + f.getBaselineFor('a'));
System.out.println(
"FontDesignMetrics.getMetrics(font).getHeight() = " + FontDesignMetrics.getMetrics(f).getHeight());
=>
f = javax.swing.plaf.FontUIResource[family=.SF NS Text,name=.SF NS Text,style=plain,size=12]
font.getBaselineFor('a') = 0
FontDesignMetrics.getMetrics(font).getHeight() = 15
Please add
@Override
protected Rectangle getVisibleEditorRect() {
Rectangle rect = super.getVisibleEditorRect();
System.out.println(rect);
return rect;
}
in DarkTextUI
. What is returned for odd/even row height?
table.getRowHeight() = 23
java.awt.Rectangle[x=5,y=2,width=78,height=18]
table.getRowHeight() = 22
java.awt.Rectangle[x=5,y=2,width=78,height=17]
Is the issue still occurring? When increasing the rowHeight in TableDemo
the Text should only change position every two steps.
Test case:
1) Add the following to
TableDemo
2) Try editing the cells
Actual results: text in editable fields moves up by 1px or so.
Just in case you wonder: JMeter adjusts
rowHeight
based on the font size and zoom level. At certain zoom levels the computedrowHeight
becomes odd.