diff --git a/src/libprs500/ebooks/lrf/fonts/__init__.py b/src/libprs500/ebooks/lrf/fonts/__init__.py new file mode 100644 index 0000000000..cb9282d2a5 --- /dev/null +++ b/src/libprs500/ebooks/lrf/fonts/__init__.py @@ -0,0 +1,35 @@ +## Copyright (C) 2006 Kovid Goyal kovid@kovidgoyal.net +## This program is free software; you can redistribute it and/or modify +## it under the terms of the GNU General Public License as published by +## the Free Software Foundation; either version 2 of the License, or +## (at your option) any later version. +## +## This program is distributed in the hope that it will be useful, +## but WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +## GNU General Public License for more details. +## +## You should have received a copy of the GNU General Public License along +## with this program; if not, write to the Free Software Foundation, Inc., +## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +import pkg_resources +from PIL import ImageFont +''' +Default fonts used in the PRS500 +''' +FONT_MAP = { + 'Swis721 BT Roman' : 'tt0003m_.ttf', + 'Dutch801 Rm BT Roman' : 'tt0011m_.ttf', + 'Courier10 BT Roman' : 'tt0419m_.ttf' + } + +def get_font(name, size, encoding='unic'): + ''' + Get an ImageFont object by name. + @param size: Size in pts + @param encoding: Font encoding to use. E.g. 'unic', 'symbol', 'ADOB', 'ADBE', 'aprm' + ''' + if name in FONT_MAP.keys(): + path = pkg_resources.resource_filename('libprs500.ebooks.lrf.fonts', FONT_MAP[name]) + return ImageFont.truetype(path, size, encoding=encoding) + \ No newline at end of file diff --git a/src/libprs500/ebooks/lrf/fonts/tt0003m_.ttf b/src/libprs500/ebooks/lrf/fonts/tt0003m_.ttf new file mode 100644 index 0000000000..a83d81d2cb Binary files /dev/null and b/src/libprs500/ebooks/lrf/fonts/tt0003m_.ttf differ diff --git a/src/libprs500/ebooks/lrf/fonts/tt0011m_.ttf b/src/libprs500/ebooks/lrf/fonts/tt0011m_.ttf new file mode 100644 index 0000000000..e1b4563473 Binary files /dev/null and b/src/libprs500/ebooks/lrf/fonts/tt0011m_.ttf differ diff --git a/src/libprs500/ebooks/lrf/fonts/tt0419m_.ttf b/src/libprs500/ebooks/lrf/fonts/tt0419m_.ttf new file mode 100644 index 0000000000..8d9968e736 Binary files /dev/null and b/src/libprs500/ebooks/lrf/fonts/tt0419m_.ttf differ diff --git a/src/libprs500/gui/__init__.py b/src/libprs500/gui/__init__.py index 7e33606b61..db989b0ec5 100644 --- a/src/libprs500/gui/__init__.py +++ b/src/libprs500/gui/__init__.py @@ -17,7 +17,7 @@ __docformat__ = "epytext" __author__ = "Kovid Goyal " APP_TITLE = "libprs500" -import pkg_resources, sys, os, re, StringIO, traceback +import sys, os, re, StringIO, traceback error_dialog = None