コード例 #1
0
ファイル: Font.py プロジェクト: tomihasa/pygui
    def _win_update_metrics(self):
        dc = win_none.GetDC()
        dc.SelectObject(self._win_font)
        met = dc.GetTextMetrics()
        self._ascent = met['tmAscent']
        self._descent = met['tmDescent']
        self._internal_leading = met['tmInternalLeading']
        self._leading = met['tmExternalLeading']
        self._win_overhang = met['tmOverhang']
        #print "Font: tmOverhang =", self._win_overhang ###

        logfont = gui.LOGFONT()
        logfont.lfHeight = win_height_sign * int(round(self._size))
        logfont.lfWidth = wc.FW_BOLD if 'bold' in self._style else wc.FW_NORMAL
        logfont.lfEscapement = 0
        logfont.lfOrientation = 0
        logfont.lfWeight = 0
        logfont.lfItalic = 1 if 'italic' in self._style else 0
        logfont.lfUnderline = 1 if 'underline' in self._style else 0
        logfont.lfStrikeOut = 1 if 'strikeout' in self._style else 0
        logfont.lfCharSet = wc.DEFAULT_CHARSET
        logfont.lfOutPrecision = 0
        logfont.lfClipPrecision = 0
        logfont.lfQuality = wc.CLEARTYPE_QUALITY
        logfont.lfPitchAndFamily = 0
        logfont.lfFaceName = self._win_family

        self._win_gdip_font = gdip.Font(self._win_family, self._size,
                                        self._style)
        #self._win_gdip_font = gdip.Font.from_logfont(dc.GetSafeHdc(), logfont)
        #self._win_gdip_font = gdip.Font.from_hdc(dc.GetSafeHdc())
        win_none.ReleaseDC(dc)
コード例 #2
0
ファイル: Font.py プロジェクト: mnabeelp/PyGUI
	def _win_update_metrics(self):
		dc = win_none.GetDC()
		dc.SelectObject(self._win_font)
		met = dc.GetTextMetrics()
		self._ascent = met['tmAscent']
		self._descent = met['tmDescent']
		self._internal_leading = met['tmInternalLeading']
		self._leading = met['tmExternalLeading']
		self._win_overhang = met['tmOverhang']
		#print "Font: tmOverhang =", self._win_overhang ###
		win_none.ReleaseDC(dc)
		self._win_gdip_font = gdip.Font(self._win_family, self._size, self._style)