Polymap4 / polymap4-rhei

Components for domain specific apps
0 stars 2 forks source link

[MdListViewer] Text is cut off at bottom in second line #21

Closed joergreichert closed 7 years ago

joergreichert commented 8 years ago

The cell height (and tile height) have to be compatible with the current (default) font height. If the cell height is too small, the text is cut off at the bottom. So either the font size is adjusted statically (e.g. in CSS or Java code) or the cell height / tiles height is adjusted according to the default font height of the currently used font.

Problem is, that you cannot access the default cell font, you can only access the font of the tree.

GC gc = new GC(getControl()); // control == tree
FontMetrics fontMetrics = gc.getFontMetrics();
gc.dispose();
int defaultFontHeight = fontMetrics.getHeight(); // 19

When setting explicitely the font, you can calculate its height and use it for setting the cell height.

Font font = MdAppDesign.font( FontStyle.Subhead );
int fontHeight = font.getFontData()[ 0 ].getHeight(); // 15

Please also note the MD spec for list (http://www.google.com/design/spec/components/lists.html#lists-behavior) defining height of the tiles.

fb71 commented 7 years ago

Just increases height of second line. Seems to work.