Jump to content

Fallback Font or multifont text


photo

Recommended Posts

Hello,

Using search I'm found nothing, so im first with this problem.

Very important to have special separate font, with special symbols, in text strings.

Unigine have only setFont(string) for one font or i can put more font names in that string?

any font fallback system?

Link to comment

Details is that, we recive string with text typed in word-like application, with using of some custom font file installed in windows/fonts

the case is to correctly display same utf8 text in unigine

any per-glyph font bake to texture is possible?

Link to comment

So you can't use a regular font with UTF-8 support (maybe even purchased) like Arial UTF-8 or UNIFONT?

In older SDK's versions there was a tool called imagettf to bake ttf fonts into a texture: https://developer.unigine.com/en/docs/2.8/tools/imagettf/

However, we only used it couple of times, so it may produce non-expected results.

How to submit a good bug report
---
FTP server for test scenes and user uploads:

Link to comment
1 hour ago, lightmap said:

Details is that, we recive string with text typed in word-like application, with using of some custom font file installed in windows/fonts

the case is to correctly display same utf8 text in unigine

any per-glyph font bake to texture is possible?

For exact need, I had written my own typography things which bakes things to texture. I have implemented it over Direct X on windows using Direct write and Direct 2D. With this approach all code page conversions for Unicode and joining of characters in scripts are handled nicely by Direct Write and Direct 2D.

Probably you could do something on these lines.

Regards,

Rohit

Link to comment

I tried to merge fonts custom+arial with fontlab/transtype/fontforge

the problem with this is that custom glyps have places same as english glyphs and replace them - custom glyps rendered as intended but no english text - this is not the case

if I make fonts merge by not replacing but adding new - this makes rendering custom glyphs as unidentified squares (seems they got new index) - and this is not the case too, as use imagettf

typical case is having option to set fallback font, - if glyph not found then search in custom specified font

rohit.gonsalves

this seems good, but post does not contain any implementation details, seems writing own thing the way

Link to comment

Dear @lightmap,

I have used DirectWrite and Direct2D for this implementation. Both API do font fallback. So you need not worry about it.

https://docs.microsoft.com/en-us/windows/win32/directwrite/direct-write-portal

https://docs.microsoft.com/en-us/windows/win32/direct2d/direct2d-portal

and 

https://docs.microsoft.com/en-us/windows/win32/direct2d/direct2d-and-direct3d-interoperation-overview

I had started with these API and later one of my friend suggested a good little tiny SDK for the same thing. Three API and you will have font rendered on DirectX texture or Unigine Texture. I ported my solution to this tiny API too. The API is https://github.com/gamelaster/FW1FontWrapper. I liked these API. Wonderful. In one day you should solve your Font issue. I actually took a week to write it using DirectWrite and Direct2D and my porting took just couple of hours with this API.

Rohit.

 

  • Like 1
Link to comment
×
×
  • Create New...