shailesh / pyglet

Automatically exported from code.google.com/p/pyglet
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

expectations and exploration of fonts in Windows #744

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
pyglet default at b85df72ae77a , 2014 05 19

this comes from issue #702

in examples/font_comparison.py there are some comments about bad rendering of 
monospace fonts.

The part relating to tabs was covered in issue #727

Detecting monospace fonts
-------------------------

Theres a bug in pyglet/font/win32query.py where it assumes font has 'ms family' 
== FF_MODERN' implies font is monospace.

Probably this comes for bad wording in the MS documentation, which for  
FF_MODERN in the description of LOGFONT structure tells
   "Fonts with constant stroke width (monospace), with or without serifs.
    Monospace fonts are usually modern.
    Pica, Elite, and CourierNew are examples.
   "

   Stroke width is the 'pen width', not glyph width. It should read

   "Fonts with constant stroke width, with or without serifs.
    Monospace fonts are usually modern, but not all modern are monospace
   "

Detecting if a font will be rendered right in pyglet
----------------------------------------------------

Experimentation with font_comparison.py shows that fonts which comply
    fontentry.vector and fontentry.family != wq.FF_DONTCARE
display fine with pyglet. (see the patched font_comparison.py for context)

I propose a patch that:
  - corrects the monospace detection in win32query
  - store more info in the win32query.FontEntry for better explore the font space
  - font_comparison.py : changes the text sample to better asses monospace correctnes
  - font_comparison.py : exrcises a pyglet_safe filter
  - comments and docstrings updated to clarify all issues of #702

Tested in py 2.6 , 3.3

Attached diff and snapshots

Original issue reported on code.google.com by ccanepacc@gmail.com on 21 May 2014 at 3:00

Attachments:

GoogleCodeExporter commented 9 years ago

Original comment by useboxnet on 21 May 2014 at 3:08

GoogleCodeExporter commented 9 years ago
This issue was closed by revision b5cabd481804.

Original comment by useboxnet on 31 May 2014 at 7:53

GoogleCodeExporter commented 9 years ago
Hi Claudio. This is a nice discovery. Do you mind if I merge this patch into 
https://bitbucket.org/techtonik/fontquery/ ?

Original comment by techtonik@gmail.com on 24 Aug 2014 at 2:13

GoogleCodeExporter commented 9 years ago
@techtonik : go ahead, glad that you liked it.

Original comment by ccanepacc@gmail.com on 24 Aug 2014 at 8:46

GoogleCodeExporter commented 9 years ago
Not only that. I run attached test for checking monospace fonts and found out 
that fonts with @ symbols are not really monospace. It appeared that those are 
vertical fonts for some printing hackery, so I filtered them out in latest 
version 0.6 of fontquery.py

I also fixed font_list() to return sorted non-duplicated list of all fonts.

http://bitbucket.org/techtonik/fontquery

Original comment by techtonik@gmail.com on 25 Aug 2014 at 1:16

Attachments: