mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-06-23 15:30:45 -04:00
Made the default LRF fonts available to libprs500
This commit is contained in:
parent
3736be58bc
commit
fbbf71ffc4
35
src/libprs500/ebooks/lrf/fonts/__init__.py
Normal file
35
src/libprs500/ebooks/lrf/fonts/__init__.py
Normal file
@ -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)
|
||||
|
BIN
src/libprs500/ebooks/lrf/fonts/tt0003m_.ttf
Normal file
BIN
src/libprs500/ebooks/lrf/fonts/tt0003m_.ttf
Normal file
Binary file not shown.
BIN
src/libprs500/ebooks/lrf/fonts/tt0011m_.ttf
Normal file
BIN
src/libprs500/ebooks/lrf/fonts/tt0011m_.ttf
Normal file
Binary file not shown.
BIN
src/libprs500/ebooks/lrf/fonts/tt0419m_.ttf
Normal file
BIN
src/libprs500/ebooks/lrf/fonts/tt0419m_.ttf
Normal file
Binary file not shown.
@ -17,7 +17,7 @@ __docformat__ = "epytext"
|
||||
__author__ = "Kovid Goyal <kovid@kovidgoyal.net>"
|
||||
APP_TITLE = "libprs500"
|
||||
|
||||
import pkg_resources, sys, os, re, StringIO, traceback
|
||||
import sys, os, re, StringIO, traceback
|
||||
|
||||
error_dialog = None
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user