예제 #1
0
 def find(self, pair, default=0):
     """
     This will find the value for **pair** even if
     **pair** is not specifically defined. For example:
     You have a group named `public.kern1.A` with
     the contents `["A", "Aacute"]` and you have a
     group named `public.kern2.C` with the contents
     `["C", "Ccedilla"]`. The only defined kerning is
     `("public.kern1.A", public.kern2.C) = 100`.
     If you use this method to find the value for
     `("A", "Ccedilla")` you will get `100`.
     """
     from defcon.errors import DefconError
     font = self.font
     if font is None:
         raise DefconError("The find method requires a parent font.")
     glyphToFirstGroup = font.groups.getRepresentation(
         "defcon.groups.kerningGlyphToSide1Group")
     glyphToSecondGroup = font.groups.getRepresentation(
         "defcon.groups.kerningGlyphToSide2Group")
     return lookupKerningValue(pair,
                               self,
                               font.groups,
                               fallback=default,
                               glyphToFirstGroup=glyphToFirstGroup,
                               glyphToSecondGroup=glyphToSecondGroup)
예제 #2
0
 def _find(self, pair, default=None):
     """
     This is the environment implementation of
     :attr:`BaseKerning.find`. This must return an
     :ref:`type-int-float` or `default`.
     """
     from fontTools.ufoLib.kerning import lookupKerningValue
     font = self.font
     groups = font.groups
     return lookupKerningValue(pair, self, groups, fallback=default)
예제 #3
0
파일: kerning.py 프로젝트: moyogo/fontparts
 def _find(self, pair, default=None):
     """
     This is the environment implementation of
     :attr:`BaseKerning.find`. This must return an
     :ref:`type-int-float` or `default`.
     """
     from fontTools.ufoLib.kerning import lookupKerningValue
     font = self.font
     groups = font.groups
     return lookupKerningValue(pair, self, groups, fallback=default)
예제 #4
0
 def find(self, pair, default=0):
     """
     This will find the value for **pair** even if
     **pair** is not specifically defined. For example:
     You have a group named `public.kern1.A` with
     the contents `["A", "Aacute"]` and you have a
     group named `public.kern2.C` with the contents
     `["C", "Ccedilla"]`. The only defined kerning is
     `("public.kern1.A", public.kern2.C) = 100`.
     If you use this method to find the value for
     `("A", "Ccedilla")` you will get `100`.
     """
     from defcon.errors import DefconError
     font = self.font
     if font is None:
         raise DefconError("The find method requires a parent font.")
     glyphToFirstGroup = font.groups.getRepresentation("defcon.groups.kerningGlyphToSide1Group")
     glyphToSecondGroup = font.groups.getRepresentation("defcon.groups.kerningGlyphToSide2Group")
     return lookupKerningValue(pair, self, font.groups, fallback=default, glyphToFirstGroup=glyphToFirstGroup, glyphToSecondGroup=glyphToSecondGroup)