![]() To use a custom font, first you have to choose one that covers all characters you need in your document or its part. Having these basics described, we can start using fonts and typing! Picking a proper font The first thing you need to properly render your HTML code to PDF is a character set declaration: A font data file contains either bitmaps or vectors that make up all the character shapes. The most popular ones are UTF-8, UTF-16, UTF-32, UCS-2 and UCS-4 for the Unicode standard.Ī font is a set of glyphs - readable characters and other symbols that represent a character set. However, if a character set exceeds 256 possible values of a single byte, we dive into the world of multi-byte encodings. For ANSI this is simple: a byte value 65 (decimal) is equal to ASCII code 65, which represents capital letter A. This is an abstract representation we still don’t know how this letter should be drawn on screen or printed.Īn encoding specifies how the character codes will be represented as bytes. For example, in the ASCII table, the decimal number 65 represents a Latin letter A. To build a piece of text you need characters that will make letters and words.Ī character set defines mappings between numeric codes and characters: letters, digits, symbols, and so on. Some theory about fonts and textīefore we start, there are some terms you should familiarize with. ![]() We will cover several conversion tools, including Headless Chrome, WeasyPrint, Prince, wkhtmltopdf and PHP libraries: mPDF, TCPDF and Dompdf. In this article, you will learn how to set custom fonts when converting HTML to PDF. ![]()
0 Comments
Leave a Reply. |