# textTools

fontTools.misc.textTools.py – miscellaneous routines.

class fontTools.misc.textTools.Tag(content)

  Bases: `str`

  static transcode(blob)
  tobytes()

fontTools.misc.textTools.readHex(content)

  Convert a list of hex strings to binary data.

fontTools.misc.textTools.deHexStr(hexdata)

  Convert a hex string to binary data.

fontTools.misc.textTools.hexStr(data)

  Convert binary data to a hex string.

fontTools.misc.textTools.num2binary(l, bits=32)

fontTools.misc.textTools.binary2num(bin)

fontTools.misc.textTools.caselessSort(alist)

  Return a sorted copy of a list. If there are only strings in the list, it will not consider case.

fontTools.misc.textTools.pad(data, size)

  Pad byte string ‘data’ with null bytes until its length is a multiple of ‘size’.

      >>> len(pad(b'abcd', 4))
      4
      >>> len(pad(b'abcde', 2))
      6
      >>> len(pad(b'abcde', 4))
      8
      >>> pad(b'abcdef', 4) == b'abcdef\x00\x00'
      True

fontTools.misc.textTools.tostr(s, encoding='ascii', errors='strict')

fontTools.misc.textTools.tobytes(s, encoding='ascii', errors='strict')

fontTools.misc.textTools.bytechr(n)

fontTools.misc.textTools.byteord(c)

fontTools.misc.textTools.strjoin(iterable, joiner='')

fontTools.misc.textTools.bytesjoin(iterable, joiner=b'')