Python 3.x 无法使ReportLab正确打印unicode字体
我正在尝试使用hygothic中字体打印韩文字符。在site packages\reportlab\fonts文件夹下,我的字体为'korean.h2gtrm.ttf'文件。 我做了以下工作:-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
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计算机”导致异常
有什么建议吗