Code Monkey home page Code Monkey logo

fontbakery's Introduction

CI Build Status Coverage Status PyPI Join the chat at https://gitter.im/fonttools-dev/Lobby

What is this?

fontTools is a library for manipulating fonts, written in Python. The project includes the TTX tool, that can convert TrueType and OpenType fonts to and from an XML text format, which is also called TTX. It supports TrueType, OpenType, AFM and to an extent Type 1 and some Mac-specific formats. The project has an MIT open-source licence.
Among other things this means you can use it free of charge.

User documentation and developer documentation are available at Read the Docs.

Installation

FontTools requires Python 3.8 or later. We try to follow the same schedule of minimum Python version support as NumPy (see NEP 29).

The package is listed in the Python Package Index (PyPI), so you can install it with pip:

pip install fonttools

If you would like to contribute to its development, you can clone the repository from GitHub, install the package in 'editable' mode and modify the source code in place. We recommend creating a virtual environment, using virtualenv or Python 3 venv module.

# download the source code to 'fonttools' folder
git clone https://github.com/fonttools/fonttools.git
cd fonttools

# create new virtual environment called e.g. 'fonttools-venv', or anything you like
python -m virtualenv fonttools-venv

# source the `activate` shell script to enter the environment (Unix-like); to exit, just type `deactivate`
. fonttools-venv/bin/activate

# to activate the virtual environment in Windows `cmd.exe`, do
fonttools-venv\Scripts\activate.bat

# install in 'editable' mode
pip install -e .

Optional Requirements

The fontTools package currently has no (required) external dependencies besides the modules included in the Python Standard Library. However, a few extra dependencies are required by some of its modules, which are needed to unlock optional features. The fonttools PyPI distribution also supports so-called "extras", i.e. a set of keywords that describe a group of additional dependencies, which can be used when installing via pip, or when specifying a requirement. For example:

pip install fonttools[ufo,lxml,woff,unicode]

This command will install fonttools, as well as the optional dependencies that are required to unlock the extra features named "ufo", etc.

  • Lib/fontTools/misc/etree.py

    The module exports a ElementTree-like API for reading/writing XML files, and allows to use as the backend either the built-in xml.etree module or lxml. The latter is preferred whenever present, as it is generally faster and more secure.

    Extra: lxml

  • Lib/fontTools/ufoLib

    Package for reading and writing UFO source files; it requires:

    • fs: (aka pyfilesystem2) filesystem abstraction layer.
    • enum34: backport for the built-in enum module (only required on Python < 3.4).

    Extra: ufo

  • Lib/fontTools/ttLib/woff2.py

    Module to compress/decompress WOFF 2.0 web fonts; it requires:

    • brotli: Python bindings of the Brotli compression library.

    Extra: woff

  • Lib/fontTools/ttLib/sfnt.py

    To better compress WOFF 1.0 web fonts, the following module can be used instead of the built-in zlib library:

    • zopfli: Python bindings of the Zopfli compression library.

    Extra: woff

  • Lib/fontTools/unicode.py

    To display the Unicode character names when dumping the cmap table with ttx we use the unicodedata module in the Standard Library. The version included in there varies between different Python versions. To use the latest available data, you can install:

    • unicodedata2: unicodedata backport for Python 3.x updated to the latest Unicode version 15.0.

    Extra: unicode

  • Lib/fontTools/varLib/interpolatable.py

    Module for finding wrong contour/component order between different masters. It requires one of the following packages in order to solve the so-called "minimum weight perfect matching problem in bipartite graphs", or the Assignment problem:

    • scipy: the Scientific Library for Python, which internally uses NumPy arrays and hence is very fast;
    • munkres: a pure-Python module that implements the Hungarian or Kuhn-Munkres algorithm.

    To plot the results to a PDF or HTML format, you also need to install:

    • pycairo: Python bindings for the Cairo graphics library. Note that wheels are currently only available for Windows, for other platforms see pycairo's installation instructions.

    Extra: interpolatable

  • Lib/fontTools/varLib/plot.py

    Module for visualizing DesignSpaceDocument and resulting VariationModel.

    Extra: plot

  • Lib/fontTools/misc/symfont.py

    Advanced module for symbolic font statistics analysis; it requires:

    • sympy: the Python library for symbolic mathematics.

    Extra: symfont

  • Lib/fontTools/t1Lib.py

    To get the file creator and type of Macintosh PostScript Type 1 fonts on Python 3 you need to install the following module, as the old MacOS module is no longer included in Mac Python:

    • xattr: Python wrapper for extended filesystem attributes (macOS platform only).

    Extra: type1

  • Lib/fontTools/ttLib/removeOverlaps.py

    Simplify TrueType glyphs by merging overlapping contours and components.

    • skia-pathops: Python bindings for the Skia library's PathOps module, performing boolean operations on paths (union, intersection, etc.).

    Extra: pathops

  • Lib/fontTools/pens/cocoaPen.py and Lib/fontTools/pens/quartzPen.py

    Pens for drawing glyphs with Cocoa NSBezierPath or CGPath require:

    • PyObjC: the bridge between Python and the Objective-C runtime (macOS platform only).
  • Lib/fontTools/pens/qtPen.py

    Pen for drawing glyphs with Qt's QPainterPath, requires:

    • PyQt5: Python bindings for the Qt cross platform UI and application toolkit.
  • Lib/fontTools/pens/reportLabPen.py

    Pen to drawing glyphs as PNG images, requires:

    • reportlab: Python toolkit for generating PDFs and graphics.
  • Lib/fontTools/pens/freetypePen.py

    Pen to drawing glyphs with FreeType as raster images, requires:

    • freetype-py: Python binding for the FreeType library.
  • Lib/fontTools/ttLib/tables/otBase.py

    Use the Harfbuzz library to serialize GPOS/GSUB using hb_repack method, requires:

    • uharfbuzz: Streamlined Cython bindings for the harfbuzz shaping engine

    Extra: repacker

