Skip to content

Commit

Permalink
Use smaller row heights on Mac if smallFonts specified
Browse files Browse the repository at this point in the history
- If small fonts are set with -Dorg.eclipse.swt.internal.carbon.smallFonts then use smaller vertical padding
- This maintains backward compatibility
- See discussion at eclipse-platform/eclipse.platform.ui#1674
  • Loading branch information
Phillipus committed Feb 20, 2024
1 parent fc65397 commit c55cbc2
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1182,7 +1182,8 @@ void setFont (NSFont font) {
super.setFont (font);
double ascent = font.ascender ();
double descent = -font.descender () + font.leading ();
((NSTableView)view).setRowHeight ((int)Math.ceil (ascent + descent) + VERTICAL_CELL_PADDING);
// If small fonts are set with -Dorg.eclipse.swt.internal.carbon.smallFonts then use smaller vertical padding
((NSTableView)view).setRowHeight ((int)Math.ceil (ascent + descent) + (display.smallFonts ? 1 : VERTICAL_CELL_PADDING));
setScrollWidth();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2825,7 +2825,8 @@ void setItemHeight (Image image, NSFont font, boolean set) {
if (font == null) font = getFont ().handle;
double ascent = font.ascender ();
double descent = -font.descender () + font.leading ();
int height = (int)Math.ceil (ascent + descent) + VERTICAL_CELL_PADDING;
// If small fonts are set with -Dorg.eclipse.swt.internal.carbon.smallFonts then use smaller vertical padding
int height = (int)Math.ceil (ascent + descent) + (display.smallFonts ? 1 : VERTICAL_CELL_PADDING);
Rectangle bounds = image != null ? image.getBounds () : imageBounds;
if (bounds != null) {
imageBounds = bounds;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3173,7 +3173,8 @@ void setItemHeight (Image image, NSFont font, boolean set) {
if (font == null) font = getFont ().handle;
double ascent = font.ascender ();
double descent = -font.descender () + font.leading ();
int height = (int)Math.ceil (ascent + descent) + VERTICAL_CELL_PADDING;
// If small fonts are set with -Dorg.eclipse.swt.internal.carbon.smallFonts then use smaller vertical padding
int height = (int)Math.ceil (ascent + descent) + (display.smallFonts ? 1 : VERTICAL_CELL_PADDING);
Rectangle bounds = image != null ? image.getBounds () : imageBounds;
if (bounds != null) {
imageBounds = bounds;
Expand Down

0 comments on commit c55cbc2

Please sign in to comment.