How to Apply Font Hinting for CJK Characters in C# .NET
Many TrueType fonts render CJK characters with hinting instructions. Hinting instructions improve legibility and prevent pixelating in small font sizes at low resolution.
Hinting instructions are mainly used for CJK fonts but will improve the clarity of any font by reusing or combining specific glyph shapes that appear in different characters. Without hinting instructions, CJK text and glyphs may render incorrectly.
Gc Imaging v3.1 supports TrueType hinting. This feature allows you to:
1. Improve the text in a PDF file and save the PDF as an image
2. Apply hinting instructions to text in an image directly
The following use cases discuss the process for improving CJK text in PDFs and images with GcPdf and Gc Imaging.
Use Cases: Applying Font Hinting
Apply Text Hinting to a PDF and Save It as an Image
1. Create a new GcPdf Document, add a page, and set the Text Format
2. Enter CJK text
3. Save the document as a PDF
4. Save the PDF as an image. Set hinting while instantiating SaveAsImageOptions.
Note: EnableFontHinting is set to "true" by default.
Compare the text rendered with and without font hinting.
Apply Font Hinting When Adding Text to an Image
1. Create a GcBitmap instance. Load an image to img.FilePath
2. Create graphics for the same GcBitmap instance. Add a title to the image, "Japanese string."
Note: EnableFontHintingis set to "true" by default.
3. Save the image.
The following images provide a comparison of CJK text with and without preserved glyphs.
Let us know how this feature makes your work easier.