Coder Social home page Coder Social logo

inactivist / python-fontconfig Goto Github PK

View Code? Open in Web Editor NEW

This project forked from vayn/python-fontconfig

0.0 0.0 0.0 371 KB

Python binding for Fontconfig

Home Page: http://git.io/fc

License: GNU General Public License v3.0

Python 5.19% C 94.81%

python-fontconfig's Introduction

Python-fontconfig

Python bindings for Fontconfig library

Requirement

Tested on

  • Python 2.7.2 (32-bit, 64-bit)
  • Python 3.2.2 (32-bit, 64-bit)
  • Python 3.3.2 (64-bit)

Installation

From PyPI:

>>> pip install Python-fontconfig

or

>>> 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

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 = fontconfig.FcFont(fonts[0])

>>> font <FcFont: Ubuntu>

>>> font. font.bestname 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.bestname {'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'

>>> fontconfig.fromName('Ubuntu') <FcFont: Ubuntu>

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

>>> font.family {'en': 'Ubuntu'}

License

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

python-fontconfig's People

Contributors

vayn avatar lilydjwg avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.