Source

pygame debug patch / docs / ref / freetype.html

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    
    <title>pygame.freetype &mdash; Pygame v1.9.2 documentation</title>
    <link rel="stylesheet" href="../_static/pygame.css" type="text/css" />
    <link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
    <script type="text/javascript">
      var DOCUMENTATION_OPTIONS = {
        URL_ROOT:    '../',
        VERSION:     '1.9.2',
        COLLAPSE_INDEX: false,
        FILE_SUFFIX: '.html',
        HAS_SOURCE:  true
      };
    </script>
    <script type="text/javascript" src="../_static/jquery.js"></script>
    <script type="text/javascript" src="../_static/underscore.js"></script>
    <script type="text/javascript" src="../_static/doctools.js"></script>
    <link rel="shortcut icon" href="../_static/pygame.ico"/>
    <link rel="top" title="Pygame v1.9.2 documentation" href="../index.html" />
    <link rel="next" title="pygame.gfxdraw" href="gfxdraw.html" />
    <link rel="prev" title="pygame.font" href="font.html" /> 
  </head>
  <body>  

    <div class="document">

  <div class="header">
    <table>
      <tr>
	<td class="logo">
	  <a href="http://www.pygame.org/">
	    <img src="../_static/pygame_tiny.png"/>
	  </a>
	  <h5>pygame documentation</h5>
	</td>
	<td class="pagelinks">
	  <p class="top">
	    ||
	    <a href="http://www.pygame.org/">Pygame Home</a> ||
	    <a href="../index.html">Help Contents</a> ||
	    <a href="../genindex.html">Reference Index</a> ||
	  </p>
	  <p class="bottom">
	    <a href="camera.html">camera</a> || 
	    <a href="cdrom.html">cdrom</a> || 
	    <a href="color.html">Color</a> || 
	    <a href="cursors.html">cursors</a> || 
	    <a href="display.html">display</a> || 
	    <a href="draw.html">draw</a> || 
	    <a href="event.html">event</a> || 
	    <a href="examples.html">examples</a> || 
	    <a href="font.html">font</a> || 
	    <a href="freetype.html">freetype</a> || 
	    <a href="gfxdraw.html">gfxdraw</a> || 
	    <a href="image.html">image</a> || 
	    <a href="joystick.html">joystick</a> || 
	    <a href="key.html">key</a> || 
	    <a href="locals.html">locals</a> || 
	    <a href="mask.html">mask</a> || 
	    <a href="math.html">math</a> || 
	    <a href="midi.html">midi</a> || 
	    <a href="mixer.html">mixer</a> || 
	    <a href="mouse.html">mouse</a> || 
	    <a href="movie.html">movie</a> || 
	    <a href="music.html">music</a> || 
	    <a href="overlay.html">Overlay</a> || 
	    <a href="pixelarray.html">PixelArray</a> || 
	    <a href="pixelcopy.html">pixelcopy</a> || 
	    <a href="pygame.html">pygame</a> || 
	    <a href="rect.html">Rect</a> || 
	    <a href="scrap.html">scrap</a> || 
	    <a href="sndarray.html">sndarray</a> || 
	    <a href="sprite.html">sprite</a> || 
	    <a href="surface.html">Surface</a> || 
	    <a href="surfarray.html">surfarray</a> || 
	    <a href="tests.html">tests</a> || 
	    <a href="time.html">time</a> || 
	    <a href="transform.html">transform</a> || 
	    <a href="pygame.html#module-pygame.version">version</a>
	  </p>
	</td>
      </tr>
    </table>
  </div>

      <div class="documentwrapper">
          <div class="body">
            
  <div class="sectionwrapper">
