L
L
LNK2017-08-05 20:57:07
PHP
LNK, 2017-08-05 20:57:07

How to implement automatic selection of a font that supports a given language?

Good day.
Using ImageMagick in php, I generate a picture with text. The problem is that I do not know in advance what text will need to be written on the picture (it will be substituted dynamically) and I do not know what language it will be in. That is, if I set, for example, the Helvetica font for this inscription and then I need to write the text in Chinese, then we will get only question marks. How to fix this problem? And is it possible to somehow find out in the code whether a particular font supports a particular character?
Yes, there is Noto which supports all languages. However, each language has its own .ttf font and the problem with choosing a font does not go away. And I haven't seen one .ttf file that would support all languages...

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vladislav, 2017-08-20
Shynkaruk @lonadelsi

github.com/PhenX/php-font-lib

or
Libraries for working with fonts.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question