Git Product home page Git Product logo

gensty's Introduction

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 [email protected]: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.

gensty's People

Contributors

snyk-bot avatar tsotsos avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

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