<div class="section" id="module-pygame.freetype">
<span id="pygame-freetype"></span><dl class="definition module">
<dt class="title module">
<tt class="docutils literal"><span class="pre">pygame.freetype</span></tt></dt>
<dd><div class="line-block">
<div class="line"><span class="summaryline">Enhanced Pygame module for loading and rendering computer fonts</span></div>
</div>
<table border="1" class="toc docutils">
<colgroup>
<col width="37%" />
<col width="1%" />
<col width="62%" />
</colgroup>
<tbody valign="top">
<tr><td><a class="toc reference external" href="freetype.html#pygame.freetype.get_error">pygame.freetype.get_error</a></td>
<td></td>
<td>Return the latest FreeType2 error</td>
</tr>
<tr><td><a class="toc reference external" href="freetype.html#pygame.freetype.get_version">pygame.freetype.get_version</a></td>
<td></td>
<td>Return the FreeType 2 version</td>
</tr>
<tr><td><a class="toc reference external" href="freetype.html#pygame.freetype.init">pygame.freetype.init</a></td>
<td></td>
<td>Initialize the underlying FreeType 2 library.</td>
</tr>
<tr><td><a class="toc reference external" href="freetype.html#pygame.freetype.quit">pygame.freetype.quit</a></td>
<td></td>
<td>Shut down the underlying FreeType 2 library.</td>
</tr>
<tr><td><a class="toc reference external" href="freetype.html#pygame.freetype.was_init">pygame.freetype.was_init</a></td>
<td></td>
<td>Return whether the the FreeType 2 library is initialized.</td>
</tr>
<tr><td><a class="toc reference external" href="freetype.html#pygame.freetype.get_default_resolution">pygame.freetype.get_default_resolution</a></td>
<td></td>
<td>Return the default pixel size in dots per inch</td>
</tr>
<tr><td><a class="toc reference external" href="freetype.html#pygame.freetype.set_default_resolution">pygame.freetype.set_default_resolution</a></td>
<td></td>
<td>Set the default pixel size in dots per inch for the module</td>
</tr>
<tr><td><a class="toc reference external" href="freetype.html#pygame.freetype.get_default_font">pygame.freetype.get_default_font</a></td>
<td></td>
<td>Get the filename of the default font</td>
</tr>
<tr><td><a class="toc reference external" href="freetype.html#pygame.freetype.Font">pygame.freetype.Font</a></td>
<td></td>
<td>Create a new Font instance from a supported font file.</td>
</tr>
</tbody>
</table>
<p>&#8212; Note that some features may change before a formal release</p>
<p>The <a class="tooltip reference internal" href="#module-pygame.freetype" title=""><tt class="xref py py-mod docutils literal"><span class="pre">pygame.freetype</span></tt><span class="tooltip-content">Enhanced Pygame module for loading and rendering computer fonts</span></a> module allows for the rendering of all font file formats
supported by FreeType, namely <tt class="docutils literal"><span class="pre">TTF</span></tt>, Type1, <tt class="docutils literal"><span class="pre">CFF</span></tt>, OpenType, <tt class="docutils literal"><span class="pre">SFNT</span></tt>, <tt class="docutils literal"><span class="pre">PCF</span></tt>,
<tt class="docutils literal"><span class="pre">FNT</span></tt>, <tt class="docutils literal"><span class="pre">BDF</span></tt>, <tt class="docutils literal"><span class="pre">PFR</span></tt> and Type42 fonts. It can render any UTF-32 character in a
font file.</p>
<p>This module is a replacement for <a class="tooltip reference internal" href="font.html#module-pygame.font" title=""><tt class="xref py py-mod docutils literal"><span class="pre">pygame.font</span></tt><span class="tooltip-content">pygame module for loading and rendering fonts</span></a>. It has all of the functionality
of the original, plus many new features. Yet is has absolutely no dependencies
on the SDL_ttf library. The <a class="tooltip reference internal" href="#module-pygame.freetype" title=""><tt class="xref py py-mod docutils literal"><span class="pre">pygame.freetype</span></tt><span class="tooltip-content">Enhanced Pygame module for loading and rendering computer fonts</span></a> module is not itself backward
compatible with <a class="tooltip reference internal" href="font.html#module-pygame.font" title=""><tt class="xref py py-mod docutils literal"><span class="pre">pygame.font</span></tt><span class="tooltip-content">pygame module for loading and rendering fonts</span></a>. Instead, a new <tt class="xref py py-mod docutils literal"><span class="pre">pygame.ftfont</span></tt> provides
a drop-in replacement for <a class="tooltip reference internal" href="font.html#module-pygame.font" title=""><tt class="xref py py-mod docutils literal"><span class="pre">pygame.font</span></tt><span class="tooltip-content">pygame module for loading and rendering fonts</span></a>.</p>
<p>Most of the work done with fonts is done by using the actual Font objects. The
module by itself only has routines to initialize itself and create Font objects
with <tt class="docutils literal"><span class="pre">pygame.freetype.Font()</span></tt>.</p>
<p>You can load fonts from the system by using the <tt class="docutils literal"><span class="pre">pygame.freetype.SysFont()</span></tt>
function. There are a few other functions to help find system fonts.</p>
<p>For now undefined character codes are replaced with the <tt class="docutils literal"><span class="pre">undefined</span> <span class="pre">character</span></tt>.
How undefined codes are handled may become configurable in a future release.</p>
<p>Pygame comes with a builtin default font. This can always be accessed by
passing None as the font name to the Font constructor.</p>
<p>New in Pygame 1.9.2</p>
<dl class="definition function">
<dt class="title" id="pygame.freetype.get_error">
<tt class="descclassname">pygame.freetype.</tt><tt class="descname">get_error</tt><big>(</big><big>)</big><a class="headerlink" href="#pygame.freetype.get_error" title="Permalink to this definition"></a></dt>
<dd><div class="line-block">
<div class="line"><span class="summaryline">Return the latest FreeType2 error</span></div>
<div class="line"><span class="signature">get_error() -&gt; str</span></div>
</div>
<p>Return a description of the last error which occurred in the FreeType2
library, or None if no errors have occurred.</p>
</dd></dl>

<dl class="definition function">
<dt class="title" id="pygame.freetype.get_version">
<tt class="descclassname">pygame.freetype.</tt><tt class="descname">get_version</tt><big>(</big><big>)</big><a class="headerlink" href="#pygame.freetype.get_version" title="Permalink to this definition"></a></dt>
<dd><div class="line-block">
<div class="line"><span class="summaryline">Return the FreeType 2 version</span></div>
<div class="line"><span class="signature">get_version() -&gt; (int, int, int)</span></div>
</div>
<p>Returns the version of the FreeType2 library which was used to build the
&#8216;freetype&#8217; module.</p>
<p>Note that the freetype module depends on the FreeType 2 library. It will
not compile with the original FreeType 1.0. Hence, the first element of the
tuple will always be &#8220;2&#8221;.</p>
</dd></dl>

<dl class="definition function">
<dt class="title" id="pygame.freetype.init">
<tt class="descclassname">pygame.freetype.</tt><tt class="descname">init</tt><big>(</big><big>)</big><a class="headerlink" href="#pygame.freetype.init" title="Permalink to this definition"></a></dt>
<dd><div class="line-block">
<div class="line"><span class="summaryline">Initialize the underlying FreeType 2 library.</span></div>
<div class="line"><span class="signature">init(cache_size=64, resolution=72) -&gt; None</span></div>
</div>
<p>This function initializes the underlying FreeType 2 library and must be
called before trying to use any of the functionality of the &#8216;freetype&#8217;
module.</p>
<p>However, this function will be automatically called by <tt class="docutils literal"><span class="pre">pygame.init()</span></tt>.
It is safe to call this function more than once.</p>
<p>Optionally, you may specify a default size for the Glyph cache: this is the
maximum number of glyphs that will be cached at any given time by the
module. Exceedingly small values will be automatically tuned for
performance. Also a default pixel resolution, in dots per inch, can
be given to adjust font scaling.</p>
</dd></dl>

<dl class="definition function">
<dt class="title" id="pygame.freetype.quit">
<tt class="descclassname">pygame.freetype.</tt><tt class="descname">quit</tt><big>(</big><big>)</big><a class="headerlink" href="#pygame.freetype.quit" title="Permalink to this definition"></a></dt>
<dd><div class="line-block">
<div class="line"><span class="summaryline">Shut down the underlying FreeType 2 library.</span></div>
<div class="line"><span class="signature">quit() -&gt; None</span></div>
</div>
<p>This function de-initializes the <tt class="docutils literal"><span class="pre">freetype</span></tt> module. After calling this
function, you should not invoke any class, method or function related to the
<tt class="docutils literal"><span class="pre">freetype</span></tt> module as they are likely to fail or might give unpredictable
results. It is safe to call this function even if the module hasn&#8217;t been
initialized yet.</p>
</dd></dl>

