Exemple #1
0
def getSystemFontPaths():
    u"""Answer the cleaned list of installed font names."""
    fontPaths = []
    for fontName in installedFonts():
        if not fontName.startswith('.'):
            fontPaths.append(getFontPathOfFont(fontName))
    return fontPaths
Exemple #2
0
def getFamilyFontPaths(familyName):
    # Collect the DrawBot names of all available fonts for the named family, that are installed in the system.
    fontPaths = {
    }  # Dictionary, where key is the DrawBot font name, value is the OS path of the font file.
    for fontName in installedFonts(
    ):  # Answers complete list of all installed fonts.
        if familyName in fontName:  # If this is a with with the familyName that we are looking for...
            fontPaths[fontName] = getFontPathOfFont(
                fontName)  # Store the name and find the font path name.
    return fontPaths  #  Answer the dictionary. This is empty, if no Bitcount fonts are installed now.
Exemple #3
0
def findInstalledFonts(fontNamePatterns):
    u"""Answer a list of installed font names that include the fontNamePattern. The pattern
    search is not case sensitive. The pattern can be a string or a list of strings."""
    fontNames = []
    if not isinstance(fontNamePatterns, (list, tuple)):
        fontNamePatterns = [fontNamePatterns]
    for fontNamePattern in fontNamePatterns:
        for fontName in installedFonts():
            if fontNamePattern in fontName:
                fontNames.append(fontName)
    return fontNames
Exemple #4
0
    def __init__(self,
                 styleNamePattern,
                 styleNames=None,
                 pageTitle=None,
                 showGrid=False,
                 showGridColumns=False):
        Publication.__init__(self)
        # Name pattern to match available installed fonts.
        self.styleNamePattern = styleNamePattern
        self.styleNames = []
        for styleName in installedFonts():
            if styleNamePattern in styleName:
                self.styleNames.append(styleName)

        self.pageTitle = pageTitle
        # Identifiers of template text box elements.
        self.titleBoxId = 'titleBoxId'
        self.specimenBoxId = 'specimenBoxId'
        self.infoBoxId = 'infoBoxId'
        # Display flags
        self.showGrid = showGrid
        self.showGridColumns = showGridColumns
Exemple #5
0
#
#    Running led animation, example fpr TypeNetwork site.
#
from drawBot import installedFonts, openTypeFeatures, newPage, fill, rect

bitcountNames = []
for fontName in installedFonts():
    if 'Bitcount' in fontName and not 'Italic' in fontName and 'Mono' in fontName and 'Single' in fontName:
        bitcountNames.append(fontName)

# Size of a pixel in DrawBot units.
PIX = 6

#GRID_COLOR = 0.4, 0.7, 1
FONTS = {
    # Used layers to simulate unsharp pixel leds.
    'PropSingleLight': 'BitcountPropSingle-LightCircle',
    'PropSingleLightItalic': 'BitcountPropSingle-LightCircleItalic',
    'PropSingleBook': 'BitcountPropSingle-BookCircle',
    'PropSingleBookItalic': 'BitcountPropSingle-BookCircleItalic',
    'PropSingleMediumItalic': 'BitcountPropSingle-MediumCircleItalic',
    'PropSingleMedium': 'BitcountPropSingle-MediumCircle',
    'PropSingleBold': 'BitcountPropSingle-BoldCircle',
    'PropSingleBoldItalic': 'BitcountPropSingle-BoldCircleItalic',
    'PropSingle': 'BitcountPropSingle-RegularCircle',
    'PropSingleItalic': 'BitcountPropSingle-RegularCircleItalic',
    # Other font options. Make sure that the spacing types match for layers.
    'GridSingle': 'BitcountGridSingle-RegularCircle',
    'GridDouble': 'BitcountGridDouble-RegularCircle',
    'SingleMediumItalic': 'BitcountMonoSingle-MediumCircleItalic',
    'SingleMedium': 'BitcountMonoSingle-MediumCircle',
Exemple #6
0
 def getInstalledFonts(self):
     u"""Answer the list of font names, currently installed in the application."""
     return installedFonts()