是否有可能从字体获得矢量形式的字符? [英] Is it possible to get vector form of characters from Font?
问题描述
我在执行这个操作的时候并不是在渲染的时候,因此我看不到如何获得这个 FontRenderContex 。是否可以创建一些默认的 FontRenderContex 或绕过它?
有什么在您的应用程序,扩展 Graphics2D ?这样,您就可以访问 getFontRenderContext
方法。
我的意思是你可以只是使用其中一个构造函数,但是我在 FontRenderContext :
通常情况下,FontRenderContext的实例是从Graphics2D对象中获得的。
直接构造的FontRenderContext很可能不会代表
任何实际的图形设备,并且可能会导致意外或不正确的结果。
I need to get shapes of letters in vector form (points and curves) in my application. I can obtain Font instance easily, and it seems that GlyphVector class is able to give me the required Shape. But to create GlyphVector from Font, I need to have some FontRenderContex.
I perform this operation not while rendering something, thus I can't see the way to get that FontRenderContex. Is it possible to create some default FontRenderContex or bypass it?
Is there anything in your application that extends Graphics2D? That way, you have access to the getFontRenderContext
method.
I mean you can just use one of the constructors, but I saw this in the docs for FontRenderContext:
Typically, instances of FontRenderContext are obtained from a Graphics2D object.
A FontRenderContext which is directly constructed will most likely not represent
any actual graphics device, and may lead to unexpected or incorrect results.
这篇关于是否有可能从字体获得矢量形式的字符?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!