<dl class="definition function">
<dt class="title" id="pygame.freetype.was_init">
<tt class="descclassname">pygame.freetype.</tt><tt class="descname">was_init</tt><big>(</big><big>)</big><a class="headerlink" href="#pygame.freetype.was_init" title="Permalink to this definition"></a></dt>
<dd><div class="line-block">
<div class="line"><span class="summaryline">Return whether the the FreeType 2 library is initialized.</span></div>
<div class="line"><span class="signature">was_init() -&gt; bool</span></div>
</div>
<p>Returns whether the the FreeType 2 library is initialized.</p>
</dd></dl>

<dl class="definition function">
<dt class="title" id="pygame.freetype.get_default_resolution">
<tt class="descclassname">pygame.freetype.</tt><tt class="descname">get_default_resolution</tt><big>(</big><big>)</big><a class="headerlink" href="#pygame.freetype.get_default_resolution" title="Permalink to this definition"></a></dt>
<dd><div class="line-block">
<div class="line"><span class="summaryline">Return the default pixel size in dots per inch</span></div>
<div class="line"><span class="signature">get_default_resolution() -&gt; long</span></div>
</div>
<p>Returns the default pixel size, in dots per inch for the module. If not changed
it will be 72.</p>
</dd></dl>

<dl class="definition function">
<dt class="title" id="pygame.freetype.set_default_resolution">
<tt class="descclassname">pygame.freetype.</tt><tt class="descname">set_default_resolution</tt><big>(</big><big>)</big><a class="headerlink" href="#pygame.freetype.set_default_resolution" title="Permalink to this definition"></a></dt>
<dd><div class="line-block">
<div class="line"><span class="summaryline">Set the default pixel size in dots per inch for the module</span></div>
<div class="line"><span class="signature">set_default_resolution([resolution]) -&gt; None</span></div>
</div>
<p>Set the default pixel size, in dots per inch, for the module. If the
optional argument is omitted or zero the resolution is reset to 72.</p>
</dd></dl>

<dl class="definition function">
<dt class="title" id="pygame.freetype.get_default_font">
<tt class="descclassname">pygame.freetype.</tt><tt class="descname">get_default_font</tt><big>(</big><big>)</big><a class="headerlink" href="#pygame.freetype.get_default_font" title="Permalink to this definition"></a></dt>
<dd><div class="line-block">
<div class="line"><span class="summaryline">Get the filename of the default font</span></div>
<div class="line"><span class="signature">get_default_font() -&gt; string</span></div>
</div>
<p>Return the filename of the system font. This is not the full path to the
file. This file can usually be found in the same directory as the font
module, but it can also be bundled in separate archives.</p>
</dd></dl>

