title: Custom font in JLabel is cut off
body: <p>I have a JLabel that I have set the custom font, "BP Diet" to it. If I add this to a JFrame, the text appears fine, but as soon as I change the layout of the JFrame to FlowLayout, the top of the text appears cut off. This same problem occurs when you add the JLabel to a JPanel and add that to the JFrame. I have the font available at <a href="http://www.hichris.com/more/files/BPdiet.otf" rel="nofollow noreferrer">http://www.hichris.com/more/files/BPdiet.otf</a></p>
  
  <p>Here is the code below:</p>
  
  <pre><code>import java.awt.*;
  import javax.swing.*;
  import java.io.*;
  import java.net.URL;
  
  public class FontSizeTest {
  
      public static void main(String[] args) {
          JFrame frame = new JFrame();
          frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
          JLabel label = new JLabel(
                  "AaBbCcDdEeFfGgHhIiJjKk");
          label.setFont(createFont());
          frame.add(label);
          frame.pack();
          frame.setMinimumSize(frame.getMinimumSize());
          frame.setVisible(true);
      }
  
      static Font createFont() {
          Font customFont = null;
          try {
              URL url = new URL("http://www.hichris.com/more/files/BPdiet.otf");
              InputStream is = url.openStream();
              customFont = Font.createFont(Font.TRUETYPE_FONT, is);
              GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
              ge.registerFont(customFont);
          } catch (Exception e) {
              e.printStackTrace();
          }
          return customFont.deriveFont(25f);
      }
  }
  </code></pre>
  
  <h2>As it should appear</h2>
  
  <p><img src="https://i.stack.imgur.com/9Q1qC.png" alt="Showing full font"></p>
  
  <h2>As it appears after <code>pack()</code></h2>
  
  <p><img src="https://i.stack.imgur.com/UaSFe.png" alt="As it first appears"></p>
  
  <h2>Bigger view pointing out the dots above i &amp; j</h2>
  
  <p><img src="https://i.stack.imgur.com/ULdTX.png" alt="As it first appears"></p>
  
  <p>Any help is appreciated!</p>