Skip to content
This repository has been archived by the owner on Dec 15, 2020. It is now read-only.

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

Open
wayne-kim opened this issue Feb 9, 2017 · 16 comments
Open

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

wayne-kim opened this issue Feb 9, 2017 · 16 comments
Assignees

Comments

@wayne-kim
Copy link

I added at my index.html

but i can not see Korean character set.

how can i use UTF-8?

@amberroy amberroy self-assigned this Feb 10, 2017
@amberroy
Copy link
Contributor

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

@andrewimm
Copy link
Contributor

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
Copy link
Contributor

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

@LiuC520
Copy link

LiuC520 commented Apr 1, 2017

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
Copy link

Ninerian commented Apr 1, 2017 via email

@andrewimm
Copy link
Contributor

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
Copy link
Contributor

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

@mikearmstrong001 mikearmstrong001 self-assigned this Apr 22, 2017
@darknoon
Copy link

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
Copy link
Contributor

@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
Copy link

@RadValentin
Copy link

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
Copy link
Contributor

@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
Copy link

genievn commented Jul 10, 2018

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

@andrewimm
Copy link
Contributor

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

@jcyh0120
Copy link

jcyh0120 commented Mar 2, 2019

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

@oussj
Copy link

oussj commented Nov 2, 2020

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 ?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests