Esempio n. 1
0
 def _gdi_width(self, s):
     dc = win_none.GetDC()
     dc.SelectObject(self._win_font)
     #w, h = dc.GetTextExtent(s)
     w, h = gui.GetTextExtentPoint32(dc.GetSafeHdc(), s)
     win_none.ReleaseDC(dc)
     return w
Esempio n. 2
0
 def _gdip_width(self, s):
     dc = win_none.GetDC()
     dc.SelectObject(self._win_font)
     g = gdip.Graphics.from_hdc(dc.GetSafeHdc())
     w = g.MeasureStringWidth(s, self._win_gdip_font)
     win_none.ReleaseDC(dc)
     return w
Esempio n. 3
0
    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)
Esempio n. 4
0
	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)
Esempio n. 5
0
	def _width(self, s):
		dc = win_none.GetDC()
		dc.SelectObject(self._win_font)
		w, h = dc.GetTextExtent(s)
		win_none.ReleaseDC(dc)
		return w