[reportlab-users] blurry (dithered) lines + font height, descent etc.

Michael Steuer reportlab-users@reportlab.com
Wed, 23 Oct 2002 23:09:52 +1000


This is a multi-part message in MIME format.

------=_NextPart_000_00FC_01C27AE9.4B337F70
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: 7bit

Hi everybody!

I'm currently writing a python application that generates output in PDF, PNG,
JPG etc. and am trying to use reportlab for this task. I was using piddle
before, but due to its development state decided to change over to reportlab.
Now, changing my code over from piddle, I have some problems:

If I ouput the same Drawing (reportlab.graphics) to PDF and PNG (see the
attached files), I get a perfect output in PDF, but in PNG (and all the other
renderPM output types) I get blurry (dithered) lines.

Is there a way to turn this dithering off?

Btw: I am using "renderPM.drawToFile" to output the PNG.


Furthermore, in my application I need to position text depending on its size, so
I need a way to get the following information depending on the font:

font height, descent, ascent and string width

For the width, I found "reportlab.pdfbase.pdfmetrics.stringWidth", but there
seems to be no function for obtaining the font height, descent and ascent. Am I
overlooking something???


Thanks for your help in advance.

Cheers,

Mike.

------=_NextPart_000_00FC_01C27AE9.4B337F70
Content-Type: image/png;
	name="test.PNG"
Content-Transfer-Encoding: base64
Content-Disposition: attachment;
	filename="test.PNG"

iVBORw0KGgoAAAANSUhEUgAAAGQAAADICAIAAACRXtOWAAAJzklEQVR4nLzMMQEAIBDDwLyyVnqr
DBYkALdlydiWBABJ2oGTV1Vath+cP2m7AQAA//9iqK+v/w8D9fX1DAz1DAz/aYDqkS0aiqC+vh4A
AAD//2Ia6AgbSgAAAAD//xoNLBIAAAAA//8aDSwSAAAAAP//Gg0sEgAAAAD//xoNLBIAAAAA//8a
DSwSAAAAAP//Gg0sEgAAAAD//xoNLBIAAAAA//8aDSwSAAAAAP//Gg0sEgAAAAD//xoNLBIAAAAA
//8aDSwSAAAAAP//Gg0sEgAAAAD//xoNLBIAAAAA//8aDSwSAAAAAP//Gg0sEgAAAAD//xoNLBIA
AAAA//8aDSwSAAAAAP//Gg0sEgAAAAD//xoNLBIAAAAA//8aDSwSA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AD//xoNLBIAAAAA
//8aDSwSAAAAAP//Gg0sEgAAAAD//xoNLBIAAAAA//8aDSwSAAAAAP//Gg0sEgAAAAD//xoNLBIA
AAAA//8aDSwSAAAAAP//Gg0sEgAAAAD//0I/qmDlypX0GaKlIqDRgPXBgwfRBmABAAAA//9CHylV
ePDA/sED6ltMdRNhoKCggEYm29vbJyQkIIsAAAAA//9CP6rAnjY3hTUwMDAICNDAYAYBAQHajVaj
AQAAAAD//xots0gAAAAAAP//Gg0sEgAAAAD//xoNLBIAAAAA//8aDSwSAAAAAP//Gg0sEgAAAAD/
/xoNLBIAAAAA//8aDSwSAAAAAP//Gg0sEgAAAAD//xoNLBIAAAAA//8aDSwSAAAAAP//Gg0sEgAA
AAD//xoNLBIAAAAA//8aDSwSAAAAAP//Gg0sEgAAAAD//xoNLBIAAAAA///CGCllYDhAA2seMjD4
f/hAA4PpCgAAAAD//8JYU6qgwCAvT3176HhJFe0AAAAA//+i06GudBvMpCkAAAAA//8aLbNIAAAA
AAD//xoNLBIAAAAA//8aDSwSAAAAAP//Gg0sEgAAAAD//xoNLBIAAAAA//8aDSwSAAAAAP//Gg0s
EgAAAAD//xoNLBIAAAAA//8aDSwSAAAAAP//Gg0sEgAAAAD//xoNLBIAAAAA//8aDSwSAAAAAP//
Gg0sEgAAAAD//xoNLBIAAAAA//8aDSwSAAAAAP//Gg0sEgAAAAD//xoNLBIAAAAA//8aDSwSAAAA
AP//YnRwcIAvYD5w4MDDhw/laTAGDzF2SN8YdvDgQQAAAAD//wMAUgS5Yg+Ic6wAAAAASUVORK5C
YII=

