1. anatoly techtonik
  2. fontquery

Commits

anatoly techtonik  committed 9ca364f

Improve docs in comments

  • Participants
  • Parent commits ca0cdda
  • Branches default

Comments (0)

Files changed (1)

File fontquery.py

View file
  • Ignore whitespace
 """
 Query system Windows fonts from Python.
 
-The task: Get monospace font for the application in the order of
+The task: Get monospace font for an application in the order of
 preference.
 
-The problem: Windows only allows to get the list of font names and
-their characteristics. It doesn't allow to list font files. From
-two different files with the same font name you'll get only one.
-Windows also doesn't allow getting only monospace fonts. You need
+The problem: Font ID in Windows is its name. Windows doesn't provide
+any information about filenames they contained in. From two different
+files with the same font name you'll can get only one.
+
+[ ] Windows also doesn't allow getting only monospace fonts. You need
 to query all available fonts and filter them yourself.
 
 Use cases:
       # FF_SWISS        - proportional without serifs
     ('lfFaceName', TCHAR*32)]
       # typeface name of the font - null-terminated string
-      # [ ] TODO check size constraint / string conversion
-
 
 class FONTSIGNATURE(ctypes.Structure):
   # supported code pages and Unicode subranges for the font
     ('ntmFontSig', FONTSIGNATURE)]
 
 
-# callback function/filter for EnumFontFamiliesExA
+# type for a function that is called by the system for
+# each font during execution of EnumFontFamiliesEx
 FONTENUMPROC = ctypes.WINFUNCTYPE(
   ctypes.c_int,  # return non-0 to continue enumeration, 0 to stop
   ctypes.POINTER(LOGFONT), 
 
 fontenumproc = FONTENUMPROC(enumerator)
 
+# --- /define
+
+
+# --- prepare and call EnumFontFamiliesEx
 
 # 1. Get device context of the entire screen
 
 
 # x.1 Get pixels per inch using GetDeviceCaps() or ...
 
+
+# y. Font object with several layers of info
+
+# Font object should contains normalized font information. This
+# information is split according to usage. For example, level 0 property
+# is font id - its name. Level 1 can be information about loaded font
+# characters - in pyglet it could be cached/used glyphs and video memory
+# taken by those glyphs.
+
+# [ ] (pyglet) investigate if it is possible to get video memory size
+#              occupied by the font glyphs
+
+# [ ] (pyglet) investigate if it is possible to unload font from video
+#              memory if its unused