<dl class="definition class">
<dt class="title" id="pygame.freetype.Font">
<em class="property">class </em><tt class="descclassname">pygame.freetype.</tt><tt class="descname">Font</tt><a class="headerlink" href="#pygame.freetype.Font" title="Permalink to this definition"></a></dt>
<dd><div class="line-block">
<div class="line"><span class="summaryline">Create a new Font instance from a supported font file.</span></div>
<div class="line"><span class="signature">Font(file, style=STYLE_NONE, ptsize=-1, font_index=0, vertical=0, ucs4=0, resolution=0) -&gt; Font</span></div>
</div>
<table border="1" class="toc docutils">
<colgroup>
<col width="39%" />
<col width="1%" />
<col width="60%" />
</colgroup>
<tbody valign="top">
<tr><td><a class="toc reference external" href="freetype.html#pygame.freetype.Font.name">pygame.freetype.Font.name</a></td>
<td></td>
<td>Proper font name.</td>
</tr>
<tr><td><a class="toc reference external" href="freetype.html#pygame.freetype.Font.path">pygame.freetype.Font.path</a></td>
<td></td>
<td>Font file path</td>
</tr>
<tr><td><a class="toc reference external" href="freetype.html#pygame.freetype.Font.get_rect">pygame.freetype.Font.get_rect</a></td>
<td></td>
<td>Return the size and offset of rendered text</td>
</tr>
<tr><td><a class="toc reference external" href="freetype.html#pygame.freetype.Font.get_metrics">pygame.freetype.Font.get_metrics</a></td>
<td></td>
<td>Return the glyph metrics for the given text</td>
</tr>
<tr><td><a class="toc reference external" href="freetype.html#pygame.freetype.Font.height">pygame.freetype.Font.height</a></td>
<td></td>
<td>The unscaled height of the font in font units</td>
</tr>
<tr><td><a class="toc reference external" href="freetype.html#pygame.freetype.Font.ascender">pygame.freetype.Font.ascender</a></td>
<td></td>
<td>The unscaled ascent of the font in font units</td>
</tr>
<tr><td><a class="toc reference external" href="freetype.html#pygame.freetype.Font.descender">pygame.freetype.Font.descender</a></td>
<td></td>
<td>The unscaled descent of the font in font units</td>
</tr>
<tr><td><a class="toc reference external" href="freetype.html#pygame.freetype.Font.get_sized_ascender">pygame.freetype.Font.get_sized_ascender</a></td>
<td></td>
<td>The scaled ascent of the font in pixels</td>
</tr>
<tr><td><a class="toc reference external" href="freetype.html#pygame.freetype.Font.get_sized_descender">pygame.freetype.Font.get_sized_descender</a></td>
<td></td>
<td>The scaled descent of the font in pixels</td>
</tr>
<tr><td><a class="toc reference external" href="freetype.html#pygame.freetype.Font.get_sized_height">pygame.freetype.Font.get_sized_height</a></td>
<td></td>
<td>The scaled height of the font in pixels</td>
</tr>
<tr><td><a class="toc reference external" href="freetype.html#pygame.freetype.Font.get_sized_glyph_height">pygame.freetype.Font.get_sized_glyph_height</a></td>
<td></td>
<td>The scaled bounding box height of the font in pixels</td>
</tr>
<tr><td><a class="toc reference external" href="freetype.html#pygame.freetype.Font.render">pygame.freetype.Font.render</a></td>
<td></td>
<td>Return rendered text as a surface</td>
</tr>
<tr><td><a class="toc reference external" href="freetype.html#pygame.freetype.Font.render_to">pygame.freetype.Font.render_to</a></td>
<td></td>
<td>Render text onto an existing surface</td>
</tr>
<tr><td><a class="toc reference external" href="freetype.html#pygame.freetype.Font.render_raw">pygame.freetype.Font.render_raw</a></td>
<td></td>
<td>Return rendered text as a string of bytes</td>
</tr>
<tr><td><a class="toc reference external" href="freetype.html#pygame.freetype.Font.render_raw_to">pygame.freetype.Font.render_raw_to</a></td>
<td></td>
<td>Render text into an array of ints</td>
</tr>
<tr><td><a class="toc reference external" href="freetype.html#pygame.freetype.Font.style">pygame.freetype.Font.style</a></td>
<td></td>
<td>The font&#8217;s style flags</td>
</tr>
<tr><td><a class="toc reference external" href="freetype.html#pygame.freetype.Font.underline">pygame.freetype.Font.underline</a></td>
<td></td>
<td>The state of the font&#8217;s underline style flag</td>
</tr>
<tr><td><a class="toc reference external" href="freetype.html#pygame.freetype.Font.strong">pygame.freetype.Font.strong</a></td>
<td></td>
<td>The state of the font&#8217;s strong style flag</td>
</tr>
<tr><td><a class="toc reference external" href="freetype.html#pygame.freetype.Font.oblique">pygame.freetype.Font.oblique</a></td>
<td></td>
<td>The state of the font&#8217;s oblique style flag</td>
</tr>
<tr><td><a class="toc reference external" href="freetype.html#pygame.freetype.Font.wide">pygame.freetype.Font.wide</a></td>
<td></td>
<td>The state of the font&#8217;s wide style flag</td>
</tr>
<tr><td><a class="toc reference external" href="freetype.html#pygame.freetype.Font.strength">pygame.freetype.Font.strength</a></td>
<td></td>
<td>The strength associated with the strong or wide font styles</td>
</tr>
<tr><td><a class="toc reference external" href="freetype.html#pygame.freetype.Font.underline_adjustment">pygame.freetype.Font.underline_adjustment</a></td>
<td></td>
<td>Adjustment factor for the underline position</td>
</tr>
<tr><td><a class="toc reference external" href="freetype.html#pygame.freetype.Font.fixed_width">pygame.freetype.Font.fixed_width</a></td>
<td></td>
<td>Gets whether the font is fixed-width</td>
</tr>
<tr><td><a class="toc reference external" href="freetype.html#pygame.freetype.Font.antialiased">pygame.freetype.Font.antialiased</a></td>
<td></td>
<td>Font anti-aliasing mode</td>
</tr>
<tr><td><a class="toc reference external" href="freetype.html#pygame.freetype.Font.kerning">pygame.freetype.Font.kerning</a></td>
<td></td>
<td>Character kerning mode</td>
</tr>
<tr><td><a class="toc reference external" href="freetype.html#pygame.freetype.Font.vertical">pygame.freetype.Font.vertical</a></td>
<td></td>
<td>Font vertical mode</td>
</tr>
<tr><td><a class="toc reference external" href="freetype.html#pygame.freetype.Font.origin">pygame.freetype.Font.origin</a></td>
<td></td>
<td>Font render to text origin mode</td>
</tr>
<tr><td><a class="toc reference external" href="freetype.html#pygame.freetype.Font.pad">pygame.freetype.Font.pad</a></td>
<td></td>
<td>padded boundary mode</td>
</tr>
<tr><td><a class="toc reference external" href="freetype.html#pygame.freetype.Font.ucs4">pygame.freetype.Font.ucs4</a></td>
<td></td>
<td>Enable UCS-4 mode</td>
</tr>
<tr><td><a class="toc reference external" href="freetype.html#pygame.freetype.Font.resolution">pygame.freetype.Font.resolution</a></td>
<td></td>
<td>Pixel resolution in dots per inch</td>
</tr>
</tbody>
</table>
<p>Argument <em>file</em> can be either a string representing the font&#8217;s filename, a
file-like object containing the font, or None; if None, the default, built-in font
is used.</p>
<p>Optionally, a <em>ptsize</em> argument may be specified to set the default size in
points, which will be used when rendering the font. The size can also be
passed explicitly to each method call. Because of the way the caching
system works, specifying a default size on the constructor doesn&#8217;t imply a
performance gain over manually passing the size on each function call.</p>
<p>If the font file has more than one font, the font to load can be chosen with
the <em>index</em> argument. An exception is raised for an out-of-range font index
value.</p>
<p>The <em>style</em> argument will set the default style (oblique, underline, strong)
used to draw this font. This style may be overridden on any <a class="reference internal" href="#pygame.freetype.Font.render" title="pygame.freetype.Font.render"><tt class="xref py py-meth docutils literal"><span class="pre">Font.render()</span></tt></a>
call.</p>
<p>The optional vertical argument, an integer, sets the default orientation
for the font: 0 (False) for horizontal, any other value (True) for vertical.
See <a class="reference internal" href="#pygame.freetype.Font.vertical" title="pygame.freetype.Font.vertical"><tt class="xref py py-attr docutils literal"><span class="pre">Font.vertical</span></tt></a>.</p>
<p>The optional ucs4 argument, an integer, sets the default text translation
mode: 0 (False) recognize UTF-16 surrogate pairs, any other value (True),
to treat Unicode text as UCS-4, with no surrogate pairs. See
<a class="reference internal" href="#pygame.freetype.Font.ucs4" title="pygame.freetype.Font.ucs4"><tt class="xref py py-attr docutils literal"><span class="pre">Font.ucs4</span></tt></a>.</p>
<p>The optional resolution argument sets the pixel size, in dots per inch,
for use in scaling glyphs for this Font instance. If 0 then the default
module value, set by <tt class="xref py py-meth docutils literal"><span class="pre">freetype.init()</span></tt>, is used. The Font object&#8217;s
resolution can only be changed by reinitializing the Font instance.</p>
<dl class="definition attribute">
<dt class="title" id="pygame.freetype.Font.name">
<tt class="descname">name</tt><a class="headerlink" href="#pygame.freetype.Font.name" title="Permalink to this definition"></a></dt>
<dd><div class="line-block">
<div class="line"><span class="summaryline">Proper font name.</span></div>
<div class="line"><span class="signature">name -&gt; string</span></div>
</div>
<p>Read only. Returns the real (long) name of the font, as
recorded in the font file.</p>
</dd></dl>

<dl class="definition attribute">
<dt class="title" id="pygame.freetype.Font.path">
<tt class="descname">path</tt><a class="headerlink" href="#pygame.freetype.Font.path" title="Permalink to this definition"></a></dt>
<dd><div class="line-block">
<div class="line"><span class="summaryline">Font file path</span></div>
<div class="line"><span class="signature">path -&gt; unicode</span></div>
</div>
<p>Read only. Returns the path of the loaded font file</p>
</dd></dl>

