| 1 |
.. _text: |
| 2 |
|
| 3 |
**** |
| 4 |
Text |
| 5 |
**** |
| 6 |
|
| 7 |
.. currentmodule:: cairo |
| 8 |
|
| 9 |
Cairo has two sets of text rendering capabilities: |
| 10 |
|
| 11 |
* The functions with text in their name form cairo's toy text API. The toy API |
| 12 |
takes UTF-8 encoded text and is limited in its functionality to rendering |
| 13 |
simple left-to-right text with no advanced features. That means for example |
| 14 |
that most complex scripts like Hebrew, Arabic, and Indic scripts are out of |
| 15 |
question. No kerning or correct positioning of diacritical marks either. The |
| 16 |
font selection is pretty limited too and doesn't handle the case that the |
| 17 |
selected font does not cover the characters in the text. This set of |
| 18 |
functions are really that, a toy text API, for testing and demonstration |
| 19 |
purposes. Any serious application should avoid them. |
| 20 |
|
| 21 |
* The functions with glyphs in their name form cairo's low-level text API. The |
| 22 |
low-level API relies on the user to convert text to a set of glyph indexes |
| 23 |
and positions. This is a very hard problem and is best handled by external |
| 24 |
libraries, like the pangocairo that is part of the Pango text layout and |
| 25 |
rendering library. Pango is available from http://www.pango.org/. |
| 26 |
|
| 27 |
|
| 28 |
class FontFace() |
| 29 |
================ |
| 30 |
|
| 31 |
.. autoclass:: FontFace |
| 32 |
:members: |
| 33 |
:undoc-members: |
| 34 |
|
| 35 |
|
| 36 |
class FreeTypeFontFace(:class:`FontFace`) |
| 37 |
========================================= |
| 38 |
|
| 39 |
FreeType Fonts - Font support for FreeType. |
| 40 |
|
| 41 |
The FreeType font backend is primarily used to render text on GNU/Linux |
| 42 |
systems, but can be used on other platforms too. |
| 43 |
|
| 44 |
.. note:: FreeType Fonts are not implemented in pycairo because there is no open source Python bindings to FreeType (and fontconfig) that provides a C API. This a possible project idea for anyone interested in adding FreeType support to pycairo. |
| 45 |
|
| 46 |
|
| 47 |
class ToyFontFace(:class:`FontFace`) |
| 48 |
==================================== |
| 49 |
|
| 50 |
.. autoclass:: ToyFontFace |
| 51 |
:members: |
| 52 |
:undoc-members: |
| 53 |
|
| 54 |
.. automethod:: __init__ |
| 55 |
|
| 56 |
class UserFontFace(:class:`FontFace`) |
| 57 |
===================================== |
| 58 |
|
| 59 |
The user-font feature allows the cairo user to provide drawings for glyphs in |
| 60 |
a font. This is most useful in implementing fonts in non-standard formats, |
| 61 |
like SVG fonts and Flash fonts, but can also be used by games and other |
| 62 |
application to draw "funky" fonts. |
| 63 |
|
| 64 |
.. note:: UserFontFace support has not (yet) been added to pycairo. If you |
| 65 |
need this feature in pycairo register your interest by sending a message |
| 66 |
to the cairo mailing list, or by opening a pycairo bug report. |
| 67 |
|
| 68 |
|
| 69 |
class ScaledFont() |
| 70 |
================== |
| 71 |
|
| 72 |
.. autoclass:: ScaledFont |
| 73 |
:members: |
| 74 |
:undoc-members: |
| 75 |
|
| 76 |
.. automethod:: __init__ |
| 77 |
|
| 78 |
|
| 79 |
class FontOptions() |
| 80 |
=================== |
| 81 |
|
| 82 |
.. autoclass:: FontOptions |
| 83 |
:members: |
| 84 |
:undoc-members: |
| 85 |
|
| 86 |
.. automethod:: __init__ |