title: Issue displaying font with java swing
body: <h3>Hi,</h3>
  <p>So there is my problem :
  I can't understand why this little program :</p>
  <pre><code>package tests;
  
  import java.awt.Dimension;
  import java.awt.Font;
  import java.awt.GraphicsEnvironment;
  import java.awt.GridLayout;
  import java.text.AttributedCharacterIterator.Attribute;
  import java.util.Map;
  
  import javax.swing.BorderFactory;
  import javax.swing.JFrame;
  import javax.swing.JPanel;
  import javax.swing.JTextArea;
  import javax.swing.SwingUtilities;
  
  final class FontTest implements Runnable {
      public static void main(String[]arguments_) {
          SwingUtilities.invokeLater(new FontTest());
      }
      private String newLine = System.getProperty(&quot;line.separator&quot;);
      @Override
      public void run() {
          JFrame frame_ = new JFrame(&quot;FontTest&quot;);
          JPanel panel_ = new JPanel(new GridLayout(1, 2));
          JTextArea area_1 = new JTextArea(), area_2 = new JTextArea();
          Font[]all_fonts = GraphicsEnvironment
                         .getLocalGraphicsEnvironment().getAllFonts();
          // picking 2 fonts with different predefined specificities
          // Arial Bold Italic and Bahnschrift Bold Condensed
          Font font_1 = all_fonts[6], font_2 = all_fonts[13];
          Map&lt;? extends Attribute, ?&gt; map_1 = font_1.getAttributes()
                                    , map_2 = font_2.getAttributes();
          setTextArea(area_1, new Font(map_1));
          setTextArea(area_2, new Font(map_2));
          panel_.setPreferredSize(new Dimension(1080, 240));
          panel_.add(area_1);
          panel_.add(area_2);
          frame_.add(panel_);
          frame_.pack();
          frame_.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
          frame_.setLocationRelativeTo(null);
          frame_.setVisible(true);
      }
      private void setTextArea(JTextArea area_, Font font_) {
          area_.setFont(font_.deriveFont(14.f));
          area_.setBorder(BorderFactory.createTitledBorder(area_.getFont().getName()));
          area_.append(newLine);
          for(Object o : area_.getFont().getAttributes().entrySet()) {
              area_.append(o.toString());
              area_.append(newLine);
          }
          area_.append(newLine);
          area_.append(area_.getFont().toString());
          for(Attribute a : font_.getAvailableAttributes()) {
              System.out.println(a);
          }
      }
  }
  </code></pre>
  <p>is showing this when executing :
  <a href="https://i.stack.imgur.com/uX6tl.png" rel="nofollow noreferrer">JFrame showing 2 Fonts thru their name, attributes, and constructor, both irrelevant</a></p>
  <ul>
  <li><p>Why <code>TextAttribute</code> are <code>null</code> for width, posture and weight (and all others except size and family) since font's name suggests some value ?</p>
  </li>
  <li><p>Why the constructors (<code>font_.toString()</code>) describe a plain style since they should be bold+italic or bold ?</p>
  </li>
  <li><p>Why the first Font (Arial) is actually bold and italic since its attributes AND constructor say it's not ?</p>
  </li>
  <li><p>Why the second Font (Bahnschrift) is neither bold nor condensed, since its attributes AND constructor are the same than the first Font ?</p>
  </li>
  </ul>
  <p>Please, thanks to help me understanding that...</p>
  <p>Edit :</p>
  <pre><code>for(Attribute a : font_.getAvailableAttributes()) {
      System.out.println(a);
  }
  </code></pre>
  <ul>
  <li>for the first font (Arial Bold Italic) :</li>
  </ul>
  <pre><code>java.awt.font.TextAttribute(family)
  java.awt.font.TextAttribute(weight)
  java.awt.font.TextAttribute(width)
  java.awt.font.TextAttribute(posture)
  java.awt.font.TextAttribute(size)
  java.awt.font.TextAttribute(transform)
  java.awt.font.TextAttribute(superscript)
  java.awt.font.TextAttribute(char_replacement)
  java.awt.font.TextAttribute(foreground)
  java.awt.font.TextAttribute(background)
  java.awt.font.TextAttribute(underline)
  java.awt.font.TextAttribute(strikethrough)
  java.awt.font.TextAttribute(run_direction)
  java.awt.font.TextAttribute(bidi_embedding)
  java.awt.font.TextAttribute(justification)
  java.awt.font.TextAttribute(input method highlight)
  java.awt.font.TextAttribute(input method underline)
  java.awt.font.TextAttribute(swap_colors)
  java.awt.font.TextAttribute(numeric_shaping)
  java.awt.font.TextAttribute(kerning)
  java.awt.font.TextAttribute(ligatures)
  java.awt.font.TextAttribute(tracking)
  </code></pre>
  <ul>
  <li>And for the second one (Bahnschrift Bold Condensed) :</li>
  </ul>
  <pre><code>java.awt.font.TextAttribute(family)
  java.awt.font.TextAttribute(weight)
  java.awt.font.TextAttribute(width)
  java.awt.font.TextAttribute(posture)
  java.awt.font.TextAttribute(size)
  java.awt.font.TextAttribute(transform)
  java.awt.font.TextAttribute(superscript)
  java.awt.font.TextAttribute(char_replacement)
  java.awt.font.TextAttribute(foreground)
  java.awt.font.TextAttribute(background)
  java.awt.font.TextAttribute(underline)
  java.awt.font.TextAttribute(strikethrough)
  java.awt.font.TextAttribute(run_direction)
  java.awt.font.TextAttribute(bidi_embedding)
  java.awt.font.TextAttribute(justification)
  java.awt.font.TextAttribute(input method highlight)
  java.awt.font.TextAttribute(input method underline)
  java.awt.font.TextAttribute(swap_colors)
  java.awt.font.TextAttribute(numeric_shaping)
  java.awt.font.TextAttribute(kerning)
  java.awt.font.TextAttribute(ligatures)
  java.awt.font.TextAttribute(tracking)
  </code></pre>