Code Monkey home page Code Monkey logo

packtab's Introduction

Linux CI Status CircleCI Build Status OSS-Fuzz Status Coverity Scan Build Status Codacy Badge Codecov Code Coverage Packaging status OpenSSF Scorecard

HarfBuzz

HarfBuzz is a text shaping engine. It primarily supports OpenType, but also Apple Advanced Typography. HarfBuzz is used in Android, Chrome, ChromeOS, Firefox, GNOME, GTK+, KDE, Qt, LibreOffice, OpenJDK, XeTeX, PlayStation, Microsoft Edge, Adobe Photoshop, Illustrator, InDesign, Godot Engine, and other places.

xkcd-derived image

For bug reports, mailing list, and other information please visit:

http://harfbuzz.org/

For license information, see COPYING.

Documentation

For user manual as well as API documentation, check: https://harfbuzz.github.io

Download

For tarball releases of HarfBuzz, look here. At the same place you will also find Win32/Win64 binary bundles that include libharfbuzz DLL, hb-view.exe, hb-shape.exe, and all dependencies.

The canonical source tree is available on github.

The API that comes with hb.h will not change incompatibly. Other, peripheral, headers are more likely to go through minor modifications, but again, we do our best to never change API in an incompatible way. We will never break the ABI.

If you are not sure whether Pango or HarfBuzz is right for you, read Pango vs HarfBuzz.

Development

For build information, see BUILD.md.

For custom configurations, see CONFIG.md.

For testing and profiling, see TESTING.md.

To get a better idea of where HarfBuzz stands in the text rendering stack you may want to read State of Text Rendering, though, that document is many years old. Here are a few presentation slides about HarfBuzz at the Internationalization and Unicode Conference over the years:

Both development and user support discussion around HarfBuzz happens on the github.

To report bugs or submit patches please use github issues and pull-requests.

For a comparison of old vs new HarfBuzz memory consumption see this.

Name

HarfBuzz (حرف‌باز) is the literal Persian translation of “OpenType”, transliterated using the Latin script. It also means "talkative" or "glib" (also a nod to the GNOME project where HarfBuzz originates from).

Background: Originally there was this font format called TrueType. People and companies started calling their type engines all things ending in Type: FreeType, CoolType, ClearType, etc. And then came OpenType, which is the successor of TrueType. So, for my OpenType implementation, I decided to stick with the concept but use the Persian translation. Which is fitting given that Persian is written in the Arabic script, and OpenType is an extension of TrueType that adds support for complex script rendering, and HarfBuzz is an implementation of OpenType complex text shaping.

Packaging status of HarfBuzz

Packaging status

packtab's People

Contributors

anthrotype avatar behdad avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

packtab's Issues

Set up Travis CI

  • Run minimal tests
  • build and upload distribution packages to PyPI on tagged commits

Avoid Type/Object Identity Comparisons

It is preferable to use isinstance rather than comparing type objects for identity. Also better to compare integers for equality rather than object identity — the latter may work for small-magnitude integers, but it can give surprising results sometimes.

diff --git a/Lib/packTab/__init__.py b/Lib/packTab/__init__.py
index bbf1e7f..f687485 100644
--- a/Lib/packTab/__init__.py
+++ b/Lib/packTab/__init__.py
@@ -25,7 +25,7 @@ except ImportError:
 class AutoMapping(collections.defaultdict):
    _next = 0
    def __missing__(self, key):
-		assert type(key) is not int
+		assert not isinstance(key, int)
        v = self._next
        self._next = self._next + 1
        self[key] = v
@@ -60,8 +60,8 @@ def pack_table(data, mapping=None, default=0):

    # Set up mapping.  See docstring.
    if mapping is not None:
-		assert (all(type(k) is int and type(v) is str for k,v in mapping.items()) or
-			all(type(k) is str and type(v) is int for k,v in mapping.items()))
+		assert (all(isinstance(k, int) and isinstance(v, str) for k,v in mapping.items()) or
+			all(isinstance(k, str) and isinstance(v, int) for k,v in mapping.items()))
        mapping2 = mapping.copy()
        for k,v in mapping.items():
            mapping2[v] = k
@@ -72,7 +72,7 @@ def pack_table(data, mapping=None, default=0):

    # Set up data as a list.
    if isinstance(data, dict):
-		assert(all(type(k) is int and type(v) in (int, str) for k,v in data.items()))
+		assert(all(isinstance(k, int) and isinstance(v, (int, str)) for k,v in data.items()))
        minK = min(dict.keys())
        maxK = max(dict.keys())
        assert minK >= 0
@@ -83,11 +83,11 @@ def pack_table(data, mapping=None, default=0):
        del data2

    # Convert all to integers
-	assert (all(type(v) is int for v in data) or
-		all(type(v) is str for v in data))
-	if type(data[0]) is str:
+	assert (all(isinstance(v, int) for v in data) or
+		all(isinstance(v, str) for v in data))
+	if isinstance(data[0], str):
        data = [mapping[v] for v in data]
-	if type(default) is str:
+	if isinstance(default, str):
        default = mapping[default]

    return solve(data, default)
@@ -111,7 +111,7 @@ def binaryBitsFor(n):
    >>> binaryBitsFor(100)
    8
    """
-	if n is 1: return 0
+	if n == 1: return 0
    return 1 << ceil(log2(log2(n)))

 bytesPerOp = 4

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.