Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/python-3.x/17.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 3.x 无法使ReportLab正确打印unicode字体_Python 3.x_Reportlab_Unicode String - Fatal编程技术网

Python 3.x 无法使ReportLab正确打印unicode字体

Python 3.x 无法使ReportLab正确打印unicode字体,python-3.x,reportlab,unicode-string,Python 3.x,Reportlab,Unicode String,我正在尝试使用hygothic中字体打印韩文字符。在site packages\reportlab\fonts文件夹下,我的字体为'korean.h2gtrm.ttf'文件。 我做了以下工作:- pdfmetrics.registerFont(UnicodeCIDFont(TTFont('HYGothic- Medium','korean.h2gtrm.ttf'))) pdfmetrics.registerFontFamily('HYGothic-Medium',normal='HYGo

我正在尝试使用hygothic中字体打印韩文字符。在site packages\reportlab\fonts文件夹下,我的字体为'korean.h2gtrm.ttf'文件。 我做了以下工作:-

 pdfmetrics.registerFont(UnicodeCIDFont(TTFont('HYGothic- 
 Medium','korean.h2gtrm.ttf')))
 pdfmetrics.registerFontFamily('HYGothic-Medium',normal='HYGothic- 
 Medium',bold='HYGothic-Medium',italic='HYGothic- 
 Medium',boldItalic='HYGothic- 
 Medium')
 addMapping('HYGothic-Medium',0, 0, 'korean.h2gtrm') #normal
 addMapping('HYGothic-Medium', 0, 1, 'korean.h2gtrm')
 addMapping('HYGothic-Medium',1, 0, 'korean.h2gtrm')
 addMapping('HYGothic-Medium',1, 1, 'korean.h2gtrm')
 pstyle= ParagraphStyle(name='KOR', fontName = 'HYGothic-Medium', 
  fontSize = 10 ))
  p=Paragraph(text,pstyle)) # where text is my Korean characters
  story.append(p) # error !!
我得到以下错误:-

   Can't map determine family/bold/italic for hygothic-medium
   paragraph text '<para>\uc724\uadfc Machine</para>' caused exception
无法映射确定湿度介质的族/粗体/斜体
段落文本“\uc724\uadfc计算机”导致异常
有什么建议吗