<dl class="definition method">
<dt class="title" id="pygame.freetype.Font.get_rect">
<tt class="descname">get_rect</tt><big>(</big><big>)</big><a class="headerlink" href="#pygame.freetype.Font.get_rect" title="Permalink to this definition"></a></dt>
<dd><div class="line-block">
<div class="line"><span class="summaryline">Return the size and offset of rendered text</span></div>
<div class="line"><span class="signature">get_rect(text, style=STYLE_DEFAULT, rotation=0, ptsize=default) -&gt; rect</span></div>
</div>
<p>Gets the final dimensions and origin, in pixels, of &#8216;text&#8217; using the
current point size, style, rotation and orientation. These are either
taken from the arguments, if given, else from the default values set
for the font object.</p>
<p>Returns a rect containing the width and height of the text&#8217;s bounding
box and the position of the text&#8217;s origin. The origin can be used
to align separately rendered pieces of text. It gives the baseline
position and bearing at the start of the text.</p>
<p>If text is a char (byte) string, then its encoding is assumed to be
<tt class="docutils literal"><span class="pre">LATIN1</span></tt>.</p>
</dd></dl>

<dl class="definition method">
<dt class="title" id="pygame.freetype.Font.get_metrics">
<tt class="descname">get_metrics</tt><big>(</big><big>)</big><a class="headerlink" href="#pygame.freetype.Font.get_metrics" title="Permalink to this definition"></a></dt>
<dd><div class="line-block">
<div class="line"><span class="summaryline">Return the glyph metrics for the given text</span></div>
<div class="line"><span class="signature">get_metrics(text, ptsize=default) -&gt; [(...), ...]</span></div>
</div>
<p>Returns the glyph metrics for each character in &#8216;text&#8217;.</p>
<p>The glyph metrics are returned inside a list; each character will be
represented as a tuple inside the list with the following values:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="p">(</span><span class="n">min_x</span><span class="p">,</span> <span class="n">max_x</span><span class="p">,</span> <span class="n">min_y</span><span class="p">,</span> <span class="n">max_y</span><span class="p">,</span> <span class="n">horizontal_advance_x</span><span class="p">,</span> <span class="n">horizontal_advance_y</span><span class="p">)</span>
</pre></div>
</div>
<p>The bounding box min_x, max_y, min_y, and max_y values are returned as
grid-fitted pixel coordinates of type int. The advance values are
float values.</p>
<p>The calculations are done using the font&#8217;s default size in points.
Optionally you may specify another point size to use.</p>
<p>The metrics are adjusted for the current rotation, strong, and oblique
settings.</p>
<p>If text is a char (byte) string, then its encoding is assumed to be
<tt class="docutils literal"><span class="pre">LATIN1</span></tt>.</p>
</dd></dl>

<dl class="definition attribute">
<dt class="title" id="pygame.freetype.Font.height">
<tt class="descname">height</tt><a class="headerlink" href="#pygame.freetype.Font.height" title="Permalink to this definition"></a></dt>
<dd><div class="line-block">
<div class="line"><span class="summaryline">The unscaled height of the font in font units</span></div>
<div class="line"><span class="signature">height -&gt; int</span></div>
</div>
<p>Read only. Gets the height of the font. This is the average value of all
glyphs in the font.</p>
</dd></dl>

<dl class="definition method">
<dt class="title" id="pygame.freetype.Font.ascender">
<tt class="descname">ascender</tt><big>(</big><big>)</big><a class="headerlink" href="#pygame.freetype.Font.ascender" title="Permalink to this definition"></a></dt>
<dd><div class="line-block">
<div class="line"><span class="summaryline">The unscaled ascent of the font in font units</span></div>
<div class="line"><span class="signature">ascender -&gt; int</span></div>
</div>
<p>Read only. Return the number of units from the font&#8217;s baseline to
the top of the bounding box.</p>
</dd></dl>

<dl class="definition attribute">
<dt class="title" id="pygame.freetype.Font.descender">
<tt class="descname">descender</tt><a class="headerlink" href="#pygame.freetype.Font.descender" title="Permalink to this definition"></a></dt>
<dd><div class="line-block">
<div class="line"><span class="summaryline">The unscaled descent of the font in font units</span></div>
<div class="line"><span class="signature">descender -&gt; int</span></div>
</div>
<p>Read only. Return the height in font units for the font descent.
The descent is the number of units from the font&#8217;s baseline to the
bottom of the bounding box.</p>
</dd></dl>

<dl class="definition attribute">
<dt class="title" id="pygame.freetype.Font.get_sized_ascender">
<tt class="descname">get_sized_ascender</tt><a class="headerlink" href="#pygame.freetype.Font.get_sized_ascender" title="Permalink to this definition"></a></dt>
<dd><div class="line-block">
<div class="line"><span class="summaryline">The scaled ascent of the font in pixels</span></div>
<div class="line"><span class="signature">get_sized_ascender() -&gt; int</span></div>
</div>
<p>Return the number of units from the font&#8217;s baseline to the top of the
bounding box. It is not adjusted for strong or rotation.</p>
</dd></dl>

<dl class="definition method">
<dt class="title" id="pygame.freetype.Font.get_sized_descender">
<tt class="descname">get_sized_descender</tt><big>(</big><big>)</big><a class="headerlink" href="#pygame.freetype.Font.get_sized_descender" title="Permalink to this definition"></a></dt>
<dd><div class="line-block">
<div class="line"><span class="summaryline">The scaled descent of the font in pixels</span></div>
<div class="line"><span class="signature">get_sized_descender() -&gt; int</span></div>
</div>
<p>Return the number of pixels from the font&#8217;s baseline to the top of the
bounding box. It is not adjusted for strong or rotation.</p>
</dd></dl>

<dl class="definition attribute">
<dt class="title" id="pygame.freetype.Font.get_sized_height">
<tt class="descname">get_sized_height</tt><a class="headerlink" href="#pygame.freetype.Font.get_sized_height" title="Permalink to this definition"></a></dt>
<dd><div class="line-block">
<div class="line"><span class="summaryline">The scaled height of the font in pixels</span></div>
<div class="line"><span class="signature">get_sized_height() -&gt; int</span></div>
</div>
<p>Read only. Gets the height of the font. This is the average value of all
glyphs in the font. It is not adjusted for strong or rotation.</p>
</dd></dl>

