Khmer Unicode is great – until you get on a site that hasn’t used any Khmer Unicode Web Fonts and the system default Khmer font is used. Unfortunately, most system default Khmer fonts are horrible looking (especially the Khmer font supplied with Windows). So, what can you do about it as a webmaster? Plenty!

If you run a Khmer only website – the solution is much easier than if you have a multilingual site.

Some browsers (like Firefox) allow you to set a font for a specific language – but others do not.

So plain Khmer Unicode text looks like this:
អាក្រក់មើលណាស់!

But with a little CSS magic and a Google Web Font, your Khmer text can look like this:
ពិតជាស្រស់ស្អាត! But the English text doesn’t really match.

Here’s the inline code:
<link href='https://fonts.googleapis.com/css?family=Bayon' rel='stylesheet' type='text/css'>
<span style="font-family: 'Bayon'; font-size: 200%;">
ពិតជាស្រស់ស្អាត! But the English text doesn't really match.
</span>

But one item you will notice is that the Latin/English still doesn’t look all that great because it doesn’t really match the Khmer font (especially the Latin punctuation like !). That is because Khmer fonts don’t often have English or Latin characters in them. So, if you want, you can provide CSS code that maps a font to a certain range of Unicode characters (limits it to Khmer only) and then choose another font for English. This really is the best practice, since some browsers (like Firefox) don’t do a great job at mixing Khmer and English fonts automatically. Google Fonts actually does this for you, so all you have to do is specify a Khmer font, and then choose a Latin font that matches well like this:

ពិតជាស្រស់ស្អាតណាស់! And English even looks nice!

Here’s the inline code:
<link href='https://fonts.googleapis.com/css?family=Bayon|Francois+One' rel='stylesheet' type='text/css'>
<span STYLE="font-family: 'Francois One','Bayon'; font-size: 200%;">
ពិតជាស្រស់ស្អាតណាស់! And English even looks nice!
</span>

We hope that proves helpful and fosters better looking Khmer websites with beautiful Khmer web fonts.

Also, on a side note – you really should declare all font imports in the html head, and it is better to include a CSS file rather than do inline CSS code.

If you would like to see a good example, head over to plovpit.com a site the founder of SBBIC created and take a look at the css code there (on this site we even created custom Khmer fonts with some English punctuation characters to get even better results).

2 Comments. Leave new

Leave a Reply

Your email address will not be published. Required fields are marked *

Fill out this field
Fill out this field
Please enter a valid email address.
You need to agree with the terms to proceed

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Menu