include freetype module in Pygame 1.9.2

Issue #75 resolved
Lenard Lindstrom created an issue

Ready the //freetype// module for Pygame 1.9.2, and build by default.

The main show-stopper was the incorrect calculation of the text size, leading to a segfault in some cases. Also, //freetype.Font// differs from //font.Font//, hindering the adoption of //freetype//.

As of <<changeset 1d5c94df54d5>> the text size problem was resolved. By <<changeset 02f253be9632>> //freetype.Font// could do a passible imitation of font.Font. In progress: add new array struct interface capable //render_raw_to// method, write a drop-in replacement for //pygame.font//.

Comments (17)

  1. Lenard Lindstrom reporter

    Add top level freetype Python modules ( refs #75 )

    Rename the freetype extension module. Add freetype Python module to combine _freetype and sysfont functionality.

    Add ftfont Python module as a freetype drop-in replacement for pygame.font. The module defines Font, a _freetype.Face subclass that emulates class font.Font.


  2. Lenard Lindstrom reporter

    Basic features are in place. Stable Python api. Can emulate pygame.font through the pygame.ftfont wrapper module. Ready for alpha release trials.


    • Polish the documentation.
  3. Lenard Lindstrom reporter


    • For bitmap fonts, add a Font.get_sizes() method that returns the FT_Bitmap_Size entries in the font's FT_FaceRec structure. This is useful because the freetype calculated font size is not necessarily what was expected: BDF fonts for example.
  4. Lenard Lindstrom reporter

    Add a pygame.freetype module code point unit test (closes Issue #75)

    Complete the pygame.freetype.Font unit tests by confirming the correct glyphs were rendered for two unicode code points.

    → <<cset 90f8019b31d2>>

  5. Jason Marshall

    Will we totally remove SDL_ttf? We still have this code in

    if 'PYGAME_FREETYPE' in os.environ:
            import pygame.ftfont as font
            sys.modules['pygame.font'] = font
        except (ImportError,IOError): pass
        import pygame.font
        import pygame.sysfont
        pygame.font.SysFont = pygame.sysfont.SysFont
        pygame.font.get_fonts = pygame.sysfont.get_fonts
        pygame.font.match_font = pygame.sysfont.match_font
    except (ImportError,IOError):font=MissingModule("font", geterror(), 0)
  6. Lenard Lindstrom reporter

    I intend to leave the pygame.font extension module in Pygame 1.9.2, and let it build by default. I expect it will disappear in Pygame 2.0, though.

  7. Log in to comment