How to make a new release

  1. Update NEWS.rst with all the changes since the last release. Write a changelog entry for each PR, with one or two short sentences summarizing it, as well as links to the PR and relevant issues addressed by the PR. Do not put a new title, the next command will do it for you.
  2. Use semantic versioning to decide whether the new release will be a 'major', 'minor' or 'patch' release. It's usually one of the latter two, depending on whether new backward compatible APIs were added, or simply some bugs were fixed.
  3. Run python setup.py release command from the tip of the main branch. By default this bumps the third or 'patch' digit only, unless you pass --major or --minor to bump respectively the first or second digit. This bumps the package version string, extracts the changes since the latest version from NEWS.rst, and uses that text to create an annotated git tag (or a signed git tag if you pass the --sign option and your git and Github account are configured for signing commits using a GPG key). It also commits an additional version bump which opens the main branch for the subsequent developmental cycle
  4. Push both the tag and commit to the upstream repository, by running the command git push --follow-tags. Note: it may push other local tags as well, be careful.
  5. Let the CI build the wheel and source distribution packages and verify both get uploaded to the Python Package Index (PyPI).
  6. [Optional] Go to fonttools Github Releases page and create a new release, copy-pasting the content of the git tag message. This way, the release notes are nicely formatted as markdown, and users watching the repo will get an email notification. One day we shall automate that too.

Acknowledgements

In alphabetical order:

aschmitz, Olivier Berten, Samyak Bhuta, Erik van Blokland, Petr van Blokland, Jelle Bosma, Sascha Brawer, Tom Byrer, Antonio Cavedoni, Frédéric Coiffier, Vincent Connare, David Corbett, Simon Cozens, Dave Crossland, Simon Daniels, Peter Dekkers, Behdad Esfahbod, Behnam Esfahbod, Hannes Famira, Sam Fishman, Matt Fontaine, Takaaki Fuji, Rob Hagemans, Yannis Haralambous, Greg Hitchcock, Jeremie Hornus, Khaled Hosny, John Hudson, Denis Moyogo Jacquerye, Jack Jansen, Tom Kacvinsky, Jens Kutilek, Antoine Leca, Werner Lemberg, Tal Leming, Peter Lofting, Cosimo Lupo, Olli Meier, Masaya Nakamura, Dave Opstad, Laurence Penney, Roozbeh Pournader, Garret Rieger, Read Roberts, Colin Rofls, Guido van Rossum, Just van Rossum, Andreas Seidel, Georg Seifert, Chris Simpkins, Miguel Sousa, Adam Twardoch, Adrien Tétar, Vitaly Volkov, Paul Wise.

Copyrights

Copyright (c) 1999-2004 Just van Rossum, LettError ([email protected])
See LICENSE for the full license.

Copyright (c) 2000 BeOpen.com. All Rights Reserved.

Copyright (c) 1995-2001 Corporation for National Research Initiatives. All Rights Reserved.

Copyright (c) 1991-1995 Stichting Mathematisch Centrum, Amsterdam. All Rights Reserved.

Have fun!

fontbakery's People

Contributors

adrientetar avatar andriyko avatar aurium avatar bramstein avatar chrissimpkins avatar cjchapman avatar davelab6 avatar drj11 avatar eliheuer avatar eniallator avatar felipesanches avatar graphicore avatar guidoferreyra avatar hugovk avatar jenskutilek avatar josh-hadley avatar kaydeearts avatar khaledhosny avatar m4rc1e avatar madig avatar miguelsousa avatar moyogo avatar ollimeier avatar rosawagner avatar simoncozens avatar thundernixon avatar vitalyvolkov avatar vv-monsalve avatar xen avatar yanone avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

