How to display Cyrillic and Glyphs characters?

Hi there,

A project I work on requires a multiple languages support.
But I bumped into an issue with displaying all necessary symbols.
For example, Cyrillic (Russian) and Glyphs (Simplified and Traditional Chinese) symbols aren’t displayed at all.

I’ve already played around with “Character Presets” and “Custom Character Range”. But it seems like it made no influence.

Would be appreciate for any advice :slight_smile:

Hi @Taras and welcome,

So, two important things to get that to work are:

  1. Make sure your font referenced includes those characters
    2, After you add the characters in place, make sure to press Process Font to get the new font maps generated.
2 Likes

Hi Leonidas,
Nice to meet you :slight_smile:

  1. Yes. The font includes required symbols.
  2. I tried it. After I press “Process” nothing changes. The set of symbols goes back to the basic variant (stays the same)

Welcome to PlayCanvas, @Taras!

So, the font may include all the required symbols, but you need to add the ones the application will use. You should select the Font > Character Presets > Process Font.

@Leonidas, @yaustar, I remember we had a User Manual on this one somewhere, and initially wanted to give a link, but I can’t find it. Do we still have it?

3 Likes

Yes, it seems to be working fine, I’ve tried with Roboto from Google fonts:

  1. Downloaded the font and upload it to PC
  2. Added Cyrillic set
  3. Processed font

3 Likes

This page? https://developer.playcanvas.com/en/user-manual/assets/fonts/

2 Likes

Hi, @LeXXik
Yes. Did exactly as you said.

  1. Chose “Cyrillic”
  2. Checked if the Cyrillic characters appeared in the “Characters” field (they did)
  3. Clicked “Process”
    And nothing happened.

And if I deselect the current font in the Assets section and select it again, the “Characters” field still contains the same basic set of characters (Cyrillic one disappears).

@Leonidas, I’ve created a public test project to try it from a scratch.
Used the same font and the same steps as you did and still the same result.

Maybe I’ve missed something…

p.s. Should there be any notification that “Process” succeeded?

@Taras can you share that public project please?

@yaustar

Sure. Here it is https://playcanvas.com/project/771724/overview/font-test-project

Hi @Taras,

Are you sure your source font file includes cyrillic characters? The source font file isn’t included in your project to check.

Check this test I’ve just done, importing Roboto from google fonts:

https://playcanvas.com/editor/scene/1104986

2 Likes

@Leonidas Yes! It worked!
Didn’t know I had to keep a font source file in order to add new characters!
Thanks a lot, guys!

But still I can’t get the same result for the Chinese glyphs.
As far as I understand there’s no such “Presets” for Glyphs.
I uploaded to that “Font Test Project” some Chinese Simplified font and tried to change characters range, but without success.

Ah right, I think for Chinese characters you need to copy/paste in the Character text field the ones you need to include yourself:

image

Then press process font again, @yaustar I think a Chinese preset is too huge to include?

1 Like

I need to add documentation about this. The font process will create multiple textures for as many characters as needed and the font asset will refer to those as needed.

I think each texture is capped at 2 or 4K so on theory, you can add as many Chinese characters as needed.

But yes, a preset hasn’t been included, you will need to add it yourself.

2 Likes

@Leonidas I did as you mentioned.
It generally works.
But characters visually looks broken.

Ah that’s interesting, I think I’ve seen this issue in the past. @yaustar any idea if there is a fix for this?

I’m afraid its due to the way we store the fonts in a SDF. See this for more details: https://lambdacube3d.wordpress.com/2014/11/12/playing-around-with-font-rendering/

There’s little we can do right now about this. The only other alternative available is the WIP Canvas Font API which takes up more memory but allows for dynamic content at runtime without having to preprocess fonts: http://playcanvas.github.io/#user-interface/text-canvas-font.html

Here’s an editor example: https://playcanvas.com/project/702920/overview/canvas-font-example

Edit: Github Issue raised here: https://github.com/playcanvas/engine/issues/2948

3 Likes

Thanks a lot guys.
Appreciate your help!

Hope you will come up with some fixes regarding fonts rendering in future updates and also I’ll take a look at the alternative approach :slight_smile:

2 Likes