0

Is there any universal solution to generate characters from the most popular Asian languages and checking if the utf-8 text contain them (whole set at once)? I don't want to manually search for fonts one by one.

brak401
  • 3
  • 3
  • A font is different from a text. A font is for display. A text can contain a whole bunch of Asian characters, and be displayed as (usually) rectanges when the selected font doesn't contain those characters. So, which do you need, a way to check if a text string contains those characters, or a way to check if a font/typeface includes them? – GolezTrol Sep 24 '14 at 15:11
  • Thanks for your answer. First I'd like to check in a one line of code if a text string contains characters which should be handled by extra fonts (mostly asian), then I'd like to use one font which includes Japanese Chinese, Korean and maybe other languages to generate the text – brak401 Sep 24 '14 at 16:11

1 Answers1

0

Checking

Unicode characters are divided in ranges. Those ranges have logical groups of characters. There is a Latin range, and ranges for other languages.

You can inspect each character and determine in which range it falls. That way, you can establish which ranges are in your text string.

The question How to check if the word is Japanese or English using PHP shows how to check for Japanese texts. In a similar fashion, you can check other ranges as well.

Outputting

A font will often contain an entire range of characters. This may not always be the case, but you might preselect fonts for specific ranges. When you determined the ranges, you can select a font from your shortlist that includes all ranges, or you can print out the result character by character and select a font for each one.

There are some resources online on finding the right font. A good starting point is Fonts Resources on Unicode.org. This page links to many other resources. One of them is to two fonts by Microsoft, Arial Unicode MS and Lucida Sans Unicode. These two fonts contain characters for many languages and are a good starting point. After all, if you use a font that contains all characters you may want to display, you won't have to check those ranges in the first place.

Community
  • 1
  • 1
GolezTrol
  • 114,394
  • 18
  • 182
  • 210