项目作者: parubok

项目描述 :
Utility to load fonts from files in Windows fonts directory.
高级语言: Java
项目地址: git://github.com/parubok/win-font.git
创建时间: 2020-07-14T07:07:36Z
项目社区:https://github.com/parubok/win-font

开源协议:Apache License 2.0

下载


Java CI with Maven
License

Small Java library to obtain instances of java.awt.Font for some standard fonts in Windows font directory (usually c:\Windows\fonts).

Main motivation for having this library is to allow using high quality fonts provided by Windows while preventing legal issues, since bundling and redistributing Windows fonts with 3rd party software is usually forbidden.

Path to the font directory may be explicitly specified via system property org.swingk.winfont.fontDir (e.g. for unit testing).

A viewer application org.swingk.winfont.Viewer is available under test root.

Example:

  1. import org.swingk.winfont.WinFontFactory;
  2. import org.swingk.winfont.WinFont;
  3. import org.swingk.winfont.FontUnavailableException;
  4. java.awt.Font tahomaFont = null;
  5. try {
  6. tahomaFont = WinFontFactory.getFont(WinFont.TAHOMA);
  7. } catch(FontUnavailableException e) {
  8. tahomaFont = ...; // provide some substitute
  9. }

This project has no dependencies (except JUnit 5, for testing).

Requires Java 8 or later.