I am not sure why Khmer fonts are not supported in Visualforce page. The below are the fonts that are supported by VF page.
Font Type | Fonts |
---|---|
Arial Unicode MS | Arial Unicode MS |
Helvetica | sans-serif, SansSerif, Dialog |
Times | serif, Times |
Courier | monospace, courier, monospaced, dialoginput |
- It seems like of all the fonts mentioned below, only Arial Unicode font supports Visualforce PDF rendering as per the article: https://help.salesforce.com/articleView?id=000321277&type=1&mode=1
- I tried to test it myself with a sample code and it worked when you don’t render it as pdf and just render it in a page. When I add
renderAs = pdf
, it doesn’t display the Khmer characters. I tried Thai characters withfont-family
as Arial Unicode MS and it works in both in a page and in pdf. - Also, web fonts are not supported when you render it as pdf.
In a Web Page - Khmer fonts are displayed
In PDF - Khmer fonts are not displayed
Here is my code for you to try it out:
<apex:page showHeader="false" applyBodyTag="false" renderAs="pdf">
<head>
<link rel="preconnect" href="https://fonts.gstatic.com"/>
<link href="https://fonts.googleapis.com/css2?family=Khmer&display=swap" rel="stylesheet"/>
<style>
body {
font-family: 'Khmer ';
}
</style>
</head>
<body>
ឲ្យខ្លាច <br/>
This is a sample page: API version 28.0
</body>
</apex:page>
Please let me know if there are any alternatives to solve the problem.