home *** CD-ROM | disk | FTP | other *** search
- /*
- @BChooseDLFonts @P@Iby Robin Evans, July, 1992
- Allows user to choose which PS fonts will be downloaded
- */
-
- cr = '0a'x
- PSListF = 't:ppuser_fontList'
-
- /* Get name of ps fonts directory */
- if exists('s:PPage.ini') then do
- call open(INI, 's:PPage.ini', R)
- pos = seek(ini, -60, 'E') /* move to 60 bytes from end */
- do until eof(INI)
- parse value readln(INI) with Type PSDir
- if Type = 'PSF' then leave
- end
- if Type ~== 'PSF' then PSDir = 'cgfonts:ps'
- if right(PSDir, 1,1) ~== ':' & right(PSDir, 1,1) ~= '/' then
- PSDir = PSDir'/'
- PSDir = strip(PSDir)
- end
-
- call 'SafeEndEdit.rexx'
-
- pgOnly = ppm_Inform(2, 'List fonts for', 'Document', ' Page ')
- select
- when pgOnly == 1 then pgOpt = ppm_CurrentPage()
- when pgOnly == -1 then exit_msg('Operation cancelled.')
- otherwise PgOpt = ''
- end
-
-
- call ShowStatus('Preparing font information')
-
- interpret "FontsUsed = ppm_sortlist(ppm_getpsfontsused("PgOpt"),0,0)"
- parse var FontsUsed NumUsed '0a'x FontsUsed
-
-
- DLFonts = translate(ppm_selectfromlist('Pick fonts to download',28, min(16, NumUsed), 1, FontsUsed), ' ', '0a'x)
- if DLFonts = '' then exit_msg('Operation cancelled.')
-
- if pgOnly == 1 then do /* Get all fonts in doc now */
- FontsUsed = translate(ppm_getpsfontsused(), ' ', '0a'x)
- parse var FontsUsed NumUsed FontsUsed
- end
- else
- FontsUsed = translate(FontsUsed, ' ', '0a'x)
-
- DontDL = ''
- if words(DLFonts) < Numused then do
- do x = 1 for words(FontsUsed)
- CurFont = word(FontsUsed, x)
- if find(DLFonts, CurFont) = 0 then
- DontDL = DontDL CurFont
- end
- end
-
- /* With WShell this can be done more efficiently with ExecIO */
- address command
- 'list quick nohead' PSDir '>'PSListF
- address
- call open(FontL, PSListF, R)
- PSfonts = ''
- do until eof(FontL)
- lfont = readln(FontL)
- if lfont ~== '' then do
- parse var lfont lfont '.psfont'
- PSfonts = lfont PSfonts
- end
- end
-
-
- NotDLReady = ''
- DLReady = ''
-
- do x = 1 to words(DLFonts)
- call ShowStatus('Checking fonts on' PSDir'.')
- CurFont = word(DLFonts, x)
- if find(PSFonts, CurFont) = 0 then do
- if find(PSFonts, '_'CurFont) > 0 then do
- call rename(PSDir'_'CurFont'.psfont', PSDir || CurFont'.psfont')
- DLReady = DLReady || cr || CurFont
- end
- else
- NotDLReady = NotDLReady || cr || CurFont
- end
- else
- DLReady = DLReady || cr || CurFont
- end
-
- if words(DontDL) > 0 then
- call ShowStatus('Renaming fonts which won''t be downloaded.')
- do x = 1 for words(DontDL)
- CurFont = word(DontDL, x) || '.psfont'
- if exists(PSDir || CurFont) then
- call rename(PSDir || CurFont, PSDir'_'CurFont)
- end
-
- LeaveTran = 0
- do TranLoop = 0 until LeaveTran
- call ShowStatus('Checking for font files on other directories.')
- if length(NotDLReady) == 0 then leave TranLoop
- if ppm_Inform(2, 'Fonts not available for DL:'NotDLReady,'Finished','Transfer') then do
- TranRsp = reverse(ppm_getfilename('Choose extra PS files dir',"",""))
- if TranRsp ~= '' then do
- TranFonts = translate(NotDLReady, ' ', '0a'x)
- NotDLReady = ''
- parse var TranRsp foo '/' TranPath
- if foo == TranRsp then do
- parse var TranRsp foo ':' TranPath
- TranPath = reverse(TranPath) || ':'
- end
- else
- TranPath = reverse(TranPath) || '/'
- do x = 1 to words(TranFonts)
- CurFont = word(TranFonts, x) || '.psfont'
- if exists(TranPath || CurFont) then do
- call ShowStatus('Copying' CurFont 'to' PSDir'.')
- address command 'copy' TranPath || CurFont 'to' PSDir || CurFont
- end
- else
- NotDLReady = NotDLReady || cr || word(TranFonts,x)
- end
- iterate TranLoop /* Check for fonts to be trans from anther dir */
- end
- end
- LeaveTran = 1
- end
-
- exit_msg('Finished',)
-
- exit_msg: procedure
- do
- parse arg message
-
- if message ~= '' then call ppm_Inform(1,message,' Okay ')
- call ppm_ClearStatus()
- exit
- end