fontbakery's Issues

OAuth

Github login and API methods access.

Add 'About' page that contains ALL copyright notices and libre license texts

All fontbakery dependencies should be noted in an About page, accessible from the footer.

Each dependency should have its license text and copyright notice.

This information can be added to the page by parsing the requirements.txt file, so it doesn't have to be maintained by hand.

This should also parse the AUTHORS.txt file and place the list of Font Bakery authors at the top of the page.

Templates

Templates list.

Main template:

  • - main template
  • - header
  • - footer

Splash page:

  • - splash page (last project state)
  • - last 10 build projects (left sidebar)
  • - last project report

Auxiliary pages:

  • - about
  • - contacts
  • - more?

Search:

  • - project name search autocomplete (for search widget)

Project page:

  • - Current build report
  • - Build history
  • - Files downloads
  • - badge code?
  • - more?

Error pages:

  • - 404
  • - 500

Auth:

  • login error

Personal:

  • - Project list
  • - setup instructions
  • - user projects list
  • - my repositories

Email:

  • Email template
  • Project build resul
  • Project download/other error

Settings:

  • Add/remove projects to site
  • refresh projects list

Documentation in different task #13

Improve the way subsets are made

Modify the build script to replace subset.py with pyftsubset

  • add all the unicodes-*txt lists to pyfontaine and make a new release
  • make pyfontaine's new release a dependency of fontbakery
  • change https://github.com/googlefonts/fontbakery/blob/master/bakery/tasks.py#L432 so that instead of using the old subset.py we use pyftsubset - use this shell script as a guide
  • use pyfontaine in upstream test suite to check each original UFO or TTX font has 100% of the chars in all of the selected subsets (those in unicodes-*txt lists). The tests are not blocker tests required to pass but are important
  • use pyfontaine in result test suite to confirm each subset has 100% of the chars that it should; again, not a blocker but are important
  • change the setup page to show the subset selection as a table, showing the subset in col 1, the percentage of the subset that is complete in col 2, and a checkbox if the subset should be made and copied to the .out directory in col 3

Splash page changes

Blocks:

  • recent build
  • list of all avialable project from logged in user on the site (table with states)

Change license to Apache v2.0

This issue is formal public act of asking permissions from all contributors to change permission to Apache Public License from wrongly declared GPL. There is only 2 contibutors at this moment:

@xen
@davelab6

I think it is enough to ask code authors to agree with this changes.

Settings page

Add/remove projects to site and webhooks registration

Git fetcher

Fetch project and try to get special file and check if it ok.

Error on adding a project

I tried to add a git repo from 'Mass github add repositories' tab and when I clicked the star icon I got this error:

/bin/sh: line 0: cd: /Users/dcrossland/src/bakery-xen/data: No such file or directory
2013-05-09 05:23:36 [15210] [ERROR] Error handling request
Traceback (most recent call last):
  File "/Library/Python/2.7/site-packages/gunicorn/workers/sync.py", line 126, in handle_request
    respiter = self.wsgi(environ, resp.start_response)
  File "/Library/Python/2.7/site-packages/flask/app.py", line 1701, in __call__
    return self.wsgi_app(environ, start_response)
  File "/Library/Python/2.7/site-packages/flask/app.py", line 1689, in wsgi_app
    response = self.make_response(self.handle_exception(e))
  File "/Library/Python/2.7/site-packages/flask/app.py", line 1687, in wsgi_app
    response = self.full_dispatch_request()
  File "/Library/Python/2.7/site-packages/flask/app.py", line 1360, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/Library/Python/2.7/site-packages/flask/app.py", line 1358, in full_dispatch_request
    rv = self.dispatch_request()
  File "/Library/Python/2.7/site-packages/flask/app.py", line 1344, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "/Users/dcrossland/src/bakery-xen/bakery/settings/views.py", line 138, in addhook
    git_clone(login = g.user.login, project_id = project.id, clone = project.clone)
  File "/Library/Python/2.7/site-packages/celery/local.py", line 240, in <lambda>
    __call__ = lambda x, *a, **kw: x._get_current_object()(*a, **kw)
  File "/Library/Python/2.7/site-packages/celery/app/task.py", line 330, in __call__
    return self.run(*args, **kwargs)
  File "/Users/dcrossland/src/bakery-xen/bakery/tasks.py", line 21, in git_clone
    subprocess.call(CLONE_PREPARE_SH % params, shell=True, cwd=WORK_DATA_ROOT)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 493, in call
    return Popen(*popenargs, **kwargs).wait()
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 679, in __init__
    errread, errwrite)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 1228, in _execute_child
    raise child_exception