<dl class="definition method">
<dt class="title" id="pygame.freetype.Font.get_sized_glyph_height">
<tt class="descname">get_sized_glyph_height</tt><big>(</big><big>)</big><a class="headerlink" href="#pygame.freetype.Font.get_sized_glyph_height" title="Permalink to this definition"></a></dt>
<dd><div class="line-block">
<div class="line"><span class="summaryline">The scaled bounding box height of the font in pixels</span></div>
<div class="line"><span class="signature">get_sized_glyph_height() -&gt; int</span></div>
</div>
<p>Return the glyph bounding box height of the font in pixels.
This is the average value of all glyphs in the font.
It is not adjusted for strong or rotation.</p>
</dd></dl>

<dl class="definition method">
<dt class="title" id="pygame.freetype.Font.render">
<tt class="descname">render</tt><big>(</big><big>)</big><a class="headerlink" href="#pygame.freetype.Font.render" title="Permalink to this definition"></a></dt>
<dd><div class="line-block">
<div class="line"><span class="summaryline">Return rendered text as a surface</span></div>
<div class="line"><span class="signature">render(text, fgcolor, bgcolor=None, style=STYLE_DEFAULT, rotation=0, ptsize=default) -&gt; (Surface, Rect)</span></div>
</div>
<p>Returns a new <a class="tooltip reference internal" href="surface.html#pygame.Surface" title=""><tt class="xref py py-mod docutils literal"><span class="pre">pygame.Surface</span></tt><span class="tooltip-content">pygame object for representing images</span></a>, with the text rendered to it
in the color given by &#8216;fgcolor&#8217;. If <tt class="docutils literal"><span class="pre">bgcolor</span></tt> is given, the surface
will be filled with this color. If no background color is given,
the surface is filled with zero alpha opacity. Normally the returned
surface has a 32 bit pixel size. However, if <tt class="docutils literal"><span class="pre">bgcolor</span></tt> is <tt class="xref docutils literal"><span class="pre">None</span></tt>
and anti-aliasing is disabled a two color 8 bit surface with colorkey
set for the background color is returned.</p>
<p>The return value is a tuple: the new surface and the bounding
rectangle giving the size and origin of the rendered text.</p>
<p>If an empty string is passed for text then the returned Rect is zero
width and the height of the font. If dest is None the returned surface is
the same dimensions as the boundary rect. The rect will test False.</p>
<p>The rendering is done using the font&#8217;s default size in points and its
default style, without any rotation, and taking into account fonts which
are set to be drawn vertically via the <a class="reference internal" href="#pygame.freetype.Font.vertical" title="pygame.freetype.Font.vertical"><tt class="xref py py-meth docutils literal"><span class="pre">Font.vertical()</span></tt></a> attribute.
Optionally you may specify another point size to use via the &#8216;ptsize&#8217;
argument, a text rotation via the &#8216;rotation&#8217; argument, or a new text
style via the &#8216;style&#8217; argument.</p>
<p>If text is a char (byte) string, then its encoding is assumed to be
<tt class="docutils literal"><span class="pre">LATIN1</span></tt>.</p>
</dd></dl>

<dl class="definition method">
<dt class="title" id="pygame.freetype.Font.render_to">
<tt class="descname">render_to</tt><big>(</big><big>)</big><a class="headerlink" href="#pygame.freetype.Font.render_to" title="Permalink to this definition"></a></dt>
<dd><div class="line-block">
<div class="line"><span class="summaryline">Render text onto an existing surface</span></div>
<div class="line"><span class="signature">render(surf, dest, text, fgcolor, bgcolor=None, style=STYLE_DEFAULT, rotation=0, ptsize=default) -&gt; Rect</span></div>
</div>
<p>Renders the string &#8216;text&#8217; to a <a class="tooltip reference internal" href="surface.html#pygame.Surface" title=""><tt class="xref py py-mod docutils literal"><span class="pre">pygame.Surface</span></tt><span class="tooltip-content">pygame object for representing images</span></a> &#8216;surf&#8217;,
using the color &#8216;fgcolor&#8217;.</p>
<p>Argument &#8216;dest&#8217; is an (x, y) surface coordinate pair. If either x
or y is not an integer it is converted to one if possible.
Any sequence, including Rect, for which the first two elements are
positions x and y is accepted.</p>
<p>If a background color is given, the surface is first filled with that
color. The text is blitted next. Both the background fill and text
rendering involve full alpha blits. That is, the alpha values of
both the foreground and background colors, as well as those of the
destination surface if it has per-pixel alpha.</p>
<p>The return value is a rectangle giving the size and position of the
rendered text within the surface.</p>
<p>If an empty string is passed for text then the returned Rect is zero
width and the height of the font. The rect will test False.</p>
<p>By default, the point size and style set for the font are used
if not passed as arguments. The text is unrotated unless a non-zero
rotation value is given.</p>
<p>If text is a char (byte) string, then its encoding is assumed to be
<tt class="docutils literal"><span class="pre">LATIN1</span></tt>.</p>
</dd></dl>

<dl class="definition method">
<dt class="title" id="pygame.freetype.Font.render_raw">
<tt class="descname">render_raw</tt><big>(</big><big>)</big><a class="headerlink" href="#pygame.freetype.Font.render_raw" title="Permalink to this definition"></a></dt>
<dd><div class="line-block">
<div class="line"><span class="summaryline">Return rendered text as a string of bytes</span></div>
<div class="line"><span class="signature">render_raw(text, style=STYLE_DEFAULT, rotation=0, ptsize=default, invert=False) -&gt; (bytes, (int, int))</span></div>
</div>
<p>Like <tt class="docutils literal"><span class="pre">Font.render()</span></tt> but the tuple returned is an 8 bit
monochrome string of bytes and its size. The foreground color is 255, the
background 0, useful as an alpha mask for a foreground pattern.</p>
</dd></dl>

<dl class="definition method">
<dt class="title" id="pygame.freetype.Font.render_raw_to">
<tt class="descname">render_raw_to</tt><big>(</big><big>)</big><a class="headerlink" href="#pygame.freetype.Font.render_raw_to" title="Permalink to this definition"></a></dt>
<dd><div class="line-block">
<div class="line"><span class="summaryline">Render text into an array of ints</span></div>
<div class="line"><span class="signature">render_raw_to(array, text, dest=None, style=STYLE_DEFAULT, rotation=0, ptsize=default, invert=False) -&gt; (int, int)</span></div>
</div>
<p>Render to an array object exposing an array struct interface. The array
must be two dimensional with integer items. The default dest value, None,
is equivalent to (0, 0).</p>
</dd></dl>

