pax_global_header00006660000000000000000000000064146564132760014530gustar00rootroot0000000000000052 comment=f768cbb98fd336485fe8abe8a8b534e848bb981c vharfbuzz-0.3.1/000077500000000000000000000000001465641327600135525ustar00rootroot00000000000000vharfbuzz-0.3.1/.github/000077500000000000000000000000001465641327600151125ustar00rootroot00000000000000vharfbuzz-0.3.1/.github/workflows/000077500000000000000000000000001465641327600171475ustar00rootroot00000000000000vharfbuzz-0.3.1/.github/workflows/ci.yml000066400000000000000000000050041465641327600202640ustar00rootroot00000000000000on: push: tags: - "v*" # Push events to matching `v*` version srings. e.g. v1.0, v20.15.10 name: Create and Publish Release jobs: build: name: Build distribution runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 with: submodules: recursive fetch-depth: 0 - name: Set up Python uses: actions/setup-python@v5 with: python-version: '3.x' - name: Install release dependencies run: | python -m pip install --upgrade pip pip install --upgrade setuptools wheel build - name: Get release notes id: release_notes run: | # By default, GH Actions checkout will only fetch a single commit. # For us to extract the release notes, we need to fetch the tags # and tag annotations as well. # https://github.com/actions/checkout/issues/290 git fetch --tags --force TAG_NAME=${GITHUB_REF/refs\/tags\//} echo "$(git tag -l --format='%(contents)' $TAG_NAME)" > "${{ runner.temp }}/CHANGELOG.md" - name: Create GitHub release id: create_release uses: actions/create-release@v1 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: tag_name: ${{ github.ref }} release_name: ${{ github.ref }} body_path: "${{ runner.temp }}/CHANGELOG.md" draft: false prerelease: false - name: Build a binary wheel and a source tarball run: python3 -m build - name: Store the distribution packages uses: actions/upload-artifact@v4 with: name: python-package-distributions path: dist/ publish-to-pypi: name: >- Publish Python 🐍 distribution 📦 to PyPI if: startsWith(github.ref, 'refs/tags/') # only publish to PyPI on tag pushes needs: - build runs-on: ubuntu-latest environment: name: pypi url: https://pypi.org/p/vharfbuzz permissions: id-token: write # IMPORTANT: mandatory for trusted publishing steps: - name: Download all the dists uses: actions/download-artifact@v4 with: name: python-package-distributions path: dist/ - name: Publish distribution 📦 to PyPI uses: pypa/gh-action-pypi-publish@v1.8.14 with: # repository-url: https://test.pypi.org/legacy/ # for testing purposes verify-metadata: false # twine previously didn't verify metadata when uploading vharfbuzz-0.3.1/.github/workflows/test.yml000066400000000000000000000014131465641327600206500ustar00rootroot00000000000000name: Test on: push: branches: [main] pull_request: branches: [main] jobs: build: runs-on: ubuntu-latest strategy: fail-fast: false matrix: python-version: ["3.9", "3.10", "3.11"] steps: - uses: actions/checkout@v4 with: submodules: recursive fetch-depth: 0 - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} - name: Install packages run: | pip install '.' pip install '.[dev]' - name: lint run: | black . --check --diff --color # - name: Run Tests # run: | # pytest tests/*.py # shell: bash vharfbuzz-0.3.1/.readthedocs.yml000066400000000000000000000001271465641327600166400ustar00rootroot00000000000000version: 2 python: version: 3.7 install: - requirements: requirements.txt vharfbuzz-0.3.1/CHANGELOG.md000066400000000000000000000012361465641327600153650ustar00rootroot00000000000000Below are the most important changes from each release. A more detailed listing of changes is available in the closed issues of the Github issue tracker (https://github.com/simoncozens/vharfbuzz/issues) and in the git commit history. ## 0.1.3 (2022-May-20) - Replaced deprecated `draw_glyph()`. Now using `get_glyph_shape()` instead. (issue #4) ## 0.1.2 (2021-Jul-12) - Fixed a typo (https://github.com/simoncozens/vharfbuzz/commit/1665b992322163e77af296237084615490822f19) ## 0.1.1 (2021-Apr-09) - Allow choosing shaper (https://github.com/simoncozens/vharfbuzz/commit/ce74003ad07fb5bc1048f04f3ab56615d755f909) ## 0.1.0 (2021-Mar-18) - Initial release. vharfbuzz-0.3.1/LICENSE000066400000000000000000000020551465641327600145610ustar00rootroot00000000000000MIT License Copyright (c) 2021 Simon Cozens Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. vharfbuzz-0.3.1/Lib/000077500000000000000000000000001465641327600142605ustar00rootroot00000000000000vharfbuzz-0.3.1/Lib/vharfbuzz/000077500000000000000000000000001465641327600163015ustar00rootroot00000000000000vharfbuzz-0.3.1/Lib/vharfbuzz/__init__.py000066400000000000000000000270541465641327600204220ustar00rootroot00000000000000from __future__ import annotations __author__ = """Simon Cozens""" __email__ = "simon@simon-cozens.org" __version__ = "0.1.0" import uharfbuzz as hb import re class FakeBuffer: def __init__(self): pass class FakeItem: def __init__(self): pass class Vharfbuzz: """A user-friendlier way to use Harfbuzz in Python. Args: filename (str): A path to a TrueType font file. """ def __init__(self, filename): self.filename = filename self.shapers = None self._drawfuncs = None self._hbfont = None self._saved_variations = None self._palette = None @property def hbfont(self): if self._hbfont is None: blob = hb.Blob.from_file_path(self.filename) face = hb.Face(blob) self._hbfont = hb.Font(face) return self._hbfont @property def drawfuncs(self): if self._drawfuncs is None: def move_to(x, y, buffer_list): buffer_list.append(f"M{x},{y}") def line_to(x, y, buffer_list): buffer_list.append(f"L{x},{y}") def cubic_to(c1x, c1y, c2x, c2y, x, y, buffer_list): buffer_list.append(f"C{c1x},{c1y} {c2x},{c2y} {x},{y}") def quadratic_to(c1x, c1y, x, y, buffer_list): buffer_list.append(f"Q{c1x},{c1y} {x},{y}") def close_path(buffer_list): buffer_list.append("Z") self._drawfuncs = hb.DrawFuncs() self._drawfuncs.set_move_to_func(move_to) self._drawfuncs.set_line_to_func(line_to) self._drawfuncs.set_cubic_to_func(cubic_to) self._drawfuncs.set_quadratic_to_func(quadratic_to) self._drawfuncs.set_close_path_func(close_path) return self._drawfuncs @property def palette(self): if self._palette is None: if hasattr(hb, "ot_color_has_palettes") and hb.ot_color_has_palettes( self.hbfont.face ): self._palette = hb.ot_color_palette_get_colors(self.hbfont.face, 0) else: self._palette = [] return self._palette def make_message_handling_function(self, buf, onchange): self.history = {"GSUB": [], "GPOS": []} self.lastLookupID = None def handle_message(msg, buf2): m = re.match("start lookup (\\d+)", msg) if m: lookupid = int(m[1]) self.history[self.stage].append(self.serialize_buf(buf2)) m = re.match("end lookup (\\d+)", msg) if m: lookupid = int(m[1]) if self.serialize_buf(buf2) != self.history[self.stage][-1]: onchange(self, self.stage, lookupid, self._copy_buf(buf2)) self.history[self.stage].pop() if msg.startswith("start GPOS stage"): self.stage = "GPOS" return handle_message def shape(self, text, parameters=None, onchange=None): """Shapes a text This shapes a piece of text. Args: text (str): A string of text parameters: A dictionary containing parameters to pass to Harfbuzz. Relevant keys include ``script``, ``direction``, ``language`` (these three are normally guessed from the string contents), ``features``, ``variations`` and ``shaper``. onchange: An optional function with three parameters. See below. Additionally, if an `onchange` function is provided, this will be called every time the buffer changes *during* shaping, with the following arguments: - ``self``: the vharfbuzz object. - ``stage``: either "GSUB" or "GPOS" - ``lookupid``: the current lookup ID - ``buffer``: a copy of the buffer as a list of lists (glyphname, cluster, position) Returns: A uharfbuzz ``hb.Buffer`` object """ if not parameters: parameters = {} hbfont = self.hbfont buf = hb.Buffer() buf.add_str(text) buf.guess_segment_properties() if "script" in parameters and parameters["script"]: buf.script = parameters["script"] if "direction" in parameters and parameters["direction"]: buf.direction = parameters["direction"] if "language" in parameters and parameters["language"]: buf.language = parameters["language"] shapers = self.shapers if "shaper" in parameters and parameters["shaper"]: shapers = [parameters["shaper"]] features = parameters.get("features") if "variations" in parameters: self._saved_variations = hbfont.get_var_coords_design() hbfont.set_variations(parameters["variations"]) elif self._saved_variations: hbfont.set_var_coords_design(self._saved_variations) self._saved_variations = None self.stage = "GSUB" if onchange: f = self.make_message_handling_function(buf, onchange) buf.set_message_func(f) hb.shape(hbfont, buf, features, shapers=shapers) self.stage = "GPOS" return buf def _copy_buf(self, buf): # Or at least the bits we care about hbfont = self.hbfont outs = [] for info, pos in zip(buf.glyph_infos, buf.glyph_positions): l = [hbfont.glyph_to_string(info.codepoint), info.cluster] if self.stage == "GPOS": l.append(pos.position) else: l.append(None) outs.append(l) return outs def serialize_buf(self, buf, glyphsonly=False): """Serializes a buffer to a string Returns the contents of the given buffer in a string format similar to that used by ``hb-shape``. Args: buf: The ``hb.Buffer`` object. Returns: A serialized string. """ hbfont = self.hbfont outs = [] for info, pos in zip(buf.glyph_infos, buf.glyph_positions): glyphname = hbfont.glyph_to_string(info.codepoint) if glyphsonly: outs.append(glyphname) continue outs.append("%s=%i" % (glyphname, info.cluster)) if self.stage == "GPOS" and (pos.position[0] != 0 or pos.position[1] != 0): outs[-1] = outs[-1] + "@%i,%i" % (pos.position[0], pos.position[1]) if self.stage == "GPOS": outs[-1] = outs[-1] + "+%i" % (pos.position[2]) return "|".join(outs) def buf_from_string(self, s): """Deserializes a string. This attempts to perform the inverse operation to :py:meth:`serialize_buf`, turning a serialized buffer back into an object. The object is not a ``hb.Buffer``, but has a similar structure (``glyph_infos`` and ``glyph_positions``) so can be passed to code which expects a ``hb.Buffer``, such as :py:meth:`buf_to_svg` below. Args: s (str): A string produced by :py:meth:`serialize_buf` Returns a ``FakeBuffer`` object. """ hbfont = self.hbfont buf = FakeBuffer() buf.glyph_infos = [] buf.glyph_positions = [] for item in s.split("|"): m = re.match(r"^(.*)=(\d+)(@(-?\d+),(-?\d+))?(\+(-?\d+))?$", item) if not m: raise ValueError("Couldn't parse glyph %s in %s" % (item, s)) groups = m.groups() info = FakeItem() info.codepoint = hbfont.glyph_from_string(groups[0]) info.cluster = int(groups[1]) buf.glyph_infos.append(info) pos = FakeItem() pos.x_offset, pos.y_offset, pos.x_advance, pos.y_advance = pos.position = [ int(x or 0) for x in ( groups[3], groups[4], groups[6], 0, # Sorry, vertical scripts ) ] buf.glyph_positions.append(pos) return buf def glyph_to_svg_path(self, gid): """Converts a glyph to SVG Args: gid (int): Glyph ID to render Returns: An SVG string containing a path to represent the glyph. """ buffer_list: list[str] = [] self.hbfont.draw_glyph(gid, self.drawfuncs, buffer_list) return "".join(buffer_list) def _glyph_to_svg_id(self, gid, defs): id = f"g{gid}" if id not in defs: p = self.glyph_to_svg_path(gid) defs[id] = f'' return id @staticmethod def _to_svg_color(color): svg_color = [f"{color.red}", f"{color.green}", f"{color.blue}"] if color.alpha != 255: svg_color.append(f"{color.alpha/255:.0%}") return f"rgb({','.join(svg_color)})" def _glyph_to_svg(self, gid, x, y, defs): transform = f'transform="translate({x},{y})"' svg = [f""] if ( hasattr(hb, "ot_color_has_layers") and hb.ot_color_has_layers(self.hbfont.face) and (layers := hb.ot_color_glyph_get_layers(self.hbfont.face, gid)) ): for layer in layers: id = self._glyph_to_svg_id(layer.glyph, defs) if layer.color_index != 0xFFFF: color = self._to_svg_color(self.palette[layer.color_index]) svg.append(f'') else: svg.append(f'') else: id = self._glyph_to_svg_id(gid, defs) svg.append(f'') svg.append("") return "\n".join(svg) def buf_to_svg(self, buf): """Converts a buffer to SVG Args: buf (hb.Buffer): uharfbuzz ``hb.Buffer`` Returns: An SVG string containing a rendering of the buffer """ defs = {} paths = [] hbfont = self.hbfont font_extents = hbfont.get_font_extents("ltr") y_max = font_extents.ascender y_min = font_extents.descender x_min = x_max = 0 x_cursor = 0 y_cursor = 0 for info, pos in zip(buf.glyph_infos, buf.glyph_positions): dx, dy = pos.x_offset, pos.y_offset p = self._glyph_to_svg(info.codepoint, x_cursor + dx, y_cursor + dy, defs) paths.append(p) if extents := hbfont.get_glyph_extents(info.codepoint): cur_x = x_cursor + dx cur_y = y_cursor + dy min_x = cur_x + min(extents.x_bearing, 0) min_y = cur_y + min(extents.height + extents.y_bearing, pos.y_advance) max_x = cur_x + max(extents.width + extents.x_bearing, pos.x_advance) max_y = cur_y + max(extents.y_bearing, 0) x_min = min(x_min, min_x) y_min = min(y_min, min_y) x_max = max(x_max, max_x) y_max = max(y_max, max_y) x_cursor += pos.x_advance y_cursor += pos.y_advance svg = [ f'', "", *defs.values(), "", *paths, "", "", ] return "\n".join(svg) # v = Vharfbuzz("/Users/simon/Library/Fonts/SourceSansPro-Regular.otf") # buf = v.shape("ABCj") # svg = v.buf_to_svg(buf) # import cairosvg # cairosvg.svg2png(bytestring=svg, write_to="foo.png") vharfbuzz-0.3.1/Makefile000066400000000000000000000042021465641327600152100ustar00rootroot00000000000000.PHONY: clean clean-test clean-pyc clean-build docs help PYTHON=python3 .DEFAULT_GOAL := help define BROWSER_PYSCRIPT import os, webbrowser, sys from urllib.request import pathname2url webbrowser.open("file://" + pathname2url(os.path.abspath(sys.argv[1]))) endef export BROWSER_PYSCRIPT define PRINT_HELP_PYSCRIPT import re, sys for line in sys.stdin: match = re.match(r'^([a-zA-Z_-]+):.*?## (.*)$$', line) if match: target, help = match.groups() print("%-20s %s" % (target, help)) endef export PRINT_HELP_PYSCRIPT BROWSER := $(PYTHON) -c "$$BROWSER_PYSCRIPT" help: @$(PYTHON) -c "$$PRINT_HELP_PYSCRIPT" < $(MAKEFILE_LIST) clean: clean-build clean-pyc clean-test ## remove all build, test, coverage and Python artifacts clean-build: ## remove build artifacts rm -fr build/ rm -fr dist/ rm -fr .eggs/ find . -name '*.egg-info' -exec rm -fr {} + find . -name '*.egg' -exec rm -f {} + clean-pyc: ## remove Python file artifacts find . -name '*.pyc' -exec rm -f {} + find . -name '*.pyo' -exec rm -f {} + find . -name '*~' -exec rm -f {} + find . -name '__pycache__' -exec rm -fr {} + clean-test: ## remove test and coverage artifacts rm -fr .tox/ rm -f .coverage rm -fr htmlcov/ rm -fr .pytest_cache lint: ## check style with flake8 flake8 collidoscope tests test: ## run tests quickly with the default Python $(PYTHON) setup.py test test-all: ## run tests on every Python version with tox tox coverage: ## check code coverage quickly with the default Python coverage run --source collidoscope setup.py test coverage report -m coverage html $(BROWSER) htmlcov/index.html docs: ## generate Sphinx HTML documentation, including API docs $(MAKE) -C docs clean $(MAKE) -C docs html $(BROWSER) docs/_build/html/index.html servedocs: docs ## compile the docs watching for changes watchmedo shell-command -p '*.rst' -c '$(MAKE) -C docs html' -R -D . release: dist ## package and upload a release twine upload dist/* dist: clean ## builds source and wheel package $(PYTHON) setup.py sdist $(PYTHON) setup.py bdist_wheel ls -l dist install: clean ## install the package to the active Python's site-packages $(PYTHON) setup.py install vharfbuzz-0.3.1/README.md000066400000000000000000000024431465641327600150340ustar00rootroot00000000000000# vharfbuzz - A user-friendlier way to use Harfbuzz in Python [uharfbuzz](https://github.com/harfbuzz/uharfbuzz) is an _awesome_ tool for shaping text in Python. But it wraps the Harfbuzz C interface quite closely, so still requires you to perform a bunch of boilerplate operations before you can get on with the shaping. This module allows you a slightly more high-level interface to the text shaping process. For example, rather than: ```python with open(sys.argv[1], 'rb') as fontfile: fontdata = fontfile.read() text = sys.argv[2] face = hb.Face(fontdata) font = hb.Font(face) buf = hb.Buffer() buf.add_str(text) buf.guess_segment_properties() features = {"kern": True, "liga": True} hb.shape(font, buf, features) ``` with `vharfbuzz` you can just say: ```python vhb = Vharfbuzz(sys.argv[1]) buf = vhb.shape(sys.argv[2], {"features": {"kern": True, "liga": True}}) ``` The `Vharfbuzz` class also contains a number of other helpful methods to perform common operations on Harfbuzz buffers. See [Read The Docs](https://vharfbuzz.readthedocs.io/en/latest/) for more information. ## Installation vharfbuzz is available from `pypi`, so can be installed like so: pip3 install vharfbuzz If building from source, you can install it like so: pip3 install -r requirements.txt pip3 install . vharfbuzz-0.3.1/docs/000077500000000000000000000000001465641327600145025ustar00rootroot00000000000000vharfbuzz-0.3.1/docs/Makefile000066400000000000000000000011661465641327600161460ustar00rootroot00000000000000# Minimal makefile for Sphinx documentation PYTHON = python3 # # You can set these variables from the command line. SPHINXOPTS = SPHINXBUILD = $(PYTHON) -msphinx SPHINXPROJ = vharfbuzz SOURCEDIR = . BUILDDIR = _build # Put it first so that "make" without argument is like "make help". help: @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) .PHONY: help Makefile # Catch-all target: route all unknown targets to Sphinx using the new # "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). %: Makefile @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) vharfbuzz-0.3.1/docs/conf.py000077500000000000000000000113171465641327600160070ustar00rootroot00000000000000#!/usr/bin/env python # # vharfbuzz documentation build configuration file, created by # sphinx-quickstart on Fri Jun 9 13:47:02 2017. # # This file is execfile()d with the current directory set to its # containing dir. # # Note that not all possible configuration values are present in this # autogenerated file. # # All configuration values have a default; values that are commented out # serve to show the default. # If extensions (or modules to document with autodoc) are in another # directory, add these directories to sys.path here. If the directory is # relative to the documentation root, use os.path.abspath to make it # absolute, like shown here. # import os import sys sys.path.insert(0, os.path.abspath("../lib")) import vharfbuzz # -- General configuration --------------------------------------------- # If your documentation needs a minimal Sphinx version, state it here. # # needs_sphinx = '1.0' # Add any Sphinx extension module names here, as strings. They can be # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom ones. extensions = ["sphinx.ext.autodoc", "sphinx.ext.napoleon"] # Add any paths that contain templates here, relative to this directory. templates_path = ["_templates"] # The suffix(es) of source filenames. # You can specify multiple suffix as a list of string: # # source_suffix = ['.rst', '.md'] source_suffix = ".rst" # The master toctree document. master_doc = "index" # General information about the project. project = "vharfbuzz" copyright = "2020, Simon Cozens" author = "Simon Cozens" # The version info for the project you're documenting, acts as replacement # for |version| and |release|, also used in various other places throughout # the built documents. # # The short X.Y version. version = vharfbuzz.__version__ # The full version, including alpha/beta/rc tags. release = vharfbuzz.__version__ # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. # # This is also used if you do content translation via gettext catalogs. # Usually you set "language" from the command line for these cases. language = None # List of patterns, relative to source directory, that match files and # directories to ignore when looking for source files. # This patterns also effect to html_static_path and html_extra_path exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"] # The name of the Pygments (syntax highlighting) style to use. pygments_style = "sphinx" # If true, `todo` and `todoList` produce output, else they produce nothing. todo_include_todos = False # -- Options for HTML output ------------------------------------------- # The theme to use for HTML and HTML Help pages. See the documentation for # a list of builtin themes. # html_theme = "alabaster" # Theme options are theme-specific and customize the look and feel of a # theme further. For a list of options available for each theme, see the # documentation. # # html_theme_options = {} # Add any paths that contain custom static files (such as style sheets) here, # relative to this directory. They are copied after the builtin static files, # so a file named "default.css" will overwrite the builtin "default.css". html_static_path = ["_static"] # -- Options for HTMLHelp output --------------------------------------- # Output file base name for HTML help builder. htmlhelp_basename = "vharfbuzzdoc" # -- Options for LaTeX output ------------------------------------------ latex_elements = { # The paper size ('letterpaper' or 'a4paper'). # # 'papersize': 'letterpaper', # The font size ('10pt', '11pt' or '12pt'). # # 'pointsize': '10pt', # Additional stuff for the LaTeX preamble. # # 'preamble': '', # Latex figure (float) alignment # # 'figure_align': 'htbp', } # Grouping the document tree into LaTeX files. List of tuples # (source start file, target name, title, author, documentclass # [howto, manual, or own class]). latex_documents = [ (master_doc, "vharfbuzz.tex", "vharfbuzz Documentation", "Simon Cozens", "manual"), ] # -- Options for manual page output ------------------------------------ # One entry per manual page. List of tuples # (source start file, name, description, authors, manual section). man_pages = [(master_doc, "vharfbuzz", "vharfbuzz Documentation", [author], 1)] # -- Options for Texinfo output ---------------------------------------- # Grouping the document tree into Texinfo files. List of tuples # (source start file, target name, title, author, # dir menu entry, description, category) texinfo_documents = [ ( master_doc, "vharfbuzz", "vharfbuzz Documentation", author, "vharfbuzz", "One line description of project.", "Miscellaneous", ), ] vharfbuzz-0.3.1/docs/index.rst000066400000000000000000000002721465641327600163440ustar00rootroot00000000000000vharfbuzz: A user-friendlier way to use Harfbuzz in Python ========================================================== .. automodule:: vharfbuzz :members: :member-order: bysource vharfbuzz-0.3.1/docs/installation.rst000066400000000000000000000021661465641327600177420ustar00rootroot00000000000000.. highlight:: shell ============ Installation ============ Stable release -------------- To install vharfbuzz, run this command in your terminal: .. code-block:: console $ pip install vharfbuzz This is the preferred method to install vharfbuzz, as it will always install the most recent stable release. If you don't have `pip`_ installed, this `Python installation guide`_ can guide you through the process. .. _pip: https://pip.pypa.io .. _Python installation guide: http://docs.python-guide.org/en/latest/starting/installation/ From sources ------------ The sources for vharfbuzz can be downloaded from the `Github repo`_. You can either clone the public repository: .. code-block:: console $ git clone git://github.com/simoncozens/vharfbuzz Or download the `tarball`_: .. code-block:: console $ curl -OJL https://github.com/simoncozens/vharfbuzz/tarball/master Once you have a copy of the source, you can install it with: .. code-block:: console $ python setup.py install .. _Github repo: https://github.com/simoncozens/vharfbuzz .. _tarball: https://github.com/simoncozens/vharfbuzz/tarball/master vharfbuzz-0.3.1/docs/make.bat000066400000000000000000000014041465641327600161060ustar00rootroot00000000000000@ECHO OFF pushd %~dp0 REM Command file for Sphinx documentation if "%SPHINXBUILD%" == "" ( set SPHINXBUILD=python -msphinx ) set SOURCEDIR=. set BUILDDIR=_build set SPHINXPROJ=glyphtools if "%1" == "" goto help %SPHINXBUILD% >NUL 2>NUL if errorlevel 9009 ( echo. echo.The Sphinx module was not found. Make sure you have Sphinx installed, echo.then set the SPHINXBUILD environment variable to point to the full echo.path of the 'sphinx-build' executable. Alternatively you may add the echo.Sphinx directory to PATH. echo. echo.If you don't have Sphinx installed, grab it from echo.http://sphinx-doc.org/ exit /b 1 ) %SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% goto end :help %SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% :end popd vharfbuzz-0.3.1/docs/readme.rst000066400000000000000000000000331465641327600164650ustar00rootroot00000000000000.. include:: ../README.rst vharfbuzz-0.3.1/pyproject.toml000066400000000000000000000017321465641327600164710ustar00rootroot00000000000000[build-system] requires = ["setuptools>=45", "setuptools_scm[toml]>=8.1"] build-backend = "setuptools.build_meta" [project] name = "vharfbuzz" description = "A user-friendlier way to use Harfbuzz in Python" license = {file = "LICENSE"} readme = "README.md" dynamic = ["version"] authors = [ { name = "Simon Cozens", email = "simon@simon-cozens.org" } ] classifiers = [ 'Environment :: Console', 'Topic :: Text Processing :: Fonts', ] dependencies = [ 'uharfbuzz>=0.34.0', 'fontTools' ] [project.urls] Repository = "https://github.com/simoncozens/vharfbuzz" Issues = "https://github.com/simoncozens/vharfbuzz/issues" [project.optional-dependencies] dev = [ "pytest", "black", ] [tool.setuptools.packages.find] where = ["Lib"] [tool.setuptools_scm] write_to = "Lib/vharfbuzz/_version.py" git_describe_command = "git describe --match 'v*'" [tool.pytest.ini_options] filterwarnings = ["ignore::DeprecationWarning"] [tool.black] exclude = ''' ( _version.py ) '''