%PDF- %PDF-
Direktori : /lib/python3/dist-packages/reportlab/pdfbase/__pycache__/ |
Current File : //lib/python3/dist-packages/reportlab/pdfbase/__pycache__/ttfonts.cpython-312.pyc |
� C��e3� � �D � d Z dZddlmZmZmZ ddlmZm Z m Z mZmZ ddl mZmZ ddlmZ ddlmZmZmZmZ ddlmZ dd lmZ dd lZdd lZ G d� dej: � ZejA d d� fd�Z!d� Z"d� Z#d� Z$dZ%dZ&dZ'dZ(dZ)dZ*dZ+dZ,dZ-dZ.dZ/dZ0dZ1i Z2d � Z3d!� Z4 G d"� d#� Z5 G d$� d%� Z6 ed&d'� Z7 G d(� d)e� Z8 G d*� d+e5� Z9dZ:dZ;dZ<dZ=dZ>dZ?d,Z@d-ZAd.ZB G d/� d0e9ej� � ZD G d1� d2� ZE G d3� d4� ZFd5� ZGdd6lHmIZI eIeG� [Iy )7z$Id$a TrueType font support This defines classes to represent TrueType fonts. They know how to calculate their own width and how to write themselves into PDF files. They support subsetting and embedding and can represent all 16-bit Unicode characters. Note on dynamic fonts --------------------- Usually a Font in ReportLab corresponds to a fixed set of PDF objects (Font, FontDescriptor, Encoding). But with dynamic font subsetting a single TTFont will result in a number of Font/FontDescriptor/Encoding object sets, and the contents of those will depend on the actual characters used for printing. To support dynamic font subsetting a concept of "dynamic font" was introduced. Dynamic Fonts have a _dynamicFont attribute set to 1. Dynamic fonts have the following additional functions:: def splitString(self, text, doc): '''Splits text into a number of chunks, each of which belongs to a single subset. Returns a list of tuples (subset, string). Use subset numbers with getSubsetInternalName. Doc is used to identify a document so that different documents may have different dynamically constructed subsets.''' def getSubsetInternalName(self, subset, doc): '''Returns the name of a PDF Font object corresponding to a given subset of this dynamic font. Use this function instead of PDFDocument.getInternalFontName.''' You must never call PDFDocument.getInternalFontName for dynamic fonts. If you have a traditional static font, mapping to PDF text output operators is simple:: '%s 14 Tf (%s) Tj' % (getInternalFontName(psfontname), text) If you have a dynamic font, use this instead:: for subset, chunk in font.splitString(text, doc): '%s 14 Tf (%s) Tj' % (font.getSubsetInternalName(subset, doc), chunk) (Tf is a font setting operator and Tj is a text ouput operator. You should also escape invalid characters in Tj argument, see TextObject._formatText. Oh, and that 14 up there is font size.) Canvas and TextObject have special support for dynamic fonts. � )�pack�unpack�error)�bytestr� isUnicode�char2int�isStr�isBytes)� pdfmetrics�pdfdoc)� rl_config)�hex32�add32�calcChecksum�instanceStringWidthTTF)� namedtuple)�BytesIONc � � e Zd ZdZy)�TTFErrorzTrueType font exceptionN)�__name__� __module__�__qualname__�__doc__� � �;/usr/lib/python3/dist-packages/reportlab/pdfbase/ttfonts.pyr r ? s � ��r r s 0123456789s ABCDEFGIJKc �>