%PDF- %PDF-
Direktori : /lib/python3/dist-packages/reportlab/lib/__pycache__/ |
Current File : //lib/python3/dist-packages/reportlab/lib/__pycache__/fontfinder.cpython-312.pyc |
� ��d94 � �� � d Z dZddlZddlZddlZddlmZ ddlmZ ddl m Z ddlm Z mZ d� Zg d �Zd ZdZdZd ZdZdZdZdZdZ G d� d� ZddlmZmZmZmZ G d� d� Zd� Z e!dk( r e � yy)z3.4.22a� This provides some general-purpose tools for finding fonts. The FontFinder object can search for font files. It aims to build a catalogue of fonts which our framework can work with. It may be useful if you are building GUIs or design-time interfaces and want to present users with a choice of fonts. There are 3 steps to using it 1. create FontFinder and set options and directories 2. search 3. query >>> import fontfinder >>> ff = fontfinder.FontFinder() >>> ff.addDirectories([dir1, dir2, dir3]) >>> ff.search() >>> ff.getFamilyNames() #or whichever queries you want... Because the disk search takes some time to find and parse hundreds of fonts, it can use a cache to store a file with all fonts found. The cache file name For each font found, it creates a structure with - the short font name - the long font name - the principal file (.pfb for type 1 fonts), and the metrics file if appropriate - the time modified (unix time stamp) - a type code ('ttf') - the family name - bold and italic attributes One common use is to display families in a dialog for end users; then select regular, bold and italic variants of the font. To get the initial list, use getFamilyNames; these will be in alpha order. >>> ff.getFamilyNames() ['Bitstream Vera Sans', 'Century Schoolbook L', 'Dingbats', 'LettErrorRobot', 'MS Gothic', 'MS Mincho', 'Nimbus Mono L', 'Nimbus Roman No9 L', 'Nimbus Sans L', 'Vera', 'Standard Symbols L', 'URW Bookman L', 'URW Chancery L', 'URW Gothic L', 'URW Palladio L'] One can then obtain a specific font as follows >>> f = ff.getFont('Bitstream Vera Sans', bold=False, italic=True) >>> f.fullName 'Bitstream Vera Sans' >>> f.fileName 'C:\code\reportlab\fonts\Vera.ttf' >>> It can also produce an XML report of fonts found by family, for the benefit of non-Python applications. Future plans might include using this to auto-register fonts; and making it update itself smartly on repeated instantiation. � N)�md5)� quoteattr)�process_time)�asBytes�asNativec �B � t | � S # t | d�� cY S xY w)Nzlatin-1��enc)� _asNative)�ss �:/usr/lib/python3/dist-packages/reportlab/lib/fontfinder.pyr r C s% � �*���|���*���y�)�)�s � �)z.ttfz.ttcz.otfz.pfbz.pfa� � � � � �@ i i i c �"