<dl class="definition attribute">
<dt class="title" id="pygame.freetype.Font.style">
<tt class="descname">style</tt><a class="headerlink" href="#pygame.freetype.Font.style" title="Permalink to this definition"></a></dt>
<dd><div class="line-block">
<div class="line"><span class="summaryline">The font&#8217;s style flags</span></div>
<div class="line"><span class="signature">style &lt;-&gt; int</span></div>
</div>
<p>Gets or sets the default style of the Font. This default style will be
used for all text rendering and size calculations unless overridden
specifically in the `render()` or `get_size()` calls. The style value
may be a bit-wise <tt class="docutils literal"><span class="pre">OR</span></tt> of one or more of the following constants:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="n">STYLE_NONE</span>
<span class="n">STYLE_UNDERLINE</span>
<span class="n">STYLE_OBLIQUE</span>
<span class="n">STYLE_STRONG</span>
<span class="n">STYLE_WIDE</span>
</pre></div>
</div>
<p>These constants may be found on the FreeType constants module.
Optionally, the default style can be modified or obtained accessing the
individual style attributes (underline, oblique, strong).</p>
</dd></dl>

<dl class="definition attribute">
<dt class="title" id="pygame.freetype.Font.underline">
<tt class="descname">underline</tt><a class="headerlink" href="#pygame.freetype.Font.underline" title="Permalink to this definition"></a></dt>
<dd><div class="line-block">
<div class="line"><span class="summaryline">The state of the font&#8217;s underline style flag</span></div>
<div class="line"><span class="signature">underline &lt;-&gt; bool</span></div>
</div>
<p>Gets or sets whether the font will be underlined when drawing text. This
default style value will be used for all text rendering and size
calculations unless overridden specifically in the `render()` or
`get_size()` calls, via the &#8216;style&#8217; parameter.</p>
</dd></dl>

<dl class="definition attribute">
<dt class="title" id="pygame.freetype.Font.strong">
<tt class="descname">strong</tt><a class="headerlink" href="#pygame.freetype.Font.strong" title="Permalink to this definition"></a></dt>
<dd><div class="line-block">
<div class="line"><span class="summaryline">The state of the font&#8217;s strong style flag</span></div>
<div class="line"><span class="signature">strong &lt;-&gt; bool</span></div>
</div>
<p>Gets or sets whether the font will be bold when drawing text. This
default style value will be used for all text rendering and size
calculations unless overridden specifically in the `render()` or
`get_size()` calls, via the &#8216;style&#8217; parameter.</p>
</dd></dl>

<dl class="definition attribute">
<dt class="title" id="pygame.freetype.Font.oblique">
<tt class="descname">oblique</tt><a class="headerlink" href="#pygame.freetype.Font.oblique" title="Permalink to this definition"></a></dt>
<dd><div class="line-block">
<div class="line"><span class="summaryline">The state of the font&#8217;s oblique style flag</span></div>
<div class="line"><span class="signature">oblique &lt;-&gt; bool</span></div>
</div>
<p>Gets or sets whether the font will be rendered as oblique. This
default style value will be used for all text rendering and size
calculations unless overridden specifically in the `render()` or
`get_size()` calls, via the &#8216;style&#8217; parameter.</p>
</dd></dl>

<dl class="definition attribute">
<dt class="title" id="pygame.freetype.Font.wide">
<tt class="descname">wide</tt><a class="headerlink" href="#pygame.freetype.Font.wide" title="Permalink to this definition"></a></dt>
<dd><div class="line-block">
<div class="line"><span class="summaryline">The state of the font&#8217;s wide style flag</span></div>
<div class="line"><span class="signature">wide &lt;-&gt; bool</span></div>
</div>
<p>Gets or sets whether the font will be stretched horizontally
when drawing text. It produces a result similar to font.Font&#8217;s
bold. This style is only available for unrotated text.</p>
</dd></dl>

<dl class="definition attribute">
<dt class="title" id="pygame.freetype.Font.strength">
<tt class="descname">strength</tt><a class="headerlink" href="#pygame.freetype.Font.strength" title="Permalink to this definition"></a></dt>
<dd><div class="line-block">
<div class="line"><span class="summaryline">The strength associated with the strong or wide font styles</span></div>
<div class="line"><span class="signature">strength &lt;-&gt; float</span></div>
</div>
<p>The amount by which a font glyph&#8217;s size is enlarged for the
strong or wide transformations, as a fraction of the untransformed
size. For the wide style only the horizontal dimension is
increased. For strong text both the horizontal and vertical
dimensions are enlarged. A wide style of strength 1/12 is
equivalent to the font.Font bold style. The default is 1/36.</p>
</dd></dl>

<dl class="definition attribute">
<dt class="title" id="pygame.freetype.Font.underline_adjustment">
<tt class="descname">underline_adjustment</tt><a class="headerlink" href="#pygame.freetype.Font.underline_adjustment" title="Permalink to this definition"></a></dt>
<dd><div class="line-block">
<div class="line"><span class="summaryline">Adjustment factor for the underline position</span></div>
<div class="line"><span class="signature">underline_adjustment &lt;-&gt; float</span></div>
</div>
<p>Gets or sets a factor which, when positive, is multiplied with the
font&#8217;s underline offset to adjust the underline position. A negative
value turns an underline into a strike-through or overline. It is
multiplied with the ascender. Accepted values are between -2.0 and 2.0
inclusive. A value of 0.5 closely matches Tango underlining. A value of
1.0 mimics SDL_ttf.</p>
</dd></dl>

<dl class="definition attribute">
<dt class="title" id="pygame.freetype.Font.fixed_width">
<tt class="descname">fixed_width</tt><a class="headerlink" href="#pygame.freetype.Font.fixed_width" title="Permalink to this definition"></a></dt>
<dd><div class="line-block">
<div class="line"><span class="summaryline">Gets whether the font is fixed-width</span></div>
<div class="line"><span class="signature">fixed_width -&gt; bool</span></div>
</div>
<p>Read only. Returns whether this Font is a fixed-width (bitmap) font.</p>
<p>Note that scalable fonts whose glyphs are all the same width (i.e.
monospace <tt class="docutils literal"><span class="pre">TTF</span></tt> fonts used for programming) are not considered fixed
width.</p>
</dd></dl>

