Code Monkey home page Code Monkey logo

pyfontaine's Introduction

pyfontaine

pyfontaine analyses fonts for their language and character set support.

It has a straightforward pythonic character set definition format (simple example, medium example, complex example)

To add new definitions, just add files to the internals directory - they are autodetected!

It also downloads additional definitions from the Extensis, font-config and Unicode websites.

Installation

On Mac OS X, install the pyicu dependency as follows:

CFLAGS=-I/usr/local/opt/icu4c/include LDFLAGS=-L/usr/local/opt/icu4c/lib pip install pyicu;

Install the latest release easily with the pip installer:

sudo pip install fontaine

To install the latest development version:

git clone https://github.com/davelab6/pyfontaine.git;
cd pyfontaine;
sudo python setup.py install;

Usage

Given a font, it returns a report with some general metadata and th language support analysis:

sh pyfontaine font.ttf;

Given a unicode character value, it returns a list of character sets that include that character.:

pyfontaine 0x0061;

To output font reports in various formats:

pyfontaine --xml font.ttf;
pyfontaine --json font.ttf;
pyfontaine --csv font.ttf;
pyfontaine --wiki font.ttf;

The --wiki format produces a MediaWiki table (example <https://en.wikipedia.org/wiki/DejaVu_fonts#Unicode_coverage>__)

To only show character sets from different collections:

pyfontaine --collections all font.ttf; # default
pyfontaine --collections pyfontaine font.ttf;
pyfontaine --collections uniblocks font.ttf;
pyfontaine --collections extensis font.ttf;
pyfontaine --collections fontconfig font.ttf;
pyfontaine --collections cldr font.ttf;
pyfontaine --collections subsets font.ttf;

To only show specific character sets:

pyfontaine --set African,'Basic Latin','GWF vietnamese' font.ttf;

To print a list of all the missing unicode values from each set:

pyfontaine --missing font.ttf;

To output visualisations of the coverage using Hilbert curves (thanks for the idea, Øyvind 'pippin' Kolås!): sh pyfontaine --coverage font.ttf; ls -l coverage_pngs/; (The PNG files are stored in a new directory, coverage_pngs, under the current directory.)

Update collection data

You can update all related text and xml data for collections in realtime with argument --update-data. Note. --update-data requires internet connections.

python --update-data font.ttf

Python Module

It has a python module. Here is an example script from the Font Bakery project.

Contributing

Your contributions under the GPLv3 are welcome!

pyfontaine is a python reimplementation of Fontaine by Ed Trager, and has been made by by Vitaly Volkov, Dave Crossland and Mikhail Kashkin.

Thanks

We would like to thank some upstream projects that make pyfontaine even more useful: * Thomas Phinney for the WebINK Character Sets * Behdad Esfabod for the font-config languages definitions * Unicode Consortium for the Unicode Blocks

Dependencies

Related Projects

pyfontaine's People

Contributors

andriyko avatar davelab6 avatar vitalyvolkov avatar xen avatar

Watchers

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