-3

I'm working on a multi-language website. I have a problem with the color of the Chinese characters. My text color is #333333 but the Chinese characters appear darker than the occidental chars. My content comes from a database.

I thought to do it with Javascript / jQuery. The script detects the Unicode from the paragraph with the .fromCharCode() function. But what I read was that function expects an integer and the Unicode for Chinese chars are not integers. And that should be the reason my function is not working.

EDIT

Here's an image from what I got:

http://tinypic.com/r/2s94lz6/6

My function to check for the Unicode:

if($('#container p').fromCharCode(4E00)){
    alert('Chinese');
}

Any help?

dda
  • 6,030
  • 2
  • 25
  • 34
saomi
  • 855
  • 5
  • 16
  • 38

2 Answers2

2

The screenshot suggests that different characters have been taken from different fonts. This often happens when the primary font does not contain all the relevant characters. So the odds are that you are trying to solve the wrong problem. Perhaps you should just consider making a font suggestion that is suitable for all the characters that will appear in the content.

The code snippet is in error in several ways. For example, 4E00 should be 0x4E00. And even that way, you would check for a single character only.

You need to post the full code, or a URL, or both, to get more constructive help.

Jukka K. Korpela
  • 195,524
  • 37
  • 270
  • 390
  • the screenshots are the same page with the same fonts. You are right when you said about the font doesnt contain the chars. The font that I'm using doesnt have the chinese chars drawn. i just put one value for an initial test. I put the 0x4E00 and still gives me error. the firbug tells that $("#container p").fromCharCod is not a function. Thanks It was helpful – saomi Jun 25 '12 at 18:01
  • In particular, you have a Japanese sans font (probably Meiryo) falling back to a Chinese book font for the hanzi that aren't used in Japanese. Mark up the document as being in Chinese (`lang="zh"`) and try setting common Chinese fonts in the `font-family`. – bobince Jun 25 '12 at 21:12
2

Your problem is that you are displaying Simplified Chinese in a font that was designed for Traditional Chinese. So when the display engine hits a character that's Simplified (and thus not in the Traditional font), it takes the default simplified font and uses that instead. Then it reverses back to the Traditional font. Hence the unseemly look.

You need to look into what would be the most common Simplified Chinese font (or font family) and use that specifically for Simplified Chinese texts. Something like Heiti TC and Heiti SC.

dda
  • 6,030
  • 2
  • 25
  • 34