-
-
Notifications
You must be signed in to change notification settings - Fork 4.3k
[docs] Add a section about non-ascii characters to text component. #3643
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
| <html> | ||
| <head> | ||
| <meta charset="UTF-8"> | ||
| <script src="https://aframe.io/releases/0.8.2/aframe.min.js"></script> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we use https://aframe.io/releases/latest/aframe.min.js ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems that https://aframe.io/releases/latest/aframe.min.js is deprecated and is permanently pinned to v0.1.3...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Correct, we do not use latest. People would use latest, then A-Frame upgrades, then hundreds of sites would break instantly.
|
|
||
| To use non-ascii characters, you need to create your own custom font. The easiest way is to use [a web-based MSDF tool][msdf-bmfont-web]. Select your required character set and generate your own custom msdf font zip file. | ||
|
|
||
| Once you download your custom msdf font zip file, extract it and rename `*.png` to `*-msdf.png`, then put both png and json files to your A-Frame directory. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm do we know why the PNG needs to be renamed? The filename is listed inside the JSON file; I'm surprised by this. 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That is because text component loads an image named fontName-msdf.png by default. It does not use image filename in json.
See
Line 253 in dcdc123
| return this.data.fontImage || fontSrc.replace(/(\.fnt)|(\.json)/, '.png'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we fix text component?
|
Is it okay to merge this PR? Is there anything missing? |
|
Let's try to fix the |
It is essential for non-English users like me to know how to use non-ASCII characters in A-Frame. I added a section about how to generate a custom msdf font to use non-ASCII characters. In my case, it is Japanese characters.