[reportlab-users] How can I use Bold or italic for CIDFont (ex.HeiseiMin-W3)

Hearn lovehearn at gmail.com
Thu Jul 1 03:39:59 EDT 2010


I want to use HeiseiKakuGo-W5 font but I looks like bold and italic do not
work.

I reference to txt2pdf
http://www.sanface.com/txt2pdffaq.html#Bold

So, I try to set font "HeiseiKakuGo-W5-90ms-RKSJ-H bold".
Of course, it doesn't find this font.

I try to dig the pdf source.Then I found a dirty hack.

replace pdf font obj define(sorry,I dont know pdf spec)

Just open original pdf with simple text Editor

Step:
# add new font obj define
25 0 obj
<<
/Type /Font
/Subtype /Type0
/Name /F22
/BaseFont /HeiseiMin-W3-90ms-RKSJ-H,Bold
/Encoding /90ms-RKSJ-H
/DescendantFonts [ 26 0 R ]
>>
endobj
26 0 obj
<<
/Type /Font
/Subtype /CIDFontType0
/BaseFont /HeiseiMin-W3,Bold
/FontDescriptor 27 0 R
/CIDSystemInfo
<<
/Registry (Adobe)
/Ordering (Japan1)
/Supplement 2
>>
/DW 1000
/W [ 50 500 500 ]
>>
endobj
27 0 obj
<<
/Type /FontDescriptor
/Ascent 723
/CapHeight 709
/Descent -241
/Flags 6
/FontBBox [ -123 -257 1001 910 ]
/FontName /HeiseiMin-W3,Bold
/ItalicAngle 0
/StemV 69
/XHeight 450
/Style
<<
/Panose <010502020400000000000000>
>>
>>
endobj

#replace font referance
- /F2 3 0 R >>
+ /F2 22 0 R >>

Sorry, I dont know how to explain it.
You may diff the attachments

Back to the topic.
How can I use Bold or italic for CIDFont (ex.HeiseiMin-W3) ?
Does any easy way?

Hope we could fix it.
Thank you.

Does it easy to hack this behavior in ReportLab ?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://two.pairlist.net/pipermail/reportlab-users/attachments/20100701/3d709108/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: italic_cjk.pdf
Type: application/pdf
Size: 3933 bytes
Desc: not available
Url : <http://two.pairlist.net/pipermail/reportlab-users/attachments/20100701/3d709108/attachment.pdf>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: italic_cjk_hack.pdf
Type: application/pdf
Size: 2737 bytes
Desc: not available
Url : <http://two.pairlist.net/pipermail/reportlab-users/attachments/20100701/3d709108/attachment-0001.pdf>


More information about the reportlab-users mailing list