facebookarchive / react-360

Create amazing 360 and VR content using React
https://facebook.github.io/react-360
Other
8.73k stars 1.22k forks source link

[Question] How can I use UTF-8? #52

Open wayne-kim opened 7 years ago

wayne-kim commented 7 years ago

I added at my index.html

but i can not see Korean character set.

how can i use UTF-8?

amberroy commented 7 years ago

We haven't done much testing with UTF-8 thanks for bringing it to our attention, will take a look.

andrewimm commented 7 years ago

The way React VR renders text is through a technique known as Signed Distance Function fonts. It allows us to smoothly render text at any size, without pixelation. One downside is that the technique requires us to pre-render font glyphs before shipping them. The default glyphs set contains Roman and Cyrillic characters, but nothing beyond that.

From Oculus's work with Samsung, we do do have SDF fonts for Korean glyphs. I'll add documentation for how to use custom font sets, and see if we can include those fonts in the next release of the ovrui npm package.

andrewimm commented 7 years ago

FYI documentation on how fonts are handled has been updated here: https://facebook.github.io/react-vr/docs/fonts.html

LiuC520 commented 7 years ago

The same to me ,I can't use chinese in Text node. I've alreay translate your website into chinese using react ,the website is www.vr-react.com

Ninerian commented 7 years ago

Maybe it's considerable to exclude the font from the package and provide it as external dependency. So you could use individual or reduced charsets to improve the app size.

--
Daniel Große

Am 1. April 2017 um 04:24:55, LiuC520 (notifications@github.com(mailto:notifications@github.com)) schrieb:

The same to me ,I can't use chinese

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub(https://github.com/facebook/react-vr/issues/52#issuecomment-290887507), or mute the thread(https://github.com/notifications/unsubscribe-auth/AAHMfUeEMUWCo_GGRPpcBzfgKN8NM3Rpks5rrbV3gaJpZM4L7roz).

andrewimm commented 7 years ago

Again, here's a link to the documentation describing how to use the included Japanese and Korean font sets, and how to make your own custom fonts: https://facebook.github.io/react-vr/docs/fonts.html

mikearmstrong001 commented 7 years ago

Fallback font sets have been added to react vr and the docs have been updated again.

Fallback fonts allow to support the full font set and the cost of extra download. There is no reason why mono emoji characters can't be supported with this.

the fonts can't be found in the OVRUI repo https://github.com/OculusVR/ovrui/tree/master/fonts

darknoon commented 7 years ago

Hey, I kind of understand how this came about, but couldn't we generate the SDFs dynamically when the user needs them based on the fonts they have installed?

In my mind it's pretty regressive to think that users only communicate in one character set or another per-user or per-app. In my facebook feed I have english, arabic, icelandic, turkish, chinese, and japanese characters regularly. Not to mention that real communication in 2017 has tons of emoji.

andrewimm commented 7 years ago

@darknoon It would be great if we could achieve that, but there are a few technical limitations standing in our way:

1) Access to the font itself — I've worked on a number of pdf-in-browser and similar document renderers, as well as JS tools to build and manipulate TTF and OTF fonts. The browser lets us render content with fonts, and in some cases get metadata about characters in fonts, but we never have access to the raw font data itself, which would be needed for an optimal SDF generator. Without that, we're never going to be fast.

2) Generating the full set of fonts is prohibitively slow in the current state of things — even if we had full access to the underlying parametric data of the glyphs, we'd still need to spend time generating the proper metadata, which would likely hurt your application's time-to-interaction.

3) Not all fonts want to be SDF-rendered. The font face we provide is designed to scale nicely with SDF techniques. If you did that with arbitrary fonts found on your computer, you would find that certain angles and curves don't preserve when rendered through the SDF technique.

As Mike mentions above, we're now capable of chaining fallback fonts together, so you can support EFIGS + JK out of the box, as well as any other font faces you wish to generate on your own. We think that's a good step in i18n support while we actively explore other generation techniques. I do look forward to being able to support emoji myself!

liyuechun commented 7 years ago

http://www.react-vr.org http://bbs.react-vr.org

RadValentin commented 7 years ago

Could the fonts be published as part of the ovrui package or inside a new one? I don't like the ideea of copy-pasting them into my project. It would be cool if I could load them directly from node_modules.

OVRUI.loadFont(
  '../node_modules/ovrui/fonts/japanese.fnt', 
  '../node_modules/ovrui/fonts/japanese.png'
);
andrewimm commented 7 years ago

@RadValentin we used to do that, but intentionally removed them. It's convenient to write that during development, but your final production build won't have a node_modules folder! This created repeated confusion for developers who were linking into the npm package to fetch their font files, and not able to find the file when deploying to servers, so we removed them.

genievn commented 6 years ago

Hi, I've just realized Vietnamese is not supported too, any solution yet?

andrewimm commented 6 years ago

@genievn the text rendering pipeline is currently being overhauled to allow use of all system fonts

jcyh0120 commented 5 years ago

any solutions yet? I would like to use Chinese text words.

oussj commented 3 years ago

Hello @andrewimm

The link provided to use custom fonts is not working anymore (legacy react vr doc). I can't find anything in the react 360 documentation. Is there still a way to use custom fonts in react 360 ?