<dl class="definition attribute">
<dt class="title" id="pygame.freetype.Font.antialiased">
<tt class="descname">antialiased</tt><a class="headerlink" href="#pygame.freetype.Font.antialiased" title="Permalink to this definition"></a></dt>
<dd><div class="line-block">
<div class="line"><span class="summaryline">Font anti-aliasing mode</span></div>
<div class="line"><span class="signature">antialiased &lt;-&gt; bool</span></div>
</div>
<p>Gets or sets the font&#8217;s anti-aliasing mode. This defaults to <tt class="xref docutils literal"><span class="pre">True</span></tt> on
all fonts, which are rendered with full 8 bit blending.</p>
<p>Setting this to <tt class="xref docutils literal"><span class="pre">False</span></tt> will enable monochrome rendering. This should
provide a small speed gain and reduce cache memory size.</p>
</dd></dl>

<dl class="definition attribute">
<dt class="title" id="pygame.freetype.Font.kerning">
<tt class="descname">kerning</tt><a class="headerlink" href="#pygame.freetype.Font.kerning" title="Permalink to this definition"></a></dt>
<dd><div class="line-block">
<div class="line"><span class="summaryline">Character kerning mode</span></div>
<div class="line"><span class="signature">kerning -&gt; bool</span></div>
</div>
<p>Gets or sets the font&#8217;s kerning mode. This defaults to False on all
fonts, which will be rendered by default without kerning.</p>
<p>Setting this to true will change all rendering methods to do kerning
between character pairs for surface size calculation and all
render operations.</p>
</dd></dl>

<dl class="definition attribute">
<dt class="title" id="pygame.freetype.Font.vertical">
<tt class="descname">vertical</tt><a class="headerlink" href="#pygame.freetype.Font.vertical" title="Permalink to this definition"></a></dt>
<dd><div class="line-block">
<div class="line"><span class="summaryline">Font vertical mode</span></div>
<div class="line"><span class="signature">vertical -&gt; bool</span></div>
</div>
<p>Gets or sets whether the font is a vertical font such as fonts in fonts
representing Kanji glyphs or other styles of vertical writing.</p>
<p>Changing this attribute will cause the font to be rendering vertically,
and affects all other methods which manage glyphs or text layouts to use
vertical metrics accordingly.</p>
<p>Note that the FreeType library doesn&#8217;t automatically detect whether a
font contains glyphs which are always supposed to be drawn vertically, so
this attribute must be set manually by the user.</p>
<p>Also note that several font formats (especially bitmap based ones) don&#8217;t
contain the necessary metrics to draw glyphs vertically, so drawing in
those cases will give unspecified results.</p>
</dd></dl>

<dl class="definition attribute">
<dt class="title" id="pygame.freetype.Font.origin">
<tt class="descname">origin</tt><a class="headerlink" href="#pygame.freetype.Font.origin" title="Permalink to this definition"></a></dt>
<dd><div class="line-block">
<div class="line"><span class="summaryline">Font render to text origin mode</span></div>
<div class="line"><span class="signature">vertical -&gt; bool</span></div>
</div>
<p>If set True, then when rendering to an existing surface, the position
is taken to be that of the text origin. Otherwise the render position is
the top-left corner of the text bounding box.</p>
</dd></dl>

<dl class="definition attribute">
<dt class="title" id="pygame.freetype.Font.pad">
<tt class="descname">pad</tt><a class="headerlink" href="#pygame.freetype.Font.pad" title="Permalink to this definition"></a></dt>
<dd><div class="line-block">
<div class="line"><span class="summaryline">padded boundary mode</span></div>
<div class="line"><span class="signature">pad -&gt; bool</span></div>
</div>
<p>If set True, then the text boundary rectangle will be inflated to match
that of font.Font. Otherwise, the boundary rectangle is just large
enough for the text.</p>
</dd></dl>

<dl class="definition attribute">
<dt class="title" id="pygame.freetype.Font.ucs4">
<tt class="descname">ucs4</tt><a class="headerlink" href="#pygame.freetype.Font.ucs4" title="Permalink to this definition"></a></dt>
<dd><div class="line-block">
<div class="line"><span class="summaryline">Enable UCS-4 mode</span></div>
<div class="line"><span class="signature">ucs4 &lt;-&gt; bool</span></div>
</div>
<p>Gets or sets the decoding of Unicode text. By default, the
freetype module performs UTF-16 surrogate pair decoding on Unicode text.
This allows 32-bit escape sequences (&#8216;Uxxxxxxxx&#8217;) between 0x10000 and
0x10FFFF to represent their corresponding UTF-32 code points on Python
interpreters built with a UCS-2 unicode type (on Windows, for instance).
It also means character values within the UTF-16 surrogate area (0xD800
to 0xDFFF) are considered part of a surrogate pair. A malformed surrogate
pair will raise an UnicodeEncodeError. Setting ucs4 True turns surrogate
pair decoding off, letting interpreters with a UCS-4 unicode type access
the full UCS-4 character range.</p>
</dd></dl>

<dl class="definition attribute">
<dt class="title" id="pygame.freetype.Font.resolution">
<tt class="descname">resolution</tt><a class="headerlink" href="#pygame.freetype.Font.resolution" title="Permalink to this definition"></a></dt>
<dd><div class="line-block">
<div class="line"><span class="summaryline">Pixel resolution in dots per inch</span></div>
<div class="line"><span class="signature">resolution -&gt; int</span></div>
</div>
<p>Gets the pixel size used in scaling font glyphs for this Font instance.</p>
</dd></dl>

</dd></dl>

</dd></dl>

</div>

  </div>
          </div>
      </div>
      <div class="clearer"></div>
    </div>
    <div class="related">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="../genindex.html" title="General Index"
             accesskey="I">index</a></li>
        <li class="right" >
          <a href="gfxdraw.html" title="pygame.gfxdraw"
             accesskey="N">next</a> |</li>
        <li class="right" >
          <a href="font.html" title="pygame.font"
             accesskey="P">previous</a> |</li>
        <li><a href="../index.html">Pygame v1.9.2 documentation</a> &raquo;</li>
    <script type="text/javascript" src="jquery.plugin.docscomments.js"></script>

      </ul>
    </div>
    <div class="footer">
        &copy; Copyright 2011, Pygame Developers.
    </div>
  </body>
</html>