title: In the attempt to fix line spacing with custom font, it gets rid of the font style with setParagraphAttributes
body: <p>(Edit: all fonts are reset back to this default font, Not sure the name of the font)</p>
  <p>I have been attempting to make a window for a game I am developing that uses text based adventure. I have been able to implement custom font and I also have been able to get it all working but I am having an issue where the line spacing is way to small, so small in fact that you can't actually read some of the text... I have been using the <code>setParagraphAttributes</code> to set the line spacing but it also seems to reset the custom font, here is my code:</p>
  <pre class="lang-java prettyprint-override"><code>import javax.swing.*;
  import javax.swing.text.*;
  import java.awt.*;
  import java.io.*;
  
  public class GUI {
      public static final int sizeX = 1280;
      public static final int sizeY = 680;
      public static JTextPane textBox;
  
      public static JPanel createGui() {
          //Create panels
          JPanel mainPanel = new JPanel();
          JPanel textPanel = new JPanel();
          JPanel inventoryPanel = new JPanel();
  
          //Setup panel details
          mainPanel.setPreferredSize(new Dimension(sizeX, sizeY));
          textPanel.setBackground(Color.BLACK);
          inventoryPanel.setBackground(new Color(71, 22, 22));
  
          //Setup attributes
          SimpleAttributeSet attributeSet = new SimpleAttributeSet();  
          MutableAttributeSet set = new SimpleAttributeSet();
          StyleConstants.setForeground(attributeSet, Color.white);
          StyleConstants.setLineSpacing(set, 1.05f);
  
          //Create custom font
          try {
              Font customFont = Font.createFont(Font.TRUETYPE_FONT, new File(&quot;Main/resources/font.ttf&quot;)).deriveFont(10f);
              GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
              ge.registerFont(customFont);
  
              textBox = new JTextPane();
              textBox.setFont(customFont);
          } catch (IOException|FontFormatException e) {
              System.out.println(&quot;&lt;Error&gt; Font failure&quot;);
          }
  
          //Setup text panel
          textBox.setCharacterAttributes(attributeSet, true);
          textBox.setParagraphAttributes(set, true); //This is causing issues with the custom font
          textBox.setAutoscrolls(true);
          textBox.setEditable(true);
          textBox.setBackground(Color.black);
          textBox.setText(&quot;TextBox with some text I came up with to find out if it worked or not XD&quot;);
  
          //Setup GUI layout
          textPanel.add(textBox);
          mainPanel.setLayout(new GridLayout(1,2));
          textPanel.setLayout(new BoxLayout(textPanel, FlowLayout.LEADING));
          mainPanel.add(textPanel);
          mainPanel.add(inventoryPanel);
  
          //Return GUI to window
          return mainPanel;
      }
  }
  </code></pre>
  <p>Having listened to a few of the responses I edited it and here is the code for the JFrame itself:</p>
  <pre class="lang-java prettyprint-override"><code>import javax.swing.*;
  
  public class Window extends JFrame{
      public Window() {
          setTitle(&quot;Window&quot;);
          setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
          add(GUI.createGui());
          setResizable(false);
          pack();
          ImageIcon img = new ImageIcon(&quot;Main/resources/Icon.png&quot;);
          setIconImage(img.getImage());
          setLocationRelativeTo(null);
          setVisible(true);
      }
  }
  </code></pre>
  <p>if you have an answer, please keep it simple as I am new to java (I know window UI is a bit complex for a new java user, but I would love to see it in my game).</p>
  <p><em>Sorry if there is any weird things in the code, I am really new to java and I haven't gotten around to optimizing yet because I just want to get something that works</em></p>