# Normalizers

## Kerning

fontParts.base.normalizers.normalizeKerningKey(value)

  Normalizes kerning key.

  - value must be a `tuple` or `list`.

  - value must contain only two members.

  - value items must be String.

  - value items must be at least one character long.

  - Returned value will be a two member `tuple` of unencoded `unicode` strings.

fontParts.base.normalizers.normalizeKerningValue(value)

  Normalizes kerning value.

  - value must be an Integer/Float.

  - Returned value is the same type as input value.

## Groups

fontParts.base.normalizers.normalizeGroupKey(value)

  Normalizes group key.

  - value must be a String.

  - value must be least one character long.

  - Returned value will be an unencoded `unicode` string.

fontParts.base.normalizers.normalizeGroupValue(value)

  Normalizes group value.

  - value must be a `list`.

  - value items must normalize as glyph names with `normalizeGlyphName`.

  - Returned value will be a `tuple` of unencoded `unicode` strings.

## Features

fontParts.base.normalizers.normalizeFeatureText(value)

  Normalizes feature text.

  - value must be a String.

  - Returned value will be an unencoded `unicode` string.

## Lib

fontParts.base.normalizers.normalizeLibKey(value)

  Normalizes lib key.

  - value must be a String.

  - value must be at least one character long.

  - Returned value will be an unencoded `unicode` string.

fontParts.base.normalizers.normalizeLibValue(value)

  Normalizes lib value.

  - value must not be `None`.

  - Returned value is the same type as the input value.

## Layers

fontParts.base.normalizers.normalizeLayerOrder(value, font)

  Normalizes layer order.

  ** value must be a `tuple` or `list`. * value items must normalize as layer names with

  > `normalizeLayerName`.

  - value must contain layers that exist in font.

  - value must not contain duplicate layers.

  - Returned `tuple` will be unencoded `unicode` strings for each layer name.

fontParts.base.normalizers.normalizeDefaultLayerName(value, font)

  Normalizes default layer name.

  - value must normalize as layer name with `normalizeLayerName`.

  - value must be a layer in font.

  - Returned value will be an unencoded `unicode` string.

fontParts.base.normalizers.normalizeLayerName(value)

  Normalizes layer name.

  - value must be a String.

  - value must be at least one character long.

  - Returned value will be an unencoded `unicode` string.

## Glyphs

fontParts.base.normalizers.normalizeGlyph(value)

  Normalizes glyph.

  - value must be a instance of `BaseGlyph`

  - Returned value is the same type as the input value.

fontParts.base.normalizers.normalizeGlyphOrder(value)

  Normalizes glyph order.

  ** value must be a `tuple` or `list`. * value items must normalize as glyph names with

  > `normalizeGlyphName`.

  - value must not repeat glyph names.

  - Returned value will be a `tuple` of unencoded `unicode` strings.

### Identification

fontParts.base.normalizers.normalizeGlyphName(value)

  Normalizes glyph name.

  - value must be a String.

  - value must be at least one character long.

  - Returned value will be an unencoded `unicode` string.

fontParts.base.normalizers.normalizeGlyphUnicodes(value)

  Normalizes glyph unicodes.

  - value must be a `list`.

  - value items must normalize as glyph unicodes with `normalizeGlyphUnicode`.

  - value must not repeat unicode values.

  - Returned value will be a `tuple` of ints.

fontParts.base.normalizers.normalizeGlyphUnicode(value)

  Normalizes glyph unicode.

  - value must be an int or hex (represented as a string).

  - value must be in a unicode range.

  - Returned value will be an `int`.

### Metrics

fontParts.base.normalizers.normalizeGlyphWidth(value)

  Normalizes glyph width.

  - value must be a Integer/Float.

  - Returned value is the same type as the input value.

fontParts.base.normalizers.normalizeGlyphLeftMargin(value)

  Normalizes glyph left margin.

  - value must be a Integer/Float or None.

  - Returned value is the same type as the input value.

fontParts.base.normalizers.normalizeGlyphRightMargin(value)

  Normalizes glyph right margin.

  - value must be a Integer/Float or None.

  - Returned value is the same type as the input value.

fontParts.base.normalizers.normalizeGlyphHeight(value)

  Normalizes glyph height.

  - value must be a Integer/Float.

  - Returned value is the same type as the input value.

fontParts.base.normalizers.normalizeGlyphBottomMargin(value)

  Normalizes glyph bottom margin.

  - value must be a Integer/Float or None.

  - Returned value is the same type as the input value.

fontParts.base.normalizers.normalizeGlyphTopMargin(value)

  Normalizes glyph top margin.

  - value must be a Integer/Float or None.

  - Returned value is the same type as the input value.

## Contours

fontParts.base.normalizers.normalizeContour(value)

  Normalizes contour.

  - value must be a instance of `BaseContour`

  - Returned value is the same type as the input value.

## Points

fontParts.base.normalizers.normalizePointType(value)

  Normalizes point type.

  - value must be an string.

  - value must be one of the following:

    move
    line
    offcurve
    curve
    qcurve

  - Returned value will be an unencoded `unicode` string.

fontParts.base.normalizers.normalizePointName(value)

  Normalizes point name.

  - value must be a String.

  - value must be at least one character long.

  - Returned value will be an unencoded `unicode` string.

## Segments

fontParts.base.normalizers.normalizeSegmentType(value)

  Normalizes segment type.

  - value must be a String.

  - value must be one of the following:

  move
  line
  curve
  qcurve

  - Returned value will be an unencoded `unicode` string.

## BPoints

