Beispiel #1
0
    def table_populate(self, mode):
        def check_type(layer):
            if layer.isMaskLayer: return 'Mask'
            if layer.isMasterLayer: return 'Master'
            if layer.isService: return 'Service'

        if fl6.CurrentFont() is not None and fl6.CurrentGlyph() is not None:
            active_font = pFont()
            active_glyph = pGlyph()

            if mode == 0:
                init_data = [(layer.name, check_type(layer))
                             for layer in active_glyph.layers()
                             if '#' not in layer.name]
            else:
                init_data = [(master, 'Master')
                             for master in active_font.pMasters.names]

            table_dict = {
                n: OrderedDict(zip(column_names, data))
                for n, data in enumerate(init_data)
            }
            self.tab_masters.clear()
            self.tab_masters.setTable(table_dict,
                                      color_dict=color_dict,
                                      enable_check=True)
Beispiel #2
0
    def refresh(self, master_mode=False):
        def check_type(layer):
            if layer.isMaskLayer: return 'Mask'
            if layer.isMasterLayer: return 'Master'
            if layer.isService: return 'Service'

        if fl6.CurrentFont() is not None and fl6.CurrentGlyph() is not None:
            self.glyph = eGlyph()
            self.edt_glyphName.setText(self.glyph.name)

            if master_mode:
                init_data = [(layer, 'Master', layer.wireframeColor)
                             for layer in self.glyph.layers()
                             if layer.isMasterLayer]
            else:
                init_data = [
                    (layer.name, check_type(layer), layer.wireframeColor)
                    for layer in self.glyph.layers() if '#' not in layer.name
                ]

            table_dict = {
                n: OrderedDict(zip(column_names, data))
                for n, data in enumerate(init_data)
            }

            self.lst_layers.setTable(init_table_dict)
            self.lst_layers.setTable(table_dict)
Beispiel #3
0
    def __init__(self, font=None):

        if font is not None:
            if isinstance(font, fgt.fgFont):
                self.fg = font
                self.fl = fl6.flPackage(font)

            elif isinstance(font, basestring):
                fl6.flItems.requestLoadingFont(font)
                self.fg = fl6.CurrentFont()
                self.fl = fl6.flPackage(fl6.CurrentFont())

        else:
            self.fg = fl6.CurrentFont()
            self.fl = fl6.flPackage(fl6.CurrentFont())

        # - Special
        self.__altMarks = {'liga': '_', 'alt': '.', 'hide': '__'}
        self.__diactiricalMarks = [
            'grave', 'dieresis', 'macron', 'acute', 'cedilla', 'uni02BC',
            'circumflex', 'caron', 'breve', 'dotaccent', 'ring', 'ogonek',
            'tilde', 'hungarumlaut', 'caroncomma', 'commaaccent', 'cyrbreve'
        ]  # 'dotlessi', 'dotlessj'
        self.__specialGlyphs = ['.notdef', 'CR', 'NULL', 'space', '.NOTDEF']
        self.__kern_group_type = {
            'L': 'KernLeft',
            'R': 'KernRight',
            'B': 'KernBothSide'
        }
        self.__kern_pair_mode = ('glyphMode', 'groupMode')

        # -- Design space related
        self.pMastersContainer = pMasters(self)
        self.pDesignSpace = pDesignSpace(self)
        self.pMasters = self.pMastersContainer
        self.pSpace = self.pDesignSpace
Beispiel #4
0
	def __init__(self, *argv, **kwargs):

		if len(argv) == 0:
			self.host = fl6.flGlyph(fl6.CurrentGlyph(), fl6.CurrentFont())
		
		elif len(argv) == 1 and isinstance(argv[0], fl6.flGlyph):
			font, glyph = argv[0].fgPackage, argv[0].fgPackage[argv[0].name]
			self.host = fl6.flGlyph(glyph, font)

		elif len(argv) == 2 and isinstance(argv[0], fgt.fgFont) and isinstance(argv[1], fgt.fgGlyph):
			font, glyph = argv
			self.host = fl6.flGlyph(glyph, font)

		elif len(argv) == 2 and isinstance(argv[1], fgt.fgFont) and isinstance(argv[0], fgt.fgGlyph):
			glyph, font = argv
			self.host = fl6.flGlyph(glyph, font)

		super(trGlyph, self).__init__(self.host.layers, default_factory=trLayer, proxy=True, **kwargs)
Beispiel #5
0
def openFont(file_path):
	''' Loads Font file from path (str) and returns opened fgFont object'''
	fl6.flItems.requestLoadingFont(file_path)
	return fl6.CurrentFont()
Beispiel #6
0
import fontlab
import fontgate

font = fontlab.CurrentFont()

print font.info.postscriptIsFixedPitch
print font.info.openTypeOS2Panose

font.info.postscriptIsFixedPitch = True
font.info.openTypeOS2Panose = [2, 0, 0, 9, 0, 0, 0, 0, 0, 0]

print font.info.postscriptIsFixedPitch
print font.info.openTypeOS2Panose