zoukankan      html  css  js  c++  java
  • linux加载字体

        static {
            try {
                registerNewFont(PatentsConstants.PDF_FONT_PATH + "arialuni.ttf");
                registerNewFont(PatentsConstants.PDF_FONT_PATH + "simsun.ttc");
                registerNewFont(PatentsConstants.PDF_FONT_PATH + "simsun_bold.ttf");
                registerNewFont(PatentsConstants.MY_PDF_FONT_PATH + "MSYH.TTF");
                registerNewFont(PatentsConstants.MY_PDF_FONT_PATH + "MSYHBD.TTF");
                registerNewFont(PatentsConstants.MY_PDF_FONT_PATH + "SIMHEI.TTF");
                registerNewFont(PatentsConstants.MY_PDF_FONT_PATH + "SIMHEIBD.TTF");
                registerNewFont(PatentsConstants.MY_PDF_FONT_PATH + "ARIALBI.TTF");
                registerNewFont(PatentsConstants.MY_PDF_FONT_PATH + "TIMESBI.TTF");
            } catch (Exception e) {
     
            }
        }

        private static void registerNewFont(String path) throws Exception {
            GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
            // 读取resource中的字体
            InputStream in = Object.class.getClassLoader().getResourceAsStream(path);
            // 创建字体
            Font newFont = Font.createFont(Font.TRUETYPE_FONT, in);
            in.close();
            // 注册字体
            ge.registerFont(newFont);
        }

  • 相关阅读:
    oracle 11g wm_concat 、 listagg 函数的使用(合并数据)
    Quartz.net 开源job调度框架(二)----定点执行
    Quartz.net 开源job调度框架(一)
    Quartz.NET
    基于ASP.NET的comet简单实现
    W3wp.exe占用CPU及内存资源
    SysTick Software Timer
    ARM Memory Copy
    ARM LDR/STR, LDM/STM 指令
    STM32 USART 波特率计算
  • 原文地址:https://www.cnblogs.com/zhimingxin/p/7639558.html
Copyright © 2011-2022 走看看