styled JTextPane
Mike Swingler
swingler at apple.com
Sun Aug 5 17:53:34 PDT 2012
On Apr 19, 2012, at 6:45 PM, Michael Hall <mik3hall at gmail.com> wrote:
>
> As I indicated earlier this does appear to be a separate issue.
> I'm not 100% sure again though that it is a bug. It is different from 1.6.
> Test case....
>
> import javax.swing.*;
> import javax.swing.text.*;
>
> public class StyledTest extends JTextPane {
>
> private static final StyleContext sc = new StyleContext();
> private static final DefaultStyledDocument doc = new DefaultStyledDocument(sc);
> static final Style mono = sc.addStyle("mono",null);
>
> public static void main(String[] args) {
> JFrame f = new JFrame("StyledTest");
> f.setMinimumSize(new java.awt.Dimension(100,100));
> StyledTest st = new StyledTest();
> f.add(st);
> f.pack();
> f.setVisible(true);
> SwingUtilities.invokeLater(new Runnable() {
> public void run() {
> try {
> doc.insertString(0,"AaBbCcDd\nEeFfGgHh",mono);
> }
> catch (BadLocationException blex) {
> blex.printStackTrace();
> }
> }});
> }
>
> public StyledTest() {
> setStyledDocument(doc);
> StyleConstants.setFontFamily(mono,"monospaced");
> }
> }
>
> Run on 1.6 you get a smaller serifed font that could be monospaced.
> Run on 1.7 you get a larger non-serified font that, well, still just might be monospaced.
> Bug or incidental change?
> Strictly as opinion probably biased to what I'm used to, assuming both are correctly monospaced output, I like the smaller serifed better, it tends to stand out as different a little better in my application.
> Not a voting situation?
The difference is between "Courier" (1.6) and "Menlo" (1.7), and both are monospaced.
We (Apple's JDK team) decided to change the default to Menlo at the time we contributed our font code to the OpenJDK project because Menlo had become the platform standard monospaced font for other applications (like Xcode).
Regards,
Mike Swingler
Apple Inc.
More information about the macosx-port-dev
mailing list