I need to load font ( .otf
or .ttf
) file from java Resource
or InputStream
in SWT.
org.eclipse.swt.graphics.Device.loadFont(String path)
allows me ( example ) to load font from font file path (and it works), but there is no corresponding method to load it from any other source.
I was thinking of using java.awt.Font.createFont(int fontFormat, InputStream fontStream)
and then building org.eclipse.swt.graphics.FontData
and org.eclipse.swt.graphics.Font
objects out of AWT java.awt.Font
object.
Since I haven't tried that option yet (I don't even know if it works that way) I was just wondering if there are any other options available?
不太好,但是您始终可以将流写入临时文件,然后使用可用的方法。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.