简体   繁体   English

Three.js文本渲染问题

[英]Three.js text rendering issues

I am currently working on a three.js project and we are running into issues loading fonts onto our text. 我目前正在研究Three.js项目,我们遇到了将字体加载到文本上的问题。

We are using TextGeometry object to render our fonts and the typeface js converter to add in our fonts. 我们使用TextGeometry对象来呈现字体,并使用js字体转换器添加字体。

Some fonts work great but others do not perform as expected with some letters not rendering correctly such as d's and o's. 有些字体效果很好,但另一些字体表现不佳,某些字母不能正确呈现,例如d和o。

This can be seen in the fiddle below, the font is loading the interior of some letters not the exterior. 可以在下面的小提琴中看到,字体加载的是某些字母的内部而不是外部。

http://jsfiddle.net/264jawhe/2/ http://jsfiddle.net/264jawhe/2/

Can anyone identify why this is happening and if there is a better method to display text possibly loading an html element? 谁能确定为什么会这样,是否有更好的方法来显示可能加载html元素的文本?

Thanks in advance! 提前致谢!

var textGeom = new THREE.TextGeometry("Video Dp", 
     {
      font: 'acknowledgement',
      weight: 'normal'
     });
var material2 = new THREE.MeshNormalMaterial();
var textMesh = new THREE.Mesh( textGeom, material2 );

scene.add( textMesh );

Please check the fiddle. 请检查小提琴。 Actually the issue is with your font style. 实际上,问题出在您的字体样式上。 I have just changed the font face and its working fine 我刚刚更改了字体外观,并且可以正常使用

Refer to this Jsfiddle 参考这个Jsfiddle

var textGeom = new THREE.TextGeometry("Video Dp", {
    font: 'optimer',
    weight: 'normal'
});
var material2 = new THREE.MeshNormalMaterial();
var textMesh = new THREE.Mesh(textGeom, material2);
scene.add(textMesh);

It is related to 'Direction of Paths' of type1 fonts. 它与type1字体的“路径方向”有关。

Visit this . 访问 You can details about the bug with solution and a tool for using any font file for generating mesh. 您可以使用解决方案和使用任何字体文件生成网格的工具来详细说明该错误。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM