示例#1
0
 def _get_font_info(self):
     family = self.family.get()
     weight = 'b' if self.bold.get() else 'n'
     slant = 'i' if self.italic.get() else 'r'
     size = int(self.size.get())
     font = ui.find_font('%s-%d-%s-%s' % (family, abs(size), weight, slant))
     return font
示例#2
0
    def font(self, fn):
        # trace('font', fn)p
        tbl = self.table
        font = ui.find_font(fn)
        trace('font', font.name, type(font.name))

        tbl.tag_configure('normal', font=font)
        tbl.cell.font = font

        # フォントを調整しただけだとうまく動作しなかったため、スタイルも変えている
        linespace = str(font.metrics()['linespace'])
        #trace('linespace', linespace, type(linespace))
        ui.style.configure(self.style_name, rowheight=linespace)
        tbl.update()
示例#3
0
    def _adjust_size(self, ev):
        if not ev.state & 4 == 4: return
        dir = 1 if ev.delta > 0 or ev.num == 4 else -1

        family = self.family.get()
        weight = 'b' if self.bold.get() else 'n'
        slant = 'i' if self.italic.get() else 'r'
        size = int(self.size.get())

        #print ('%s-%d-%s-%s' % (family,size,weight,slant))
        idx = 0
        try:
            idx = size_list.index(size)
            size = size_list[idx + dir]
            self._set_size(size)
        except:
            self.cc.logger.exception('while resize: %d %d', size, idx)
            return
        #print ('%s-%d-%s-%s' % (family,size,weight,slant))

        new_font = ui.find_font('%s-%d-%s-%s' %
                                (family, abs(size), weight, slant))
        self.sample.cap.config(font=new_font)
示例#4
0
 def font(self):
     tbl = self.table
     fn = tbl.tag_configure('normal')['font']
     # trace('get-font', fn, type(fn))
     fn = ui.find_font(fn)
     return fn
示例#5
0
 def font(self, font):
     if type(font) == str: font = ui.find_font(font)
     buf = self.buf
     buf.config(font=font)
示例#6
0
 def font(self):
     buf = self.buf
     fn = buf.cget('font')
     font = ui.find_font(fn)
     return font