6
by jeff
pdf fonts replace, next step:_get_system_fonts |
1 |
# -*- encoding: utf-8 -*-
|
21
by Jeff Wang
remove ids parameter in selection functions |
2 |
# __author__ = jeff@openerp.cn
|
6
by jeff
pdf fonts replace, next step:_get_system_fonts |
3 |
##############################################################################
|
4 |
#
|
|
5 |
# This program is free software: you can redistribute it and/or modify
|
|
6 |
# it under the terms of the GNU Affero General Public License as
|
|
7 |
# published by the Free Software Foundation, either version 3 of the
|
|
8 |
# License, or (at your option) any later version.
|
|
9 |
#
|
|
10 |
# This program is distributed in the hope that it will be useful,
|
|
11 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
12 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
13 |
# GNU Affero General Public License for more details.
|
|
14 |
#
|
|
15 |
# You should have received a copy of the GNU Affero General Public License
|
|
16 |
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
17 |
#
|
|
18 |
##############################################################################
|
|
19 |
from reportlab.lib.styles import ParagraphStyle |
|
10
by Jeff Wang
finished pdf font module |
20 |
from osv import osv |
26
by Tony Gu
make it compatible with V6.1 and lower |
21 |
# make this module compaitible with V6.1 and lower
|
22 |
try: |
|
23 |
import openerp.report.render.rml2pdf.customfonts as cfonts |
|
24 |
except ImportError: |
|
25 |
import report.render.rml2pdf.customfonts as cfonts |
|
26 |
||
10
by Jeff Wang
finished pdf font module |
27 |
|
28 |
class oecn_base_fonts(osv.osv_memory): |
|
29 |
_name = "oecn.base.fonts" |
|
16
by Jeff Wang
Add dropdown list to pdf fornts field |
30 |
_description = "Register system fonts to replace pdf fonts" |
21
by Jeff Wang
remove ids parameter in selection functions |
31 |
def __init__( self, pool, cr ): |
32 |
super(osv.osv_memory, self).__init__(pool, cr) |
|
10
by Jeff Wang
finished pdf font module |
33 |
config_obj = pool.get("ir.config_parameter") |
34 |
map = config_obj.get_param(cr, 1, 'fonts_map') |
|
35 |
if map: |
|
25
by Tony Gu
make CJK wrap a boolean |
36 |
mappings = eval(map) |
37 |
cfonts.CustomTTFonts = mappings['maps'] |
|
38 |
if mappings['wrap']: |
|
39 |
ParagraphStyle.defaults['wordWrap'] = 'CJK' |
|
10
by Jeff Wang
finished pdf font module |
40 |
|
41 |
oecn_base_fonts() |