Info¶
Description¶
The Info object contains all names, numbers, URLs, dimensions, values, etc. that would otherwise clutter up the font object. You don’t have to create a Info object yourself, Font makes one when it is created.
Info validates any value set for a Info <BaseInfo> item, but does not check if the data is sane (i.e., you can set valid but incorrect data).
The Info object (as any other fontParts object) does not allow to modify mutable containers (like lists) in-place. Always get a value, modify it and then set it back to perform an edit.
For a list of info attributes, refer to the UFO fontinfo.plist Specification.
Overview¶
Family name. |
|
Style name. |
|
Family name used for bold, italic and bold italic style mapping. |
|
Style map style. |
|
Major version. |
|
Minor version. |
|
The year the font was created. |
|
Copyright statement. |
|
Trademark statement. |
|
Units per em. |
|
Descender value. |
|
x-height value. |
|
Cap height value. |
|
Ascender value. |
|
Italic angle. |
|
Arbitrary note about the font. |
|
Creation date. |
|
Smallest readable size in pixels. |
|
A list of bit numbers indicating the flags. |
|
Ascender value. |
|
Descender value. |
|
Line gap value. |
|
Caret slope rise value. |
|
Caret slope run value. |
|
Caret offset value. |
|
Designer name. |
|
URL for the designer. |
|
Manufacturer name. |
|
Manufacturer URL. |
|
License text. |
|
URL for the license. |
|
Version string. |
|
Unique ID string. |
|
Description of the font. |
|
Preferred family name. |
|
Preferred subfamily name. |
|
Compatible full name. |
|
Sample text. |
|
WWS family name. |
|
WWS Subfamily name. |
|
Width class value. |
|
Weight class value. |
|
A list of bit numbers indicating the bits that should be set in fsSelection. |
|
Four character identifier for the creator of the font. |
|
The list should contain 10 integers that represent the setting for each category in the Panose specification. |
|
Two integers representing the IBM font class and font subclass of the font. |
|
A list of bit numbers that are supported Unicode ranges in the font. |
|
A list of bit numbers that are supported code page ranges in the font. |
|
Ascender value. |
|
Descender value. |
|
Line gap value. |
|
Ascender value. |
|
Descender value. |
|
A list of bit numbers indicating the embedding type. |
|
Subscript horizontal font size. |
|
Subscript vertical font size. |
|
Subscript x offset. |
|
Subscript y offset. |
|
Superscript horizontal font size. |
|
Superscript vertical font size. |
|
Superscript x offset. |
|
Superscript y offset. |
|
Strikeout size. |
|
Strikeout position. |
|
Ascender value. |
|
Descender value. |
|
Line gap value. |
|
Caret slope rise value. |
|
Caret slope run value. |
|
Caret offset value. |
|
Name to be used for the FontName field in Type 1/CFF table. |
|
Name to be used for the FullName field in Type 1/CFF table. |
|
Artificial slant angle. |
|
A unique ID number as defined in the Type 1/CFF specification. |
|
Underline thickness value. |
|
Underline position value. |
|
Indicates if the font is monospaced. |
|
A list of up to 14 integers or floats specifying the values that should be in the Type 1/CFF BlueValues field. |
|
A list of up to 10 integers or floats specifying the values that should be in the Type 1/CFF OtherBlues field. |
|
A list of up to 14 integers or floats specifying the values that should be in the Type 1/CFF FamilyBlues field. |
|
A list of up to 10 integers or floats specifying the values that should be in the Type 1/CFF FamilyOtherBlues field. |
|
List of horizontal stems sorted in increasing order. |
|
List of vertical stems sorted in increasing order. |
|
BlueFuzz value. |
|
BlueShift value. |
|
BlueScale value. |
|
Indicates how the Type 1/CFF ForceBold field should be set. |
|
Default width for glyphs. |
|
Nominal width for glyphs. |
|
A string indicating the overall weight of the font. |
|
The name of the glyph that should be used as the default character in PFM files. |
|
The Windows character set. |
|
Copy the current object into a new object of the same type. |
|
Get or set the info's parent font object. |
|
Interpolate all possible data in the current info object. |
|
Round the following attributes to the nearest integer: |
|
Update the current info object with the values from another. |
|
Return the environment's native object wrapped by the current object. |
|
Tell the environment that something has changed in the object. |
Reference¶
- class fontParts.base.BaseInfo(*args: Any, **kwargs: Any)[source]¶
Represent the basis for a font info object.
Attributes¶
- BaseInfo.styleMapFamilyName: str | None¶
Family name used for bold, italic and bold italic style mapping.
- BaseInfo.styleMapStyleName: str | None¶
Style map style.
The possible values are regular, italic, bold and bold italic. These are case sensitive.
- BaseInfo.year: int | None¶
The year the font was created.
This attribute is deprecated as of version 2. It’s presence should not be relied upon by applications. However, it may occur in a font’s info so applications should preserve it if present.
- BaseInfo.openTypeHeadCreated: str | None¶
Creation date.
Expressed as a string of the format “YYYY/MM/DD HH:MM:SS”. “YYYY/MM/DD” is year/month/day. The month should be in the range 1-12 and the day should be in the range 1-end of month. “HH:MM:SS” is hour:minute:second. The hour should be in the range 0:23. The minute and second should each be in the range 0-59.
- BaseInfo.openTypeHeadLowestRecPPEM: int | float¶
Smallest readable size in pixels.
Corresponds to the OpenType head table lowestRecPPEM field.
- BaseInfo.openTypeHeadFlags: list[int] | None¶
A list of bit numbers indicating the flags.
The bit numbers are listed in the OpenType head specification. Corresponds to the OpenType head table flags field.
- BaseInfo.openTypeHheaAscender: int | float¶
Ascender value.
Corresponds to the OpenType hhea table Ascender field.
- BaseInfo.openTypeHheaDescender: int | float¶
Descender value.
Corresponds to the OpenType hhea table Descender field.
- BaseInfo.openTypeHheaLineGap: int | float¶
Line gap value.
Corresponds to the OpenType hhea table LineGap field.
- BaseInfo.openTypeHheaCaretSlopeRise: int | None¶
Caret slope rise value.
Corresponds to the OpenType hhea table caretSlopeRise field.
- BaseInfo.openTypeHheaCaretSlopeRun: int | None¶
Caret slope run value.
Corresponds to the OpenType hhea table caretSlopeRun field.
- BaseInfo.openTypeHheaCaretOffset: int | float¶
Caret offset value.
Corresponds to the OpenType hhea table caretOffset field.
- BaseInfo.openTypeNameDesigner: str | None¶
Designer name.
Corresponds to the OpenType name table name ID 9.
- BaseInfo.openTypeNameDesignerURL: str | None¶
URL for the designer.
Corresponds to the OpenType name table name ID 12.
- BaseInfo.openTypeNameManufacturer: str | None¶
Manufacturer name.
Corresponds to the OpenType name table name ID 8.
- BaseInfo.openTypeNameManufacturerURL: str | None¶
Manufacturer URL.
Corresponds to the OpenType name table name ID 11.
- BaseInfo.openTypeNameLicense: str | None¶
License text.
Corresponds to the OpenType name table name ID 13.
- BaseInfo.openTypeNameLicenseURL: str | None¶
URL for the license.
Corresponds to the OpenType name table name ID 14.
- BaseInfo.openTypeNameVersion: str | None¶
Version string.
Corresponds to the OpenType name table name ID 5.
- BaseInfo.openTypeNameUniqueID: str | None¶
Unique ID string.
Corresponds to the OpenType name table name ID 3.
- BaseInfo.openTypeNameDescription: str | None¶
Description of the font.
Corresponds to the OpenType name table name ID 10.
- BaseInfo.openTypeNamePreferredFamilyName: str | None¶
Preferred family name.
Corresponds to the OpenType name table name ID 16.
- BaseInfo.openTypeNamePreferredSubfamilyName: str | None¶
Preferred subfamily name.
Corresponds to the OpenType name table name ID 17.
- BaseInfo.openTypeNameCompatibleFullName: str | None¶
Compatible full name.
Corresponds to the OpenType name table name ID 18.
- BaseInfo.openTypeNameSampleText: str | None¶
Sample text.
Corresponds to the OpenType name table name ID 20.
- BaseInfo.openTypeNameWWSFamilyName: str | None¶
WWS family name.
Corresponds to the OpenType name table name ID 21.
- BaseInfo.openTypeNameWWSSubfamilyName: str | None¶
WWS Subfamily name.
Corresponds to the OpenType name table name ID 22.
- BaseInfo.openTypeOS2WidthClass: int | None¶
Width class value.
Must be in the range 1-9. Corresponds to the OpenType OS/2 table usWidthClass field.
- BaseInfo.openTypeOS2WeightClass: int | None¶
Weight class value.
Must be a positive integer. Corresponds to the OpenType OS/2 table usWeightClass field.
- BaseInfo.openTypeOS2Selection: list[int] | None¶
A list of bit numbers indicating the bits that should be set in fsSelection.
The bit numbers are listed in the OpenType OS/2 specification. Corresponds to the OpenType OS/2 table selection field. Note: Bits 0 (italic), 5 (bold) and 6 (regular) should not be set here. These bits should be taken from the generic styleMapStyleName attribute.
- BaseInfo.openTypeOS2VendorID: str | None¶
Four character identifier for the creator of the font.
Corresponds to the OpenType OS/2 table achVendID field.
- BaseInfo.openTypeOS2Panose: list[int] | None¶
The list should contain 10 integers that represent the setting for each category in the Panose specification.
The integers correspond with the option numbers in each of the Panose categories. This corresponds to the OpenType OS/2 table Panose field.
- BaseInfo.openTypeOS2FamilyClass: list[int] | None¶
Two integers representing the IBM font class and font subclass of the font.
The first number, representing the class ID, should be in the range 0-14. The second number, representing the subclass, should be in the range 0-15. The numbers are listed in the OpenType OS/2 specification. Corresponds to the OpenType OS/2 table sFamilyClass field.
- BaseInfo.openTypeOS2UnicodeRanges: list[int] | None¶
A list of bit numbers that are supported Unicode ranges in the font.
The bit numbers are listed in the OpenType OS/2 specification. Corresponds to the OpenType OS/2 table ulUnicodeRange1, ulUnicodeRange2, ulUnicodeRange3 and ulUnicodeRange4 fields.
- BaseInfo.openTypeOS2CodePageRanges: list[int] | None¶
A list of bit numbers that are supported code page ranges in the font.
The bit numbers are listed in the OpenType OS/2 specification. Corresponds to the OpenType OS/2 table ulCodePageRange1 and ulCodePageRange2 fields.
- BaseInfo.openTypeOS2TypoAscender: int | float¶
Ascender value.
Corresponds to the OpenType OS/2 table sTypoAscender field.
- BaseInfo.openTypeOS2TypoDescender: int | float¶
Descender value.
Corresponds to the OpenType OS/2 table sTypoDescender field.
- BaseInfo.openTypeOS2TypoLineGap: int | float¶
Line gap value.
Corresponds to the OpenType OS/2 table sTypoLineGap field.
- BaseInfo.openTypeOS2WinAscent: int | float¶
Ascender value.
Corresponds to the OpenType OS/2 table usWinAscent field.
- BaseInfo.openTypeOS2WinDescent: int | float¶
Descender value.
Corresponds to the OpenType OS/2 table usWinDescent field.
- BaseInfo.openTypeOS2Type: list[int] | None¶
A list of bit numbers indicating the embedding type.
The bit numbers are listed in the OpenType OS/2 specification. Corresponds to the OpenType OS/2 table fsType field.
- BaseInfo.openTypeOS2SubscriptXSize: int | float¶
Subscript horizontal font size.
Corresponds to the OpenType OS/2 table ySubscriptXSize field.
- BaseInfo.openTypeOS2SubscriptYSize: int | float¶
Subscript vertical font size.
Corresponds to the OpenType OS/2 table ySubscriptYSize field.
- BaseInfo.openTypeOS2SubscriptXOffset: int | float¶
Subscript x offset.
Corresponds to the OpenType OS/2 table ySubscriptXOffset field.
- BaseInfo.openTypeOS2SubscriptYOffset: int | float¶
Subscript y offset.
Corresponds to the OpenType OS/2 table ySubscriptYOffset field.
- BaseInfo.openTypeOS2SuperscriptXSize: int | float¶
Superscript horizontal font size.
Corresponds to the OpenType OS/2 table ySuperscriptXSize field.
- BaseInfo.openTypeOS2SuperscriptYSize: int | float¶
Superscript vertical font size.
Corresponds to the OpenType OS/2 table ySuperscriptYSize field.
- BaseInfo.openTypeOS2SuperscriptXOffset: int | float¶
Superscript x offset.
Corresponds to the OpenType OS/2 table ySuperscriptXOffset field.
- BaseInfo.openTypeOS2SuperscriptYOffset: int | float¶
Superscript y offset.
Corresponds to the OpenType OS/2 table ySuperscriptYOffset field.
- BaseInfo.openTypeOS2StrikeoutSize: int | float¶
Strikeout size.
Corresponds to the OpenType OS/2 table yStrikeoutSize field.
- BaseInfo.openTypeOS2StrikeoutPosition: int | float¶
Strikeout position.
Corresponds to the OpenType OS/2 table yStrikeoutPosition field.
- BaseInfo.openTypeVheaVertTypoAscender: int | float¶
Ascender value.
Corresponds to the OpenType vhea table vertTypoAscender field.
- BaseInfo.openTypeVheaVertTypoDescender: int | float¶
Descender value.
Corresponds to the OpenType vhea table vertTypoDescender field.
- BaseInfo.openTypeVheaVertTypoLineGap: int | float¶
Line gap value.
Corresponds to the OpenType vhea table vertTypoLineGap field.
- BaseInfo.openTypeVheaCaretSlopeRise: int | None¶
Caret slope rise value.
Corresponds to the OpenType vhea table caretSlopeRise field.
- BaseInfo.openTypeVheaCaretSlopeRun: int | None¶
Caret slope run value.
Corresponds to the OpenType vhea table caretSlopeRun field.
- BaseInfo.openTypeVheaCaretOffset: int | float¶
Caret offset value.
Corresponds to the OpenType vhea table caretOffset field.
- BaseInfo.postscriptFontName: str | None¶
Name to be used for the FontName field in Type 1/CFF table.
- BaseInfo.postscriptFullName: str | None¶
Name to be used for the FullName field in Type 1/CFF table.
- BaseInfo.postscriptUniqueID: int | None¶
A unique ID number as defined in the Type 1/CFF specification.
- BaseInfo.postscriptUnderlineThickness: int | float¶
Underline thickness value.
Corresponds to the Type 1/CFF/post table UnderlineThickness field.
- BaseInfo.postscriptUnderlinePosition: int | float¶
Underline position value.
Corresponds to the Type 1/CFF/post table UnderlinePosition field.
- BaseInfo.postscriptIsFixedPitch: bool | None¶
Indicates if the font is monospaced.
A compiler could calculate this automatically, but the designer may wish to override this setting. This corresponds to the Type 1/CFF isFixedPitched field
- BaseInfo.postscriptBlueValues: list[int] | None¶
A list of up to 14 integers or floats specifying the values that should be in the Type 1/CFF BlueValues field.
This list must contain an even number of integers following the rules defined in the Type 1/CFF specification.
- BaseInfo.postscriptOtherBlues: list[int] | None¶
A list of up to 10 integers or floats specifying the values that should be in the Type 1/CFF OtherBlues field.
This list must contain an even number of integers following the rules defined in the Type 1/CFF specification.
- BaseInfo.postscriptFamilyBlues: list[int] | None¶
A list of up to 14 integers or floats specifying the values that should be in the Type 1/CFF FamilyBlues field.
This list must contain an even number of integers following the rules defined in the Type 1/CFF specification.
- BaseInfo.postscriptFamilyOtherBlues: list[int] | None¶
A list of up to 10 integers or floats specifying the values that should be in the Type 1/CFF FamilyOtherBlues field.
This list must contain an even number of integers following the rules defined in the Type 1/CFF specification.
- BaseInfo.postscriptStemSnapH: list[int] | None¶
List of horizontal stems sorted in increasing order.
Up to 12 integers or floats are possible. This corresponds to the Type 1/CFF StemSnapH field.
- BaseInfo.postscriptStemSnapV: list[int] | None¶
List of vertical stems sorted in increasing order.
Up to 12 integers or floats are possible. This corresponds to the Type 1/CFF StemSnapV field.
- BaseInfo.postscriptBlueFuzz: int | float¶
BlueFuzz value.
This corresponds to the Type 1/CFF BlueFuzz field.
- BaseInfo.postscriptBlueShift: int | float¶
BlueShift value.
This corresponds to the Type 1/CFF BlueShift field.
- BaseInfo.postscriptBlueScale: int | float¶
BlueScale value.
This corresponds to the Type 1/CFF BlueScale field.
- BaseInfo.postscriptForceBold: bool | None¶
Indicates how the Type 1/CFF ForceBold field should be set.
- BaseInfo.postscriptWeightName: str | None¶
A string indicating the overall weight of the font.
This corresponds to the Type 1/CFF Weight field. It should be in sync with the openTypeOS2WeightClass value.
Copy¶
- BaseInfo.copy() BaseObjectType¶
Copy the current object into a new object of the same type.
The returned object will not have a parent object.
- Returns:
A new
BaseObjectsubclass instance with the same attributes.
Parents¶
Interpolation¶
- BaseInfo.interpolate(factor: int | float | list[int | float] | tuple[float, float], minInfo: BaseInfo, maxInfo: BaseInfo, round: bool = True, suppressError: bool = True) None[source]¶
Interpolate all possible data in the current info object.
- Parameters:
factor – The interpolation value as a single
intorfloator atupleof twointorfloatvalues representing the factors(x, y).minInfo – The
BaseInfoinstance corresponding to the 0.0 position in the interpolation.maxInfo – The
BaseInfoinstance corresponding to the 1.0 position in the interpolation.round – A
boolindicating whether the result should be rounded to integers. Defaults toTrue.suppressError – A
boolindicating whether to ignore incompatible data or raise an error when such incompatibilities are found. Defaults toTrue.
- Raises:
TypeError – If minInfo or maxInfo are not instances of
BaseInfo.
Example:
>>> info.interpolate(0.5, otherInfo1, otherInfo2) >>> info.interpolate((0.5, 2.0), otherInfo1, otherInfo2, round=False)
Normalization¶
- BaseInfo.round() None[source]¶
Round the following attributes to the nearest integer:
unitsPerEm
descender
xHeight
capHeight
ascender
openTypeHeadLowestRecPPEM
openTypeHheaAscender
openTypeHheaDescender
openTypeHheaLineGap
openTypeHheaCaretSlopeRise
openTypeHheaCaretSlopeRun
openTypeHheaCaretOffset
openTypeOS2WidthClass
openTypeOS2WeightClass
openTypeOS2TypoAscender
openTypeOS2TypoDescender
openTypeOS2TypoLineGap
openTypeOS2WinAscent
openTypeOS2WinDescent
openTypeOS2SubscriptXSize
openTypeOS2SubscriptYSize
openTypeOS2SubscriptXOffset
openTypeOS2SubscriptYOffset
openTypeOS2SuperscriptXSize
openTypeOS2SuperscriptYSize
openTypeOS2SuperscriptXOffset
openTypeOS2SuperscriptYOffset
openTypeOS2StrikeoutSize
openTypeOS2StrikeoutPosition
openTypeVheaVertTypoAscender
openTypeVheaVertTypoDescender
openTypeVheaVertTypoLineGap
openTypeVheaCaretSlopeRise
openTypeVheaCaretSlopeRun
openTypeVheaCaretOffset
postscriptSlantAngle
postscriptUnderlineThickness
postscriptUnderlinePosition
postscriptBlueValues
postscriptOtherBlues
postscriptFamilyBlues
postscriptFamilyOtherBlues
postscriptStemSnapH
postscriptStemSnapV
postscriptBlueFuzz
postscriptBlueShift
postscriptDefaultWidthX
postscriptNominalWidthX
Example:
>>> info.round()
Update¶
Environment¶
- BaseInfo.naked() Any¶
Return the environment’s native object wrapped by the current object.
- Raises:
NotImplementedError – If the method has not been overridden by a subclass.
Example:
>>> loweLevelObj = obj.naked()