Пример #1
0
def collect_info_masters(
        designspace: designspaceLib.DesignSpaceDocument,
        axis_bounds: AxisBounds) -> List[Tuple[Location, FontMathObject]]:
    """Return master Info objects wrapped by MathInfo."""
    locations_and_masters = []
    for source in designspace.sources:
        if source.layerName is not None:
            continue  # No font info in source layers.

        normalized_location = varLib.models.normalizeLocation(
            source.location, axis_bounds)
        locations_and_masters.append(
            (normalized_location, fontMath.MathInfo(source.font.info)))

    return locations_and_masters
Пример #2
0
 def _toMathInfo(self, guidelines=True):
     """
     Subclasses may override this method.
     """
     import fontMath
     # A little trickery is needed here because MathInfo
     # handles font level guidelines. Those are not in this
     # object so we temporarily fake them just enough for
     # MathInfo and then move them back to the proper place.
     self.guidelines = []
     if guidelines:
         for guideline in self.font.guidelines:
             d = dict(x=guideline.x,
                      y=guideline.y,
                      angle=guideline.angle,
                      name=guideline.name,
                      identifier=guideline.identifier,
                      color=guideline.color)
             self.guidelines.append(d)
     info = fontMath.MathInfo(self)
     del self.guidelines
     return info