OSError: [Errno 2] No such file or directory: '/Users/dcrossland/src/bakery-xen/data'
2013-05-09 05:23:36 [15211] [ERROR] Error handling request
Traceback (most recent call last):
  File "/Library/Python/2.7/site-packages/gunicorn/workers/sync.py", line 126, in handle_request
    respiter = self.wsgi(environ, resp.start_response)
  File "/Library/Python/2.7/site-packages/flask/app.py", line 1701, in __call__
    return self.wsgi_app(environ, start_response)
  File "/Library/Python/2.7/site-packages/flask/app.py", line 1689, in wsgi_app
    response = self.make_response(self.handle_exception(e))
  File "/Library/Python/2.7/site-packages/flask/app.py", line 1687, in wsgi_app
    response = self.full_dispatch_request()
  File "/Library/Python/2.7/site-packages/flask/app.py", line 1360, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/Library/Python/2.7/site-packages/flask/app.py", line 1253, in handle_user_exception
    return self.handle_http_exception(e)
  File "/Library/Python/2.7/site-packages/flask/app.py", line 1213, in handle_http_exception
    return handler(e)
  File "/Users/dcrossland/src/bakery-xen/bakery/app.py", line 58, in page_not_found
    return render_template("misc/404.html"), 404
  File "/Library/Python/2.7/site-packages/flask/templating.py", line 125, in render_template
    context, ctx.app)
  File "/Library/Python/2.7/site-packages/flask/templating.py", line 107, in _render
    rv = template.render(context)
  File "/Library/Python/2.7/site-packages/jinja2/environment.py", line 894, in render
    return self.environment.handle_exception(exc_info, True)
  File "/Users/dcrossland/src/bakery-xen/bakery/templates/misc/404.html", line 1, in top-level template code
    {% extends "pages/base.html" %}
  File "/Library/Python/2.7/site-packages/flask/templating.py", line 61, in get_source
    raise TemplateNotFound(template)
TemplateNotFound: pages/base.html
2013-05-09 05:23:41 [15207] [INFO] Handling signal: winch
2013-05-09 05:23:41 [15207] [INFO] SIGWINCH ignored. Not daemonized
2013-05-09 05:23:41 [15207] [INFO] Handling signal: winch
2013-05-09 05:23:41 [15207] [INFO] SIGWINCH ignored. Not daemonized
2013-05-09 05:23:41 [15207] [INFO] Handling signal: winch

Repository summary page

Should contains:

  • Title
  • Git address
  • Dialog to select License file (probably .txt files in the list)
  • Dialog to select ufo folders (only filter folders that have .ufo extension)
  • Confirm button
  • ask permission for using font name or rename. If rename user should provide name for each folder.

If user select to rename then font folders and fontinfo.plist need to be updated according provided information during copy proccess.

Add edit METADATA.json to setup

And allow to edit this file if it exsits. Also after bump genmetadata.py generate new file METADATA.json.new if it is exsits then allow to edit 2 side pannel mode and ask to delete new file when user is done.

Few example font repositories

I need links for several github (or hosted elsewhere but able to pull into github) repositories for test. I'll do clone and other stuff by myself.

Project selection and config

Travis require special .travis.yml files. We can probably use something similar. Parameters:

  • path to UFO folders
  • build options

Add copyright info into project files

  • Add to EVERY bakery code file this text:
Copyright 2013 The Font Bakery Authors. All Rights Reserved.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

See AUTHORS.txt for the list of Authors and LICENSE.txt for the License.
  • Add a unit test for the codebase that checks that this text is present in every file

Webhook api endpoint

Method that should be registered as webhook into github project settings.

Also need test script that will invoke call for testing.

Documentation pages

Pages that should be in user documentation:

  • About
  • Tutorial
  • Current build options
  • Configuration file format description?

Settings page with checkboxes

List of Github repositories and dialod to check every repository user want to select (with checkbox) and add button with modal dialog confirmation to allow to use repository.

Add `make clean`

Add a make clean command that will wipe the data directory and database so the system is 'reset' to try out new developments

Add numpy as a requirement

The fonttools package depends on numpy:

Downloading/unpacking fonttools2 (from -r requirements.txt (line 17))
  Downloading fonttools2-2.3.tar.gz (323kB): 323kB downloaded
  Running setup.py egg_info for package fonttools2
    /usr/local/Cellar/python/2.7.5/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/dist.py:267: UserWarning: Unknown distribution option: 'console'
      warnings.warn(msg)
    WARNING: '' not a valid package name; please use only.-separated package names in setup.py
    *** Warning: FontTools needs the numpy library, see:
            http://numpy.scipy.org/

    warning: no files found matching 'Doc/ChangeLog'

Email notifications

Each project should have a state attribute to email the user after each run, and the UI should have a place to check/uncheck this attribute

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.