# jwoff2 **Repository Path**: mirrors/jwoff2 ## Basic Information - **Project Name**: jwoff2 - **Description**: woff2格式字体 是web open format font 2的简称,相较于woff格式字体,woff2使用brotli进行压缩,大大降低了字体文件的大小,更利于网络传输 - **Primary Language**: Java - **License**: MIT - **Default Branch**: master - **Homepage**: https://www.oschina.net/p/jwoff2 - **GVP Project**: No ## Statistics - **Stars**: 2 - **Forks**: 1 - **Created**: 2019-08-08 - **Last Updated**: 2026-02-21 ## Categories & Tags **Categories**: utils **Tags**: None ## README # jwoff2 a java wrapper for woff2 to help convert ttf/otf font to woff2 or woff2 to ttf in java # Build 1. build [woff2](http://github.com/google/woff2) ```bash git clone --recursive https://github.com/Jijun/jwoff2.git #compile brotli cd jwoff2/woff2/brotli cmake . make && sudo make install cd .. mkdir out cd out cmake .. make sudo make install ``` 2. build jwoff2 ``` cd jwoff2 cmake . make ``` # Function ```java public static native byte[] convertTTF2WOFF2Byte(byte[] inputByte); /** * convert truetype font to woff2 * * @param intputFileName * @param outputFileName * @return */ public static native boolean convertTTF2WOFF2(String intputFileName, String outputFileName); /** * convert woff2 to truetype font * * @param inputFileName * @param outputFileName * @return */ public static native boolean convertWOFF2ToTTF(String inputFileName, String outputFileName); ``` # Run ```bash java -Djava.library.path= -jar libjwoff2.jar inputfilename outputfilename [woff2ttf|ttf2woff2] ``` # References * [google woff2](http://github.com/google/woff2)