<html>
<head>
<meta http-equiv="Content-Type" content="text/html;
charset=windows-1252">
</head>
<body text="#000000" bgcolor="#FFFFFF">
I'm surprised font name is reported for FAMILY - leaving aside the
Apple oddity of it<br>
being the postscript name.<br>
<br>
Maybe a bug there but most apps will call getFamily() for that.<br>
<br>
The attributes such as WEIGHT really should be populated.<br>
I think that'll only be populated if you create a font specifying
BOLD.<br>
Same for POSTURE & ITALIC.<br>
<br>
Width is one that would be useful too ..<br>
<br>
If you'd like to file a bug it may be a good candidate to fix as it
would help<br>
apps choose fonts more intelligently.<br>
<br>
-phil.<br>
<br>
<br>
<br>
<div class="moz-cite-prefix">On 12/21/2017 10:49 AM, Alan Snyder
wrote:<br>
</div>
<blockquote type="cite"
cite="mid:128A666F-C15B-4A18-AED5-FA8F3F21048F@cbfiddle.com">
<meta http-equiv="Content-Type" content="text/html;
charset=windows-1252">
If I run the following code (on macOS), I get no useful
information.
<div class=""><br class="">
</div>
<div class="">
<pre style="background-color: rgb(255, 255, 255); font-family: Menlo; font-size: 9pt;" class="">Font[] fonts = ge.getAllFonts();
<span style="color:#000080;font-weight:bold;" class="">for </span>(Font f : fonts) {
String family = f.getFamily();
<span style="color:#000080;font-weight:bold;" class="">if </span>(<span style="color:#008000;font-weight:bold;" class="">"Lato"</span>.equals(family)) {
Map<TextAttribute,?> attributeMap = f.getAttributes();
Object o = attributeMap.get(TextAttribute.<span style="color:#660e7a;font-style:italic;" class="">WEIGHT</span>);
System.<span style="color:#660e7a;font-style:italic;" class="">err</span>.println(f.getFontName() + <span style="color:#008000;font-weight:bold;" class="">": " </span>+ o);
}
}
</pre>
<div class="">The only attributes with non-null values are the
family (which is wrong, it is the font name, e.g. Lato-Black)
and the size (which is 1, as expected).</div>
</div>
<div class=""><br class="">
</div>
<div class="">I know that other information is available, but is
there a way to get it using public APIs?</div>
<div class=""><br class="">
</div>
<div class="">If not, why not?</div>
<div class=""><br class="">
</div>
<div class=""> Alan</div>
<div class=""><br class="">
</div>
</blockquote>
<br>
</body>
</html>