/GUI/Win32/StdFonts.py
Python | 35 lines | 18 code | 6 blank | 11 comment | 0 complexity | 026d57d7052d20f752e2a316270d7182 MD5 | raw file
1#--------------------------------------------------------------------
2#
3# PyGUI - Standard Fonts - Win32
4#
5#--------------------------------------------------------------------
6
7from __future__ import division
8import win32con as wc, win32gui as gui, win32ui as ui
9from Fonts import Font
10from Components import win_none
11
12def _get_win_ppi():
13 dc = win_none.GetDC()
14 ppi = dc.GetDeviceCaps(wc.LOGPIXELSY)
15 win_none.ReleaseDC(dc)
16 return ppi
17
18_win_ppi = _get_win_ppi()
19
20def _win_pts_to_pixels(x):
21 return int(round(x * _win_ppi / 72))
22
23def _win_stock_font(id):
24 h = gui.GetStockObject(id)
25 lf = gui.GetObject(h)
26 return Font._from_win_logfont(lf)
27
28#system_font = _win_stock_font(wc.SYSTEM_FONT)
29#system_font = _win_stock_font(17) # DEFAULT_GUI_FONT
30#system_font = Font._from_win(win_none)
31#system_font = Font("System", 13)
32#system_font = Font("Tahoma", 10)
33#system_font = Font("Tahoma", 11)
34system_font = Font("Tahoma", _win_pts_to_pixels(8))
35application_font = system_font