RGroups

class RGroups()

A Groups object. This object normally created as part of a BaseFont. An orphan Groups object can be created like this

groups = RGroups()

This object behaves like a Python dictionary. Most of the dictionary functionality comes from BaseDict, look at that object for the required environment implementation details.

Groups uses :func:normalizers.normalizeGroupKey to normalize the key of the dict, and :func:normalizers.normalizeGroupValue to normalize the value of the dict.

addObserver(observer, methodName, notification)

Add an observer object. that will receive notification for the given methodName.

asDefcon()

Return the defcon object.

asFontParts()

Return a fontParts object

destroyAllRepresentations(notification=None)

Destroy all representations.

destroyRepresentation(name, **kwargs)

Destroy the stored representation for name and optionally kwargs.

getRepresentation(name, **kwargs)

Get a representation by name.

Optionally arguments could be provided if the representation factory requires arguments.

holdChanges()

Capture changes and bundle them in a single change in a with statement.

performUndo()

Create a undo item and add it the the undo manager.

prepareUndo(undoTitle='')

Save the current state of the object.

releaseHeldChanges()

removeObserver(observer, notification)

Remove an observer object for a notification.

undo(undoTitle='')

Capture the current state of the object and create a undo item in a with statement.

Optionally an undoTitle can be provided.

Inherits from subclass: fontParts.fontshell.groups.RGroups

font

The Groups’ parent BaseFont.

side1KerningGroups

All groups marked as potential side 1 kerning members.

side1Groups = groups.side1KerningGroups

The value will be a dict with string keys representing group names and tuple contaning glyph names.

side2KerningGroups

All groups marked as potential side 1 kerning members.

side2Groups = groups.side2KerningGroups

The value will be a dict with string keys representing group names and tuple contaning glyph names.

copyAttributes

changed()

naked()

asDict()

Return the Groups as a dict.

This is a backwards compatibility method.

clear()

Removes all group information from Groups, resetting the Groups to an empty dictionary.

font.groups.clear()

findGlyph(glyphName)

Returns a list of the group or groups associated with glyphName. glyphName will be an string. If no group is found to contain glyphName an empty list will be returned.

font.groups.findGlyph("A")
["A_accented"]

get(groupName, default=None)

Returns the contents of the named group. groupName is a string, and the returned values will either be type-immutable-list of group contents or None if no group was found.

font.groups["myGroup"]
("A", "B", "C")

It is important to understand that any changes to the returned group contents will not be reflected in the Groups object. If one wants to make a change to the group contents, one should do the following

group = font.groups["myGroup"]
group.remove("A")
font.groups["myGroup"] = group

items()

Returns a list of tuple of each group name and group members. Group names are string and group members are a type-immutable-list of string. The initial list will be unordered.

font.groups.items()
[("myGroup", ("A", "B", "C"), ("myGroup2", ("D", "E", "F"))]

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.

keys()

Returns a list of all the group names in Groups. This list will be unordered.

font.groups.keys()
["myGroup4", "myGroup1", "myGroup5"]

pop(groupName, default=None)

Removes the groupName from the Groups and returns the list of group members. If no group is found, default is returned. groupName is a string. This must return either default or a type-immutable-list of glyph names as string.

font.groups.pop("myGroup")
("A", "B", "C")

remove(groupName)

Removes a group from the Groups. groupName will be a string that is the group name to be removed.

This is a backwards compatibility method.

update(otherGroups)

Updates the Groups based on otherGroups. *otherGroups** is a dict of groups information. If a group from otherGroups is in Groups, the group members will be replaced by the group members from otherGroups. If a group from otherGroups is not in the Groups, it is added to the Groups. If Groups contain a group name that is not in *otherGroups**, it is not changed.

font.groups.update(newGroups)

normalizeGroupValue(value)

Normalizes group value.

  • value must be a list.
  • value items must normalize as glyph names with :func:normalizeGlyphName.
  • Returned value will be a tuple of unencoded unicode strings.

values()

Returns a list of each named group’s members. This will be a list of lists, the group members will be a type-immutable-list of string. The initial list will be unordered.

font.groups.items()
[("A", "B", "C"), ("D", "E", "F")]

copyData(source)

Subclasses may override this method. If so, they should call the super.

__contains__(key)

getParent()

setChanged()

setParent(parent)

Last edited on 29/11/2024