[reportlab-users] Getting rid of "Helvetica" (SOLVED)
Michael Geddert
reportlab-users@reportlab.com
Wed, 11 Aug 2004 18:28:15 +0200
Michael Geddert wrote:
> 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
>
Hello,
After patching canvas.py the errors that came up in prepress seem to
have vanished,
the system works like a charm now - changing "_make_preamble" did the trick.
Thank you very much, Robin - you saved us from a lot of grief.
Regards,
Michael
--
********************************
Michael Geddert
Arche Netvision GmbH
Banter Deich 18
26382 Wilhelmshaven
Tel.: 04421-916351
Fax: 04421-916444
Url: www.arche.ag
********************************