fontParts.base.normalizers.normalizeBPointType(value)

  Normalizes bPoint type.

  - value must be an string.

  - value must be one of the following:

    corner
    curve

  - Returned value will be an unencoded `unicode` string.

## Components

fontParts.base.normalizers.normalizeComponentScale(value)

  Normalizes component scale.

  - value must be a `tuple` or `list`.

  - value must have exactly two items. These items must be instances of Integer/Float.

  - Returned value is a `tuple` of two ``float``s.

## Anchors

fontParts.base.normalizers.normalizeAnchorName(value)

  Normalizes anchor name.

  - value must be a String or `None`.

  - value must be at least one character long if String.

  - Returned value will be an unencoded `unicode` string or `None`.

## Note

fontParts.base.normalizers.normalizeGlyphNote(value)

  Normalizes Glyph Note.

  - value must be a String.

  - Returned value is an unencoded `unicode` string

## Guidelines

fontParts.base.normalizers.normalizeGuideline(value)

  Normalizes guideline.

  - value must be a instance of `BaseGuideline`

  - Returned value is the same type as the input value.

fontParts.base.normalizers.normalizeGuidelineName(value)

  Normalizes guideline name.

  - value must be a String.

  - value must be at least one character long.

  - Returned value will be an unencoded `unicode` string.

## Generic

fontParts.base.normalizers.normalizeInternalObjectType(value, cls, name)

  Normalizes an internal object type.

  - value must be a instance of cls.

  - Returned value is the same type as the input value.

### Positions

fontParts.base.normalizers.normalizeX(value)

  Normalizes x coordinate.

  - value must be an Integer/Float.

  - Returned value is the same type as the input value.

fontParts.base.normalizers.normalizeY(value)

  Normalizes y coordinate.

  - value must be an Integer/Float.

  - Returned value is the same type as the input value.

fontParts.base.normalizers.normalizeCoordinateTuple(value)

  Normalizes coordinate tuple.

  - value must be a `tuple` or `list`.

  - value must have exactly two items.

  - value items must be an Integer/Float.

  - Returned value is a `tuple` of two values of the same type as the input values.

fontParts.base.normalizers.normalizeBoundingBox(value)

  Normalizes bounding box.

  - value must be an `tuple` or `list`.

  - value must have exactly four items.

  - value items must be Integer/Float.

  - xMin and yMin must be less than or equal to the corresponding xMax, yMax.

  - Returned value will be a tuple of four `float`.

### Identification

fontParts.base.normalizers.normalizeIndex(value)

  Normalizes index.

  - value must be an `int` or `None`.

  - Returned value is the same type as the input value.

fontParts.base.normalizers.normalizeIdentifier(value)

  Normalizes identifier.

  - value must be an String or None.

  - value must not be longer than 100 characters.

  - value must not contain a character out the range of 0x20 - 0x7E.

  - Returned value is an unencoded `unicode` string.

fontParts.base.normalizers.normalizeColor(value)

  Normalizes Color.

  - value must be an `tuple` or `list`.

  - value must have exactly four items.

  - value color components must be between 0 and 1.

  - Returned value is a `tuple` containing four `float` values.

### Interpolation

fontParts.base.normalizers.normalizeInterpolationFactor(value)

  Normalizes interpolation factor.

  - value must be an Integer/Float, `tuple` or `list`.

  - If value is a `tuple` or `list`, it must have exactly two items. These items must be instances of Integer/Float.

  - Returned value is a `tuple` of two `float`.

### Transformations

fontParts.base.normalizers.normalizeTransformationMatrix(value)

  Normalizes transformation matrix.

  - value must be an `tuple` or `list`.

  - value must have exactly six items. Each of these items must be an instance of Integer/Float.

  - Returned value is a `tuple` of six `float`.

fontParts.base.normalizers.normalizeTransformationOffset(value)

  Normalizes transformation offset.

  - value must be an `tuple`.

  - value must have exactly two items. Each item must be an instance of Integer/Float.

  - Returned value is a `tuple` of two `float`.

fontParts.base.normalizers.normalizeTransformationSkewAngle(value)

  Normalizes transformation skew angle.

  - value must be an Integer/Float, `tuple` or `list`.

  - If value is a `tuple` or `list`, it must have exactly two items. These items must be instances of Integer/Float.

  - value items must be between -360 and 360.

  - If the value is negative, it is normalized by adding it to 360

  - Returned value is a `tuple` of two `float` between 0 and 360.

fontParts.base.normalizers.normalizeTransformationScale(value)

  Normalizes transformation scale.

  - value must be an Integer/Float, `tuple` or `list`.

  - If value is a `tuple` or `list`, it must have exactly two items. These items must be instances of Integer/Float.

  - Returned value is a `tuple` of two ``float``s.

### Files

fontParts.base.normalizers.normalizeFilePath(value)

  Normalizes file path.

  - value must be a String.

  - Returned value is an unencoded `unicode` string

fontParts.base.normalizers.normalizeFileFormatVersion(value)

  Normalizes a font’s file format version.

  - value must be a type-int.

  - Returned value will be a `int`.

### Standard

fontParts.base.normalizers.normalizeBoolean(value)

  Normalizes a boolean.

  - value must be an `int` with value of 0 or 1, or a `bool`.

  - Returned value will be a boolean.

fontParts.base.normalizers.normalizeVisualRounding(value)

  Normalizes rounding. Python 3 uses banker’s rounding, meaning anything that is at 0.5 will go to the even number. This isn’t always ideal for point coordinates, so instead round to the higher number.

  - value must be an Integer/Float

  - Returned value is a `int`