예제 #1
0
    def get_font(self, name, size, color, alpha=1.0):
        color = self.get_color(color)
        op = int(alpha * 255)

        name = font_asst.resolve_alias(name, name)
        font = get_cached_font(name, size, color, op)
        return font
예제 #2
0
파일: AggHelp.py 프로젝트: ejeschke/ginga
    def get_font(self, name, size, color, alpha=1.0):
        color = self.get_color(color)
        op = int(alpha * 255)

        name = font_asst.resolve_alias(name, name)
        font = get_cached_font(name, size, color, op)
        return font
예제 #3
0
    def build_gui(self, container):
        readout = Readout.Readout(-1, 24)

        # NOTE: Special hack for certain platforms, otherwise the font
        # on the readout is too small
        macos_ver = platform.mac_ver()[0]

        font_size = self.settings.get('font_size', None)
        if font_size is None:
            if len(macos_ver) > 0:
                # Mac OS X
                font_size = 16
            elif toolkit.get_family().startswith('gtk'):
                # Gtk
                font_size = 11
            else:
                font_size = 11

        font_name = self.settings.get('font_name', None)
        if font_name is None:
            font_name = font_asst.resolve_alias('fixed', 'Courier')
            if len(macos_ver) > 0:
                # Mac OS X
                font_name = 'monaco'

        readout.set_font(font_name, font_size)

        self.readout = readout
        rw = self.readout.get_widget()

        container.add_widget(rw, stretch=0)
        self.gui_up = True
예제 #4
0
 def set_font_from_shape(self, shape):
     if hasattr(shape, 'font'):
         if hasattr(shape, 'fontsize') and shape.fontsize is not None:
             fontsize = shape.fontsize
         else:
             fontsize = shape.scale_font(self.viewer)
         fontname = font_asst.resolve_alias(shape.font, shape.font)
         self.cr.select_font_face(fontname)
         self.cr.set_font_size(fontsize)
예제 #5
0
 def set_font_from_shape(self, shape):
     if hasattr(shape, 'font'):
         if hasattr(shape, 'fontsize') and shape.fontsize is not None:
             fontsize = shape.fontsize
         else:
             fontsize = shape.scale_font(self.viewer)
         fontname = font_asst.resolve_alias(shape.font, shape.font)
         self.cr.select_font_face(fontname)
         fontsize = self.scale_fontsize(fontsize)
         self.cr.set_font_size(fontsize)
예제 #6
0
 def __init__(self, fontname='Roboto', fontsize=12.0, color='black',
              linewidth=1, alpha=1.0):
     fontname = font_asst.resolve_alias(fontname, fontname)
     self.fontname = fontname
     self.fontsize = int(fontsize)
     self.color = color
     self.linewidth = linewidth
     # scale relative to a 12pt font
     self.scale = fontsize / 12.0
     self.alpha = alpha
     # TODO: currently there is only support for some simple built-in
     # fonts.  What kind of fonts/lookup can we use for this?
     self.font = get_cached_font(self.fontname, self.fontsize)
예제 #7
0
파일: CvHelp.py 프로젝트: pawel-kw/ginga
 def __init__(self, fontname='ariel', fontsize=12.0, color='black',
              linewidth=1, alpha=1.0):
     fontname = font_asst.resolve_alias(fontname, fontname)
     self.fontname = fontname
     self.fontsize = fontsize
     self.color = color
     self.linewidth = linewidth
     # scale relative to a 12pt font
     self.scale = fontsize / 12.0
     self.alpha = alpha
     # TODO: currently there is only support for some simple built-in
     # fonts.  What kind of fonts/lookup can we use for this?
     self.font = cv2.FONT_HERSHEY_SIMPLEX
