Normalizers¶
Kerning¶
- fontParts.base.normalizers.normalizeKerningKey(value)[source]¶
Normalizes kerning key.
value must be a
tupleorlist.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
tupleof unencodedunicodestrings.
- fontParts.base.normalizers.normalizeKerningValue(value)[source]¶
Normalizes kerning value.
value must be an Integer/Float.
Returned value is the same type as input value.
Groups¶
- fontParts.base.normalizers.normalizeGroupKey(value)[source]¶
Normalizes group key.
value must be a String.
value must be least one character long.
Returned value will be an unencoded
unicodestring.
- fontParts.base.normalizers.normalizeGroupValue(value)[source]¶
Normalizes group value.
value must be a
list.value items must normalize as glyph names with
normalizeGlyphName.Returned value will be a
tupleof unencodedunicodestrings.
Features¶
Lib¶
Layers¶
- fontParts.base.normalizers.normalizeLayerOrder(value, font)[source]¶
Normalizes layer order.
** value must be a
tupleorlist. * value items must normalize as layer names withvalue must contain layers that exist in font.
value must not contain duplicate layers.
Returned
tuplewill be unencodedunicodestrings for each layer name.
- fontParts.base.normalizers.normalizeDefaultLayerName(value, font)[source]¶
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
unicodestring.
Glyphs¶
- fontParts.base.normalizers.normalizeGlyph(value)[source]¶
Normalizes glyph.
value must be a instance of
BaseGlyphReturned value is the same type as the input value.
- fontParts.base.normalizers.normalizeGlyphOrder(value)[source]¶
Normalizes glyph order.
** value must be a
tupleorlist. * value items must normalize as glyph names withvalue must not repeat glyph names.
Returned value will be a
tupleof unencodedunicodestrings.
Identification¶
- fontParts.base.normalizers.normalizeGlyphName(value)[source]¶
Normalizes glyph name.
value must be a String.
value must be at least one character long.
Returned value will be an unencoded
unicodestring.
- fontParts.base.normalizers.normalizeGlyphUnicodes(value)[source]¶
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
tupleof ints.
Metrics¶
- fontParts.base.normalizers.normalizeGlyphWidth(value)[source]¶
Normalizes glyph width.
value must be a Integer/Float.
Returned value is the same type as the input value.
- fontParts.base.normalizers.normalizeGlyphLeftMargin(value)[source]¶
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)[source]¶
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)[source]¶
Normalizes glyph height.
value must be a Integer/Float.
Returned value is the same type as the input value.
- fontParts.base.normalizers.normalizeGlyphBottomMargin(value)[source]¶
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)[source]¶
Normalizes glyph top margin.
value must be a Integer/Float or None.
Returned value is the same type as the input value.
Contours¶
Points¶
Segments¶
BPoints¶
Components¶
- fontParts.base.normalizers.normalizeComponentScale(value)[source]¶
Normalizes component scale.
value must be a
tupleorlist.value must have exactly two items. These items must be instances of Integer/Float.
Returned value is a
tupleof two ``float``s.
Anchors¶
Note¶
Guidelines¶
Generic¶
- fontParts.base.normalizers.normalizeInternalObjectType(value, cls, name)[source]¶
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)[source]¶
Normalizes x coordinate.
value must be an Integer/Float.
Returned value is the same type as the input value.
- fontParts.base.normalizers.normalizeY(value)[source]¶
Normalizes y coordinate.
value must be an Integer/Float.
Returned value is the same type as the input value.
- fontParts.base.normalizers.normalizeCoordinateTuple(value)[source]¶
Normalizes coordinate tuple.
value must be a
tupleorlist.value must have exactly two items.
value items must be an Integer/Float.
Returned value is a
tupleof two values of the same type as the input values.
- fontParts.base.normalizers.normalizeBoundingBox(value)[source]¶
Normalizes bounding box.
value must be an
tupleorlist.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)[source]¶
Normalizes index.
value must be an
intorNone.Returned value is the same type as the input value.
Interpolation¶
- fontParts.base.normalizers.normalizeInterpolationFactor(value)[source]¶
Normalizes interpolation factor.
value must be an Integer/Float,
tupleorlist.If value is a
tupleorlist, it must have exactly two items. These items must be instances of Integer/Float.Returned value is a
tupleof twofloat.
Transformations¶
- fontParts.base.normalizers.normalizeTransformationMatrix(value)[source]¶
Normalizes transformation matrix.
value must be an
tupleorlist.value must have exactly six items. Each of these items must be an instance of Integer/Float.
Returned value is a
tupleof sixfloat.
- fontParts.base.normalizers.normalizeTransformationOffset(value)[source]¶
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
tupleof twofloat.
- fontParts.base.normalizers.normalizeTransformationSkewAngle(value)[source]¶
Normalizes transformation skew angle.
value must be an Integer/Float,
tupleorlist.If value is a
tupleorlist, 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
tupleof twofloatbetween 0 and 360.
- fontParts.base.normalizers.normalizeTransformationScale(value)[source]¶
Normalizes transformation scale.
value must be an Integer/Float,
tupleorlist.If value is a
tupleorlist, it must have exactly two items. These items must be instances of Integer/Float.Returned value is a
tupleof two ``float``s.
Files¶
Standard¶
- fontParts.base.normalizers.normalizeBoolean(value)[source]¶
Normalizes a boolean.
value must be an
intwith value of 0 or 1, or abool.Returned value will be a boolean.
- fontParts.base.normalizers.normalizeVisualRounding(value)[source]¶
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