Hi all,
I set the size of my_label like this:
...
// Identify 'font' here
...
m_lbName.setJustificationType(Justification::horizontallyJustified);
m_lbName.setFont(font);
m_lbName.setText(name, NotificationType::dontSendNotification);
m_width = font.getStringWidth(name) + m_lbName.getBorderSize().getLeftAndRight();
...
m_lbName.setBounds(0, 0, m_width, 25);
...
The m_lbName
showing with missing some final characters.
Ex: name = "test"
=> show image:
It missed some characters.
Does anyone know why? Thank you all.
1 Like
if you look inside the Label class, how it draws the text, you’ll see that it calls
auto textArea = getLabelBorderSize (label).subtractedFrom (label.getLocalBounds());
g.drawFittedText (label.getText(), textArea, label.getJustificationType(),
jmax (1, (int) (textArea.getHeight() / font.getHeight())),
label.getMinimumHorizontalScale());
The implementation of Graphics::drawFittedText() is squishing it.
You can dig deeper into that if you really want to find out where the squishing is actually happening.