Skip to main content

LaTex style generator for ttf/otf fonts. Supports Smufl.

Project description

genSty

GitHub release (latest by date including pre-releases) PyPI - Status PyPI version PyPI - Python Version License

GenSty is a LaTex style package generator for OpenType fonts (otf/ttf) which supports W3C SMuFL notation. With gensty you can generate your LaTeX package based on any OpenType font; the generator parses ttf/otf files and creates LaTeX commands for all Unicode Symbols. In the case of SMuFL fonts, you can also include the glyphnames.json file, so it will create friendlier names and include "Private Use" symbols.

Installation

Use the package manager pip to install foobar.

pip install gensty

Installation (manual)

Clone the repository

git clone git@github.com:tsotsos/genSty.git

and then use from the top folder. Eg.

python3 -m gensty -h

Usage

As referred above, the package can be used directly, installed from pip, and as a module. In case of command line the script can be used :

gensty -h

usage: genSty [-h] [--version] [--all] [--smufl SMUFL]
              [--one-package ONE_PACKAGE] [--author AUTHOR] [--ver VER]
              path

LaTeX Style file generator for fonts

positional arguments:
  path                  Font(s) path. It can be either a directory in case of
                        multiple fonts or file path.

optional arguments:
  -h, --help            show this help message and exit
  --version, -v         show program's version number and exit
  --all, -a             If choosed genSty will generate LaTeX Styles for all
                        fonts in directory
  --smufl SMUFL, -s SMUFL
                        If choosed genSty will generate LaTeX Styles for all
                        fonts in directory based on glyphnames provided.
  --one-package ONE_PACKAGE
                        Creates one package with name provided by this
                        argument.
  --author AUTHOR       Author's name.
  --ver VER             LaTeX package version.

Use as a module

Use the module to create LaTeXstyle instances and handle generated latex code yourself.

import gensty

# Generate LaTeXstyle instance from font file:

latexObj = font.LaTeXstyle(author,version, "path/to/font.otf",smufl)

# then you can get for latexObj,Header(), DefCommands(), Commands() or File()

Use them module to create the LaTeX package in filesystem.

import gensty

# Use the same functions as gensty CLI and handle both folder or font file
# input (path can be either font file or folder including fonts).
# Then using savePackage you can save the generated output to disk
# accorndingly.
# smufl is the path to glyphnames.json which is defined according to W3C
# Specifications https://www.w3.org/2019/03/smufl13/specification/glyphnames.html

# prepare fonts. author, version and smuf, can be None.
fonts = prepareFonts(path, version, author, smufl)

# packageName and forcedCommand can be None. They are used to force LaTeX
# pacakage name and commands respectively.
fontnames, fontfiles, files = makePackage(fonts, packageName, forcedCommand)

# creates font package in file system.
savePackage(fontnames, fontfiles, files, packageName)

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

gensty-0.3.1.tar.gz (11.6 kB view details)

Uploaded Source

Built Distribution

gensty-0.3.1-py3-none-any.whl (18.1 kB view details)

Uploaded Python 3

File details

Details for the file gensty-0.3.1.tar.gz.

File metadata

  • Download URL: gensty-0.3.1.tar.gz
  • Upload date:
  • Size: 11.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.23.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.5

File hashes

Hashes for gensty-0.3.1.tar.gz
Algorithm Hash digest
SHA256 0cad000826fd5aed492f78a63cc359e51a0b4c9b33817cd50b978cac9b72f91c
MD5 d677350a46252991c292cfd85000bafb
BLAKE2b-256 1fbb6ed1ea19883158bbc7a691acb23fdc6213dd5d72aa9e422ef92dcab376bd

See more details on using hashes here.

File details

Details for the file gensty-0.3.1-py3-none-any.whl.

File metadata

  • Download URL: gensty-0.3.1-py3-none-any.whl
  • Upload date:
  • Size: 18.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.23.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.5

File hashes

Hashes for gensty-0.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 2dcfab0dbac932b8d0370e227eaa49afff58300a787734bf4f17d54fe1aa314f
MD5 8262d3aec1e872379857b8450167f264
BLAKE2b-256 8480bbc452576f1ec1d58a5d4fcca07b8ebafcead4e83a918011451dd86602d2

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page