[reportlab-users] Getting rid of "Helvetica"

Michael Geddert reportlab-users@reportlab.com
Tue, 10 Aug 2004 14:57:53 +0200


Robin Becker wrote:

> Michael Geddert wrote:
>
>> Robin Becker wrote:
>>
>>>>
>>>> <*snip*>
>>>>
>>>
>>> Are you referring to the standard font. That comes built in and 
>>> costs little or nothing (there's a standard pdf fonts dictionary 
>>> called 'BasicFonts'). So far as I know Helvetica is mentioned in 
>>> canvas.py as an 'initial font'. I'm not the expert on that bit of 
>>> code and Andy is away on holiday right now. If you preferred to set 
>>> another standard font as 'initial' I'm sure that could be 
>>> accomplished fairly easily.
>>>
>>> Can you explain why you want to remove Helvetica?
>>
>>
>>
>> Sure !
>>
>> We are creating PDFs on the fly with Reportlab for a big customer 
>> project.
>>  From time to time, our PDFs smash the printing machines in our 
>> customers
>> prepress centre.
>> We did some research and it all points down to the included-but-not-used
>> "helvetica" Font. Anyway, the outages in our customer prepress centre 
>> is *not*
>> an issue with the toolkit, it is entirely due to their specific 
>> setup,we just need a way to work around that.
>>
>> BTW, our project doesn't involve a single standard font, all fonts 
>> are special and "handmade" by our customer.
>>
>> So, should I just empty the BasicFonts-Dictionary and Helvetica would 
>> be gone ?
>> That would be too easy, wouldn't it...
>>
>> What would be the *best* way to go ?
>>
>
> I think the best way to go would be to change the code newar line 246 
> of canvas.py to alter the default font. So instead of
>
>     iName = self._doc.getInternalFontName('Helvetica')
>
> you need something like
>
>     iName = self._doc.getInternalFontName('MyFont')
>
> where you've previously declared MyFont as one of the fonts you want 
> to use. However, I suspect you want to do this for a ttf font and that 
> may not work as the internal stuff name seems to apply only to T1 fonts.
>
> The code above is iused in creating the canvas._preamble which I 
> suspect may not actually be required in all cases. For your purposes 
> it may be sufficient to replace the whole of the _make_preamble method 
> with
>
>     def _make_preamble(self):
>         self._preamble = ''
>
> Can you try that out?
>
>> Regards,
>> Michael
>>
>>
>
>
Yes, I'll try . After applying the changes I'll check some PDFs manually 
and then I'll submit them to prepress for further tests.
I'll keep you updated.

Thanks a lot,

Michael

-- 
********************************
Michael Geddert

Arche Netvision GmbH
Banter Deich 18

26382 Wilhelmshaven

Tel.: 04421-916351
Fax:  04421-916444
Url:  www.arche.ag
********************************