PageRenderTime 36ms CodeModel.GetById 10ms RepoModel.GetById 1ms app.codeStats 0ms

/GUI/Win32/StdFonts.py

https://bitbucket.org/alsh/pygui-mirror
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. from __future__ import division
  7. import win32con as wc, win32gui as gui, win32ui as ui
  8. from Fonts import Font
  9. from Components import win_none
  10. def _get_win_ppi():
  11. dc = win_none.GetDC()
  12. ppi = dc.GetDeviceCaps(wc.LOGPIXELSY)
  13. win_none.ReleaseDC(dc)
  14. return ppi
  15. _win_ppi = _get_win_ppi()
  16. def _win_pts_to_pixels(x):
  17. return int(round(x * _win_ppi / 72))
  18. def _win_stock_font(id):
  19. h = gui.GetStockObject(id)
  20. lf = gui.GetObject(h)
  21. return Font._from_win_logfont(lf)
  22. #system_font = _win_stock_font(wc.SYSTEM_FONT)
  23. #system_font = _win_stock_font(17) # DEFAULT_GUI_FONT
  24. #system_font = Font._from_win(win_none)
  25. #system_font = Font("System", 13)
  26. #system_font = Font("Tahoma", 10)
  27. #system_font = Font("Tahoma", 11)
  28. system_font = Font("Tahoma", _win_pts_to_pixels(8))
  29. application_font = system_font