!/^\%\%DocumentFonts\:/ /^\%\%DocumentFonts\:/ { do { for (i=2;i<=NF;i++) Fonts[$(i)]=1 getline line = $0 } while ( /^\%\%\+ / ) for (Font in Fonts) if( Font=="ZapfDingbats-Reverse" ) { ZDR=1 Fonts["ZapfDingbats"]=1 NeededFonts["ZapfDingbats"]=1 SuppliedFonts[Font]=1 } else if( Font=="Symbol-Slanted" ) { SS=1 Fonts["Symbol"]=1 NeededFonts["Symbol"]=1 SuppliedFonts[Font]=1 } else if( Font=="FreeEuro" ) { EURO=1 SuppliedFonts[Font]=1 } else { NeededFonts[Font]=1 } if (DSCline != DSClineinit) print DSCline DSClineinit = "%%DocumentNeededResources: font" DSCline = DSClineinit for (Font in NeededFonts) if (length(DSCline) + length(Font) < 80) DSCline = DSCline " " Font else { print DSCline DSCline = "%%+ font " Font } if (DSCline != DSClineinit) print DSCline print "%%DocumentSuppliedResources: encoding groffEncoding" DSClineinit = "%%+ font" DSCline = DSClineinit for (Font in SuppliedFonts) if (length(DSCline) + length(Font) < 80) DSCline = DSCline " " Font else { print DSCline DSCline = "%%+ font " Font } if (DSCline != DSClineinit) print DSCline DSCline = "" print "%%BeginSetup" for (Font in NeededFonts) print "%%IncludeResource: font " Font "kpsepath troff_font" | getline DEVPS if( SS ) { print "%%BeginResource: font Symbol-Slanted" PFA=DEVPS "/symbolsl.pfa" while ( (getline < PFA) > 0 ) print print "%%EndResource" } if( ZDR ){ print "%%BeginResource: font ZapfDingbats-Reverse" PFA=DEVPS "/zapfdr.pfa" while ( (getline < PFA) > 0 ) print print "%%EndResource" } if( EURO ){ print "%%BeginResource: font FreeEuro" PFA=DEVPS "/freeeuro.pfa" while ( (getline < PFA) > 0 ) print print "%%EndResource" } print "/RE{" print "findfont" print "dup maxlength 1 index/FontName known not{1 add}if dict begin" print "{" print "1 index/FID ne{def}{pop pop}ifelse" print "}forall" print "/Encoding exch def" print "dup/FontName exch def" print "currentdict end definefont pop" print "}bind def" "kpsewhich groff.enc" | getline GROFFENC while ( (getline < GROFFENC) > 0 ) print $0 = line while ( !/^%%EndProlog$/ ) { if ( /^ \/[^ ]*8g / ) { print " " $2 "-groff groffEncoding " $2 " RE" print " " $1 " " $2 "-groff def" } else print getline } print "%%EndSetup" }