【问题标题】:Change JTextArea font type to sinhala将 JTextArea 字体类型更改为僧伽罗语
【发布时间】:2019-01-30 07:09:20
【问题描述】:

我使用 JTextArea 创建了文本编辑器。但它不适用于僧伽罗字体类型。

t = new JTextArea();
t.setFont(new Font("kaputadotcom2004", Font.PLAIN, 12));

【问题讨论】:

    标签: java swing fonts jtextarea


    【解决方案1】:

    由于kaputadotcom2004 不是默认字体,您需要注册您的字体才能在您的环境中使用它。你可以做这样的事情(例子取自answer):

    try 
    {
         GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
         ge.registerFont(Font.createFont(Font.TRUETYPE_FONT, new File("A.ttf")));
    } 
    catch (IOException|FontFormatException e) 
    {
         //Handle exception
    }
    

    【讨论】:

    • kAliert 谢谢
    猜你喜欢
    • 1970-01-01
    • 2011-10-03
    • 1970-01-01
    • 1970-01-01
    • 2013-07-08
    • 1970-01-01
    • 1970-01-01
    • 2015-07-18
    • 1970-01-01
    相关资源
    最近更新 更多