예제 #8
0
파일: CvHelp.py 프로젝트: mfwofford/ginga
 def __init__(self, fontname='ariel', fontsize=12.0, color='black',
              linewidth=1, alpha=1.0):
     fontname = font_asst.resolve_alias(fontname, fontname)
     self.fontname = fontname
     self.fontsize = fontsize
     self.color = color
     # text is not filled unless linewidth value is negative
     self.linewidth = -linewidth
     # fonts are scaled by specifying a height--this should be
     # related to the fontsize more accurately here
     self.scale = int(round(fontsize * 1.5))
     self.alpha = alpha
     # note: opencv scales the fonts dynamically, so always
     # specify a 0 for caching
     self.font = get_cached_font(self.fontname, 0)
예제 #9
0
    def _build_readout(self):
        readout = Readout.Readout(-1, 24)

        font_name = font_asst.resolve_alias('fixed', 'Courier')

        # NOTE: Special hack for certain platforms, otherwise the font
        # on the readout is too small
        macos_ver = platform.mac_ver()[0]
        if len(macos_ver) > 0:
            # Mac OS X
            readout.set_font('monaco', 16)
        elif toolkit.get_family().startswith('gtk'):
            # Gtk
            readout.set_font(font_name, 14)
        else:
            readout.set_font(font_name, 11)
        return readout
예제 #10
0
 def __init__(self,
              fontname='Roboto',
              fontsize=12.0,
              color='black',
              linewidth=1,
              alpha=1.0):
     fontname = font_asst.resolve_alias(fontname, fontname)
     self.fontname = fontname
     self.fontsize = int(fontsize)
     self.color = color
     self.linewidth = linewidth
     # scale relative to a 12pt font
     self.scale = fontsize / 12.0
     self.alpha = alpha
     # TODO: currently there is only support for some simple built-in
     # fonts.  What kind of fonts/lookup can we use for this?
     self.font = get_cached_font(self.fontname, self.fontsize)
예제 #11
0
def get_font(font_family, point_size):
    font_family = font_asst.resolve_alias(font_family, font_family)
    font = QFont(font_family, point_size)
    return font
예제 #12
0
def get_font(font_family, point_size):
    font_family = font_asst.resolve_alias(font_family, font_family)
    font = Pango.FontDescription('%s %d' % (font_family, point_size))
    return font
예제 #13
0
 def set_font(self, fontname, fontsize, color='black', alpha=1.0):
     fontname = font_asst.resolve_alias(fontname, fontname)
     self.cr.select_font_face(fontname)
     fontsize = self.scale_fontsize(fontsize)
     self.cr.set_font_size(fontsize)
     self._set_color(color, alpha=alpha)
예제 #14
0
 def set_font(self, fontname, fontsize, color='black', alpha=1.0):
     fontname = font_asst.resolve_alias(fontname, fontname)
     fontsize = self.scale_fontsize(fontsize)
예제 #15
0
 def set_font(self, fontname, fontsize, color='black', alpha=1.0):
     fontname = font_asst.resolve_alias(fontname, fontname)
     self.cr.select_font_face(fontname)
     fontsize = self.scale_fontsize(fontsize)
     self.cr.set_font_size(fontsize)
     self._set_color(color, alpha=alpha)
예제 #16
0
 def __init__(self, fontname='sans', fontsize=12.0, color='black'):
     fontname = font_asst.resolve_alias(fontname, fontname)
     self.fontname = fontname
     self.fontsize = fontsize
     self.color = color
예제 #17
0
def get_font(font_family, point_size):
    font_family = font_asst.resolve_alias(font_family, font_family)
    font = QFont(font_family, point_size)
    return font
예제 #18
0
def get_font(font_family, point_size):
    font_family = font_asst.resolve_alias(font_family, font_family)
    font = pango.FontDescription('%s %d' % (font_family, point_size))
    return font
예제 #19
0
def get_font(font_family, point_size):
    font_family = font_asst.resolve_alias(font_family, font_family)
    font_str = '%s %d' % (font_family, point_size)
    return font_info(font_str)
예제 #20
0
def get_font(font_family, point_size):
    font_family = font_asst.resolve_alias(font_family, font_family)
    font_str = '%s %d' % (font_family, point_size)
    return font_info(font_str)