如何从SWT中的InputStream加载字体? [英] How to load font from InputStream in SWT?
问题描述
我需要从java 加载字体(
或 .otf
或 .ttf
)文件。 Resource InputStream
在SWT中。
我正在考虑使用 因为我还没有尝试过这个选项(我甚至不知道它是否以这种方式工作)只是想知道是否有其他选项可用? 不是很好,但你可以总是将流写入临时文件,并使用可用的方法。 I need to load font ( I was thinking of using 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? Not great but you can always write the stream to a temporary file, and use the available method. 这篇关于如何从SWT中的InputStream加载字体?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋! org.eclipse .swt.graphics.Device.loadFont(String path)
允许我(
java.awt.Font.createFont(int fontFormat,InputStream fontStream)
,然后构建 org .eclipse.swt.graphics.FontData
和 org.eclipse.swt.graphics.Font
对象超出AWT java。 awt.Font
object。
.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.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.