From: Joerg L. <jo...@us...> - 2012-02-17 09:58:08
|
Hi Michael, On 17.02.12, Michael SCHINDLER wrote: > Salut Jörg, > > On 17/02/12, Joerg Lehmann wrote: > > On 17.02.12, m-s...@us... wrote: > > > Revision: 3240 > > > + def writefontnames(self, file): > > > + fontnames = [res.t1file.name for res in self.resourceslist if res.type == "t1file"] > > > + fontnames += [res.newfontname for res in self.resourceslist if res.type == "reencodefont"] > > > + if fontnames: > > > + file.write(_DSCsplitline("%%DocumentNeededFonts:", "", fontnames)) # TODO add needed fonts which are not included > > > + file.write(_DSCsplitline("%%DocumentSuppliedFonts:", "", fontnames)) > > > + file.write(_DSCsplitline("%%DocumentFonts:", "", fontnames)) > > > + > > > > ... this looks not like the intended use of the registry. Without > > looking in the details, the previous solution you checked in looked > > better. What was the reason for moving this code into the PSregistry? > > First, I wanted to avoid a code duplication. Of course, we could > introduce writefontnames as a member of _PSwriter, which is closer to > the DSC writing code. But then, the signature is > > class _PSwriter: > def writefontnames(self, file, registry): > > and it does not at all make use of "self" -- so, this is not a better > place. We would not need to make this a method of the _PSwriter class. In order to avoid code duplication you could, e.g., also add a function in the __init__ method. > In the end, I do not see why the registry -- it is not a general > registry but a PSregistry -- should not contain PS-specific code like > the DSC. We already have similar code in PSdefinition. Simply because it is too specific. We could, however, add more generic code to allow for adding sections in the first DSC section. Cheers, Jörg |