Use a Font

From Progzoo
Jump to: navigation, search

Some fonts:

/usr/share/fonts/transporth.ttf
/usr/share/fonts/dejavu-lgc/DejaVuLGCSerif.ttf

Read a Font and Use it

alt text Notice:

  • You can create a "true type font" from a ttf.
  • You are opening a file. If that goes wrong then an exceptions will be raised - that's why you need a try block.


[Font] [Default] [Show] [Resize] [History] [Profile]


Look at the characters available


[Font] [Default] [Show] [Resize] [History] [Profile]

Find the width of a string

The FontMetrics class allows you to find out the width of a string when drawn with some font.


[Font] [Default] [Show] [Resize] [History] [Profile]