Skip to content

Commit

Permalink
Merge remote-tracking branch 'vayn/master'
Browse files Browse the repository at this point in the history
Conflicts:
	fontconfig.c
  • Loading branch information
lilydjwg committed Mar 20, 2012
2 parents 89474b3 + ae1f142 commit e419c30
Show file tree
Hide file tree
Showing 9 changed files with 359 additions and 278 deletions.
11 changes: 11 additions & 0 deletions CHANGES.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
v0.1.0, October 24, 2011 -- Initial commit

v0.2.0, October 28, 2011

v0.3.0, October 30, 2011

v0.4.0, October 30, 2011

v0.5.0, November 1, 2011

v0.5.1, November 10, 2011 -- Add tests
File renamed without changes.
12 changes: 12 additions & 0 deletions MANIFEST
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# file GENERATED by distutils, do NOT edit
CHANGES.txt
LICENSE.txt
README.rst
cfontconfig.pxd
factory.pxi
fcmore.h
fontconfig.c
fontconfig.pxi
fontconfig.pyx
setup.py
test/test.py
6 changes: 6 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
include *.txt
include *.rst
include *.pyx
include *.pxd
include *.pxi
include *.h
91 changes: 76 additions & 15 deletions README.rst
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
-----------------
=================
Python-fontconfig
-----------------
=================

Python bindings for Fontconfig_ library


Requirement
==========
-----------

- Fontconfig_ **Required**
- Cython_ (if you want to regenerate C source)
Expand All @@ -15,33 +15,94 @@ Requirement
.. _Fontconfig: http://www.freedesktop.org/wiki/Software/fontconfig

Tested on
_________
~~~~~~~~~

- ``Python 2.7.2`` (64-bit)
- ``Python 3.2.2`` (64-bit)
- ``Python 2.7.2`` (32-bit, 64-bit)
- ``Python 3.2.2`` (32-bit, 64-bit)


Installation
============
------------

From PyPI::

>>> pip install Python-fontconfig

or

>>> git clone git://github.com/Vayn/python-fontconfig.git
>>> cd python-fontconfig/
>>> python setup.py install
>>> easy_install Python-fontconfig

From GitHub::

>>> git clone git://github.com/Vayn/python-fontconfig.git
>>> cd python-fontconfig/
>>> python setup.py install


Building C source
=================
-----------------

>>> python setup.py build_ext -i


TODO
====
Testing
-------

>>> cd test/
>>> python test.py


Usage
-----

>>> import fontconfig

>>> fonts = fontconfig.query(family='ubuntu', lang='en')

>>> fonts
['/usr/share/fonts/truetype/ubuntu-font-family/Ubuntu-BI.ttf',
'/usr/share/fonts/truetype/ubuntu-font-family/Ubuntu-L.ttf',
'/usr/share/fonts/truetype/ubuntu-font-family/Ubuntu-LI.ttf',
'/usr/share/fonts/truetype/ubuntu-font-family/Ubuntu-R.ttf',
'/usr/share/fonts/truetype/ubuntu-font-family/Ubuntu-B.ttf',
'/usr/share/fonts/truetype/ubuntu-font-family/Ubuntu-RI.ttf']

>>> font = fonts[0]

>>> font
<FcFont: Ubuntu>

>>> font.
font.capability font.fullname font.slant
font.count_chars font.get_languages font.spacing
font.decorative font.has_char font.style
font.family font.index font.weight
font.file font.outline font.width
font.fontformat font.print_pattern
font.foundry font.scalable

>>> font.family
[('en', 'Ubuntu')]

>>> font.foundry
'unknown'

>>> font.fontformat
'TrueType'

>>> font.has_char('A')
True

>>> font.file
'/usr/share/fonts/truetype/ubuntu-font-family/Ubuntu-BI.ttf'

>>> font = fontconfig.FcFont(font.file)

- Usage doc
>>> font.family
[('en', 'Ubuntu')]


License
=======
-------

This program is released under ``GPLv3`` license, see ``LICENSE`` for more detail.
Loading

0 comments on commit e419c30

Please sign in to comment.