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 the value of the dict.

addObserver(observer, methodName, notification)

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

getRepresentation(name, **kwargs)

Get a representation by name.

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


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


Save the current state of the object.

removeObserver(observer, notification)

Remove an observer object for a notification.

Inherits from subclass: fontParts.fontshell.groups.RGroups


The Groups’ parent BaseFont.




Return the Groups as a dict.

This is a backwards compatibility method.


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

>>> font.groups.clear()


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")

get(groupName, default=None)

Returns the contents of the named group. groupName is a string, and the returned values will either be 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


Returns a list of tuple of each group name and group members. Group names are string and group members are a list of string. The intial list will be unordered.

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


Normalizes group key.

  • value must be a string.
  • value must be least one character long.
  • Returned value will be an unencoded unicode string.


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 list of glyph names as string.

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


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.


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)


Normalizes group value.

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


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

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


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


changed(*args, **kwargs)

Tell the environment that something has changed in the object. The behavior of this method will vary from environment to environment.

>>> obj.changed()




Last edited on 15/05/2018