------=_NextPart_000_00FC_01C27AE9.4B337F70
Content-Type: application/pdf;
	name="test.PDF"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment;
	filename="test.PDF"

%PDF-1.3
%=93=8C=8B=9E ReportLab Generated PDF document http://www.reportlab.com
% 'BasicFonts' '<reportlab.pdfbase.pdfdoc.PDFDictionary instance a'=20
1 0 obj
% The standard fonts dictionary
<< /F1 2 0 R
 /F2 3 0 R >>
endobj
% 'F1' '<reportlab.pdfbase.pdfdoc.PDFType1Font instance at'=20
2 0 obj
% Font Helvetica
<< /BaseFont /Helvetica
 /Encoding /WinAnsiEncoding
 /Name /F1
 /Subtype /Type1
 /Type /Font >>
endobj
% 'F2' '<reportlab.pdfbase.pdfdoc.PDFType1Font instance at'=20
3 0 obj
% Font Times-Roman
<< /BaseFont /Times-Roman
 /Encoding /WinAnsiEncoding
 /Name /F2
 /Subtype /Type1
 /Type /Font >>
endobj
% 'Page1' '<reportlab.pdfbase.pdfdoc.PDFPage instance at 0x00'=20
4 0 obj
% Page dictionary
<< /Contents 8 0 R
 /MediaBox [ 0
  0
  100
  200 ]
 /Parent 7 0 R
 /Resources << /Font 1 0 R
  /ProcSet [ /PDF
   /Text
   /ImageB
   /ImageC
   /ImageI ] >>
 /Trans <<  >>
 /Type /Page >>
endobj
% 'R5' '<reportlab.pdfbase.pdfdoc.PDFCatalog instance at 0'=20
5 0 obj
% Document Root
<< /Outlines 9 0 R
 /PageMode /UseNone
 /Pages 7 0 R
 /Type /Catalog >>
endobj
% 'R6' '<reportlab.pdfbase.pdfdoc.PDFInfo instance at 0x00'=20
6 0 obj
<< /Author (anonymous)
 /CreationDate (20021023225222)
 /Producer (ReportLab http://www.reportlab.com)
 /Subject (unspecified)
 /Title (My First Drawing) >>
endobj
% 'R7' '<reportlab.pdfbase.pdfdoc.PDFPages instance at 0x0'=20
7 0 obj
% page tree
<< /Count 1
 /Kids [ 4 0 R ]
 /Type /Pages >>
endobj
% 'R8' '<reportlab.pdfbase.pdfdoc.PDFStream instance at 0x'=20
8 0 obj
% page stream
<< /Filter [ /ASCII85Decode
  /FlateDecode ]
 /Length 364 >>
stream
GatUo9hWDY&;KY)r.k$FH`3?[Ctn9M.u57rgr+j?Z0]=3D[=3DG=3D_DD^Ol&;G8;f
9g`=3DZ54<#/+fOm-S=3Dd8mGap>lUuC2r[]o8Q\F<D7J;0J5^m[S#!n8qSL!hFF
/P^2tYZs+/T/^b\p?UQ"'Rg-KMi)^-*ZfslV5KK6G!2%nk@p<O'FL>*5fI$R
lEIk3jOI9&)KQ,V`5lWc,9rNA>)cG,iGW%B0?%cp>*K;F7d_;:TscW^`\D$Z
94Q[$'+iSL;bHloAY_1\l<NHgoLfL;L*gM/oacDg8kiH48tA/1N^BYs^WcLL
@pBa!@?71*]uV""!]*%dPOI]lV+W-tbG-cY*MIdEBa:I/#61jDkP~>endstream

endobj
% 'R9' '<reportlab.pdfbase.pdfdoc.PDFOutlines instance at '=20
9 0 obj
<< /Count 0
 /Type /Outlines >>
endobj
xref
0 10
0000000000 65535 f
0000000145 00000 n
0000000286 00000 n
0000000484 00000 n
0000000689 00000 n
0000000991 00000 n
0000001163 00000 n
0000001404 00000 n
0000001545 00000 n
0000002088 00000 n
trailer
<< /ID=20
  % ReportLab generated PDF document -- digest =
(http://www.reportlab.com)=20
  [(\372I\261\275\204%>\225n\313\321\264\245\036\177\270) =
(\372I\261\275\204%>\225n\313\321\264\245\036\177\270)]=20
=20
 /Info 6 0 R
 /Root 5 0 R
 /Size 10 >>
startxref
2139
%%EOF

------=_NextPart_000_00FC_01C27AE9.4B337F70--