Oecn_base_fonts 使用说明(解决v.7.0,v6.1,V6.0.x的PDF中文字体方框问题,支持CJK语言)
-
重启也没有用 要把另一个addon—— base_report_cn 一起装上才行。 两个addons 缺一不可。
[/quote]
不是的,这是两个不同的模块,base_report_cn是以前的版本,里面已经包含字体(有bug就是表头的字体不替换)。而oecn_base_font是使用你系统的字体(更灵活)。
[/quote]
是,这是两个不同的模块。但是我的这台电脑很奇怪,装了oecn_base_font就是死活不工作。非要把base_report_cn也装上才行。而且,只装base_report_cn也不行,一定要把两个都装了才行。也不知道是不是W7的问题。我的是英文版W7。
就像我以前遇到的备份问题,修改路径也没用,只好把PostgreSQL整个复制到server目录下才能做备份。很奇怪的电脑 -
[attachimg=2][attachimg=2][quote author=Joshua link=topic=2791.msg11503#msg11503 date=1341650105]
你是英文版Win7 ,但是应该系统也会有中文字体吧,我猜是你配置替换的字体不是中文?要不你把的配置替换的字体截图出来我们看看。
[/quote]
[size=18pt]我用的字体肯定是中文 微软雅黑 特意新建了一个数据库 从头配置了一回 依旧是黑框[/size]
[attachimg=1] -
3.CJK warp是中文字体换行处理,默认勾选。Original Fonts是系统里面需要用到的字体(一共有6种,一般需要全部替换掉),Replace Fonts 是你想替换成的字体(取自于OpenERP Server的系统内)。
进行到这步时报告以下错误。
=================错误报告=====================
您的 OpenERP 版本没有包含支持。支持与维护服务在此处可以购买:模型”%s“的字段.
OpenERP Server Error
Client Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/openerp-6.1_20120710_233320-py2.7.egg/openerp/addons/web/common/http.py", line 180, in dispatch
response["result"] = method(controller, self, **self.params)
File "/usr/local/lib/python2.7/dist-packages/openerp-6.1_20120710_233320-py2.7.egg/openerp/addons/web/controllers/main.py", line 1204, in load
return self.fields_view_get(req, model, view_id, view_type, toolbar=toolbar)
File "/usr/local/lib/python2.7/dist-packages/openerp-6.1_20120710_233320-py2.7.egg/openerp/addons/web/controllers/main.py", line 1086, in fields_view_get
fvg = Model.fields_view_get(view_id, view_type, context, toolbar, submenu)
File "/usr/local/lib/python2.7/dist-packages/openerp-6.1_20120710_233320-py2.7.egg/openerp/addons/web/common/openerplib/main.py", line 250, in proxy
args, kw)
File "/usr/local/lib/python2.7/dist-packages/openerp-6.1_20120710_233320-py2.7.egg/openerp/addons/web/common/openerplib/main.py", line 117, in proxy
result = self.connector.send(self.service_name, method, *args)
File "/usr/local/lib/python2.7/dist-packages/openerp-6.1_20120710_233320-py2.7.egg/openerp/addons/web/common/http.py", line 611, in send
raise fault
Server Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/openerp-6.1_20120710_233320-py2.7.egg/openerp/addons/web/common/http.py", line 592, in send
result = openerp.netsvc.dispatch_rpc(service_name, method, args)
File "/usr/local/lib/python2.7/dist-packages/openerp-6.1_20120710_233320-py2.7.egg/openerp/netsvc.py", line 360, in dispatch_rpc
result = ExportService.getService(service_name).dispatch(method, params)
File "/usr/local/lib/python2.7/dist-packages/openerp-6.1_20120710_233320-py2.7.egg/openerp/service/web_services.py", line 586, in dispatch
res = fn(db, uid, *params)
File "/usr/local/lib/python2.7/dist-packages/openerp-6.1_20120710_233320-py2.7.egg/openerp/osv/osv.py", line 167, in execute_kw
return self.execute(db, uid, obj, method, *args, **kw or {})
File "/usr/local/lib/python2.7/dist-packages/openerp-6.1_20120710_233320-py2.7.egg/openerp/osv/osv.py", line 121, in wrapper
return f(self, dbname, *args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/openerp-6.1_20120710_233320-py2.7.egg/openerp/osv/osv.py", line 176, in execute
res = self.execute_cr(cr, uid, obj, method, *args, **kw)
File "/usr/local/lib/python2.7/dist-packages/openerp-6.1_20120710_233320-py2.7.egg/openerp/osv/osv.py", line 164, in execute_cr
return getattr(object, method)(cr, uid, *args, **kw)
File "/usr/local/lib/python2.7/dist-packages/openerp-6.1_20120710_233320-py2.7.egg/openerp/osv/orm.py", line 2153, in fields_view_get
xarch, xfields = self.__view_look_dom_arch(cr, user, result['arch'], view_id, context=ctx)
File "/usr/local/lib/python2.7/dist-packages/openerp-6.1_20120710_233320-py2.7.egg/openerp/osv/orm.py", line 1793, in __view_look_dom_arch
fields_def = self.__view_look_dom(cr, user, node, view_id, False, fields, context=context)
File "/usr/local/lib/python2.7/dist-packages/openerp-6.1_20120710_233320-py2.7.egg/openerp/osv/orm.py", line 1742, in __view_look_dom
fields.update(self.__view_look_dom(cr, user, f, view_id, in_tree_view, model_fields, context))
File "/usr/local/lib/python2.7/dist-packages/openerp-6.1_20120710_233320-py2.7.egg/openerp/osv/orm.py", line 1742, in __view_look_dom
fields.update(self.__view_look_dom(cr, user, f, view_id, in_tree_view, model_fields, context))
File "/usr/local/lib/python2.7/dist-packages/openerp-6.1_20120710_233320-py2.7.egg/openerp/osv/orm.py", line 1742, in __view_look_dom
fields.update(self.__view_look_dom(cr, user, f, view_id, in_tree_view, model_fields, context))
File "/usr/local/lib/python2.7/dist-packages/openerp-6.1_20120710_233320-py2.7.egg/openerp/osv/orm.py", line 1661, in __view_look_dom
xarch, xfields = relation.__view_look_dom_arch(cr, user, f, view_id, ctx)
File "/usr/local/lib/python2.7/dist-packages/openerp-6.1_20120710_233320-py2.7.egg/openerp/osv/orm.py", line 1792, in __view_look_dom_arch
fields = self.fields_get(cr, user, None, context)
File "/usr/local/lib/python2.7/dist-packages/openerp-6.1_20120710_233320-py2.7.egg/openerp/osv/orm.py", line 3357, in fields_get
res[f] = fields.field_to_dict(self, cr, user, field, context=context)
File "/usr/local/lib/python2.7/dist-packages/openerp-6.1_20120710_233320-py2.7.egg/openerp/osv/fields.py", line 1587, in field_to_dict
res['selection'] = field.selection(model, cr, user, context)
File "/usr/local/lib/python2.7/dist-packages/openerp-6.1_20120710_233320-py2.7.egg/openerp/addons/oecn_base_fonts/oecn_base_fonts_config.py", line 37, in __system_fonts_get
return self._system_fonts_get(cr, uid)
File "/usr/local/lib/python2.7/dist-packages/openerp-6.1_20120710_233320-py2.7.egg/openerp/addons/oecn_base_fonts/oecn_base_fonts_config.py", line 58, in _system_fonts_get
ff.search()
File "/usr/lib/python2.7/dist-packages/reportlab/lib/fontfinder.py", line 242, in search
f.timeModified = rl_getmtime(f.fileName)
File "/usr/lib/python2.7/dist-packages/reportlab/lib/utils.py", line 477, in rl_getmtime
if os_path_isfile(pn) or _isFSD or loader is None: return os_path_getmtime(pn)
File "/usr/lib/python2.7/genericpath.py", line 54, in getmtime
return os.stat(filename).st_mtime
OSError: [Errno 2] 没有那个文件或目录: '/usr/share/fonts/truetype/ttf-japanese-gothic.ttf'
=====================================================================
但搜索了一下,发现有这个字体
“/var/lib/dpkg/alternatives/ttf-japanese-gothic.ttf
/usr/share/fonts/truetype/ttf-japanese-gothic.ttf
/etc/alternatives/ttf-japanese-gothic.ttf
” -
没有重启服务器 重启了电脑 就好了 以前一直忽略了重启服务器 潜意识里以为把浏览器关闭重启就相当于重启服务器了 不好意思添麻烦了
-
在做第三步修改cjk时,提示如下信息:Client Traceback (most recent call last):
File "C:\Program Files\OpenERP\Server\server\openerp\addons\web\common\http.py", line 180, in dispatch
File "C:\Program Files\OpenERP\Server\server\openerp\addons\web\controllers\main.py", line 1209, in load
File "C:\Program Files\OpenERP\Server\server\openerp\addons\web\controllers\main.py", line 1091, in fields_view_get
File "C:\Program Files\OpenERP\Server\server\openerp\addons\web\common\openerplib\main.py", line 250, in proxy
File "C:\Program Files\OpenERP\Server\server\openerp\addons\web\common\openerplib\main.py", line 117, in proxy
File "C:\Program Files\OpenERP\Server\server\openerp\addons\web\common\http.py", line 608, in send
Server Traceback (most recent call last):
File "C:\Program Files\OpenERP\Server\server\openerp\addons\web\common\http.py", line 593, in send
File "C:\Program Files\OpenERP\Server\server.\openerp\netsvc.py", line 360, in dispatch_rpc
File "C:\Program Files\OpenERP\Server\server.\openerp\service\web_services.py", line 586, in dispatch
File "C:\Program Files\OpenERP\Server\server.\openerp\osv\osv.py", line 167, in execute_kw
File "C:\Program Files\OpenERP\Server\server.\openerp\osv\osv.py", line 121, in wrapper
File "C:\Program Files\OpenERP\Server\server.\openerp\osv\osv.py", line 176, in execute
File "C:\Program Files\OpenERP\Server\server.\openerp\osv\osv.py", line 164, in execute_cr
File "C:\Program Files\OpenERP\Server\server.\openerp\osv\orm.py", line 2153, in fields_view_get
File "C:\Program Files\OpenERP\Server\server.\openerp\osv\orm.py", line 1793, in __view_look_dom_arch
File "C:\Program Files\OpenERP\Server\server.\openerp\osv\orm.py", line 1742, in __view_look_dom
File "C:\Program Files\OpenERP\Server\server.\openerp\osv\orm.py", line 1742, in __view_look_dom
File "C:\Program Files\OpenERP\Server\server.\openerp\osv\orm.py", line 1742, in __view_look_dom
File "C:\Program Files\OpenERP\Server\server.\openerp\osv\orm.py", line 1661, in __view_look_dom
File "C:\Program Files\OpenERP\Server\server.\openerp\osv\orm.py", line 1792, in __view_look_dom_arch
File "C:\Program Files\OpenERP\Server\server.\openerp\osv\orm.py", line 3357, in fields_get
File "C:\Program Files\OpenERP\Server\server.\openerp\osv\fields.py", line 1587, in field_to_dict
File "C:\Program Files\OpenERP\Server\server\openerp\addons\oecn_base_fonts.zip\oecn_base_fonts\oecn_base_fonts_config.py", line 39, in __system_fonts_get
File "C:\Program Files\OpenERP\Server\server\openerp\addons\oecn_base_fonts.zip\oecn_base_fonts\oecn_base_fonts_config.py", line 59, in _system_fonts_get
File "reportlab\lib\fontfinder.pyo", line 242, in search
File "reportlab\lib\utils.pyo", line 477, in rl_getmtime
File "genericpath.pyo", line 54, in getmtime
WindowsError: [Error 123] : 'c:\windows\fonts\??1?-\xa1\xea?-\xa1\xea???\xa8\xa6????????.TTF'
这是为什么呢?谁能帮我看看,多谢 -
安装了oecn_base_fonts 模块后
字头置换成了中文,但是内容仍是方块。请Joshua 指教!(操作系统 OPenSUSE12.2, OPENERP6.1.2)
----------------------------------------------------------------------------------
并且每次替换至最后一种字体,会出现以下错误:
Client Traceback (most recent call last):
File "/opt/openerp-6.1-2/openerp/addons/web/common/http.py", line 180, in dispatch
response["result"] = method(controller, self, **self.params)
File "/opt/openerp-6.1-2/openerp/addons/web/controllers/main.py", line 1052, in call_button
action = self.call_common(req, model, method, args, domain_id, context_id)
File "/opt/openerp-6.1-2/openerp/addons/web/controllers/main.py", line 996, in call_common
return self._call_kw(req, model, method, args, {})
File "/opt/openerp-6.1-2/openerp/addons/web/controllers/main.py", line 1010, in _call_kw
return getattr(req.session.model(model), method)(*args, **kwargs)
File "/opt/openerp-6.1-2/openerp/addons/web/common/openerplib/main.py", line 250, in proxy
args, kw)
File "/opt/openerp-6.1-2/openerp/addons/web/common/openerplib/main.py", line 117, in proxy
result = self.connector.send(self.service_name, method, *args)
File "/opt/openerp-6.1-2/openerp/addons/web/common/http.py", line 608, in send
raise xmlrpclib.Fault(openerp.tools.exception_to_unicode(e), formatted_info)
Server Traceback (most recent call last):
File "/opt/openerp-6.1-2/openerp/addons/web/common/http.py", line 593, in send
return openerp.netsvc.dispatch_rpc(service_name, method, args)
File "/opt/openerp-6.1-2/openerp/netsvc.py", line 360, in dispatch_rpc
result = ExportService.getService(service_name).dispatch(method, params)
File "/opt/openerp-6.1-2/openerp/service/web_services.py", line 586, in dispatch
res = fn(db, uid, *params)
File "/opt/openerp-6.1-2/openerp/osv/osv.py", line 167, in execute_kw
return self.execute(db, uid, obj, method, *args, **kw or {})
File "/opt/openerp-6.1-2/openerp/osv/osv.py", line 121, in wrapper
return f(self, dbname, *args, **kwargs)
File "/opt/openerp-6.1-2/openerp/osv/osv.py", line 176, in execute
res = self.execute_cr(cr, uid, obj, method, *args, **kw)
File "/opt/openerp-6.1-2/openerp/osv/osv.py", line 164, in execute_cr
return getattr(object, method)(cr, uid, *args, **kw)
File "/opt/openerp-6.1-2/openerp/addons/base/res/res_config.py", line 120, in action_next
next = self.execute(cr, uid, ids, context=context)
File "/opt/openerp-6.1-2/openerp/addons/oecn_base_fonts/oecn_base_fonts_config.py", line 163, in execute
new_font_rml = '<setFont name="'+o.map_ids[0].name+'" '
IndexError: list index out of range
----------------------------------------------------------------------------------
最后安装了base_report_cn以后,报表内容从方块换成了中文字体 (重启openerp-server)