fontParts.world¶
Note
We still need to decide if we need a world
module or if we should recommend namespace injection.
- fontParts.world.AllFonts(sortOptions=None)[source]¶
Get a list of all open fonts. Optionally, provide a value for
sortOptions
to sort the fonts. Seeworld.FontList.sortBy
for options.from fontParts.world import * fonts = AllFonts() for font in fonts: # do something fonts = AllFonts("magic") for font in fonts: # do something fonts = AllFonts(["familyName", "styleName"]) for font in fonts: # do something
- fontParts.world.NewFont(familyName=None, styleName=None, showInterface=True)[source]¶
Create a new font. familyName will be assigned to
font.info.familyName
and styleName will be assigned tofont.info.styleName
. These are optional and default toNone
. If showInterface isFalse
, the font should be created without graphical interface. The default for showInterface isTrue
.from fontParts.world import * font = NewFont() font = NewFont(familyName="My Family", styleName="My Style") font = NewFont(showInterface=False)
- fontParts.world.OpenFont(path, showInterface=True)[source]¶
Open font located at path. If showInterface is
False
, the font should be opened without graphical interface. The default for showInterface isTrue
.from fontParts.world import * font = OpenFont("/path/to/my/font.ufo") font = OpenFont("/path/to/my/font.ufo", showInterface=False)
- fontParts.world.CurrentLayer()[source]¶
Get the “current” layer from
CurrentGlyph
.from fontParts.world import * layer = CurrentLayer()
- fontParts.world.CurrentGlyph()[source]¶
Get the “current” glyph from
CurrentFont
.from fontParts.world import * glyph = CurrentGlyph()
- fontParts.world.CurrentContours()[source]¶
Get the “currently” selected contours from
CurrentGlyph
.from fontParts.world import * contours = CurrentContours()
This returns an immutable list, even when nothing is selected.
- fontParts.world.CurrentSegments()[source]¶
Get the “currently” selected segments from
CurrentContours
.from fontParts.world import * segments = CurrentSegments()
This returns an immutable list, even when nothing is selected.
- fontParts.world.CurrentPoints()[source]¶
Get the “currently” selected points from
CurrentContours
.from fontParts.world import * points = CurrentPoints()
This returns an immutable list, even when nothing is selected.
- fontParts.world.CurrentComponents()[source]¶
Get the “currently” selected components from
CurrentGlyph
.from fontParts.world import * components = CurrentComponents()
This returns an immutable list, even when nothing is selected.
- fontParts.world.CurrentAnchors()[source]¶
Get the “currently” selected anchors from
CurrentGlyph
.from fontParts.world import * anchors = CurrentAnchors()
This returns an immutable list, even when nothing is selected.
- fontParts.world.CurrentGuidelines()[source]¶
Get the “currently” selected guidelines from
CurrentGlyph
. This will include both font level and glyph level guidelines.from fontParts.world import * guidelines = CurrentGuidelines()
This returns an immutable list, even when nothing is selected.