medley icon indicating copy to clipboard operation
medley copied to clipboard

USER.CM location for .bravo files

Open masinter opened this issue 8 months ago • 6 comments

make sure the USER.CM location is at least as good as the one in @pmcjones 's bravo converter in finding an appropriate user.cm for .bravo files in the CHM PARC Archives files. I will raise reviewing that in a separate issue.

Originally posted by @masinter in https://github.com/Interlisp/medley/issues/2119#issuecomment-2867610468

masinter avatar May 09 '25 18:05 masinter

What is @pmcjones strategy? If not specified as a property in the OPENTEXTSTREAM/TEDIT calll, this looks for a USER.CM in the directory of the bravo file, if not there searches for USER.CM in the user's DIRECTORIES, if not there, asks in the promptwindow.

rmkaplan avatar May 09 '25 19:05 rmkaplan

My strategy was inferior: I hardwired fonts loosely based on the standard non-programmer's disk.

pmcjones avatar May 09 '25 21:05 pmcjones

It would be simple to include a default set of paragraph and font properties when the USER.CM file for a given bravo file is unknown or can't be found. Just a Lisp variable initialized to a simple alist.

For example, here are two candidates, one parsed from the user.manual file that comes with the 3-Lisp files and the other is the user.cm that we used for the IDL files. They appear to differ only in the font assignments. Is there another one that would be a better default?

((ParagraphLeading 12) (LineLeading 6) (FirstLineLeftMargin 84) (LeftMargin 84) (RightMargin 528) (DefaultTab 36) (Font (0 TIMESROMAN 10 NIL NIL) (1 TIMESROMAN 8 NIL NIL) (2 HIPPO 8 NIL NIL) (3 GACHA 8 NIL NIL) (4 MATH 8 NIL NIL) (5 HELVETICA 12 NIL NIL) (6 GACHA 6 NIL NIL) (7 TIMESROMAN 9 NIL NIL) (8 HELVETICA 10 NIL NIL) (9 HELVETICA 11 NIL NIL)))

((ParagraphLeading 12) (LineLeading 6) (FirstLineLeftMargin 84) (LeftMargin 84) (RightMargin 528) (DefaultTab 18) (Font (0 HELVETICA 10 NIL NIL) (1 HELVETICA 8 NIL NIL) (2 LOGO 24 NIL NIL) (3 MATH 10 NIL NIL) (4 HIPPO 10 NIL NIL) (5 TIMESROMAN 12 NIL NIL) (6 HELVETICA 10 NIL NIL) (7 HELVETICA 8 NIL NIL) (8 GACHA 10 NIL NIL) (9 HELVETICA 18 NIL NIL)))

rmkaplan avatar May 10 '25 13:05 rmkaplan

if we're running HCFILES to do a bulk transform of .bravo to PDF conversion, asking the user for a "user.cm" file isn't useful. I think if there isn't a user.cm or some other renaming that we can hint at, picking the same font choices as Paul did will at least aid in reviewing the comparison between Paul's bravo converter to going through TEdit.

masinter avatar May 10 '25 18:05 masinter

I made the USER.CM be a property that you can pass in to TEDIT or the OPENSTREAM call in HCFILES. You can pass an alist or a file name.

I think the protocol should be that it first looks for a USER.CM in the bravo file's directory (perhaps confirms in the prompt when it finds it?).

If it doesn't find it, and you pass in a property, then silently use the property.

Otherwise the sequence: search DIRECTORIES, ask the user for a name, go to the default.

On May 10, 2025, at 11:27 AM, Larry Masinter @.***> wrote:

masinter left a comment (Interlisp/medley#2144) https://github.com/Interlisp/medley/issues/2144#issuecomment-2869078499 if we're running HCFILES to do a bulk transform of .bravo to PDF conversion, asking the user for a "user.cm" file isn't useful. I think if there isn't a user.cm or some other renaming that we can hint at, picking the same font choices as Paul did will at least aid in reviewing the comparison between Paul's bravo converter to going through TEdit.

— Reply to this email directly, view it on GitHub https://github.com/Interlisp/medley/issues/2144#issuecomment-2869078499, or unsubscribe https://github.com/notifications/unsubscribe-auth/AQSTUJJ3P3QUOK32YVZRWLT25ZAJTAVCNFSM6AAAAAB4ZXLMS6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDQNRZGA3TQNBZHE. You are receiving this because you commented.

rmkaplan avatar May 10 '25 19:05 rmkaplan

Here's the case statement in my code that handles fonts:

switch (c_l.font) {
    case 0: name = "serif"; size = 10; break;       // want Times Roman
    case 1: name = "serif"; size =  8; break;       // want Times Roman
    case 2: name = "monospace"; size = 18; break;   // really XEROX logo (just E O R X)
    case 3: name = "math"; size = 10; break;
    case 4: name = "greek"; size = 10; break;
    case 5: name = "serif"; size = 12; break;       // want Times Roman
    case 6: name = "sans-serif"; size = 10; break;  // want Helvetica
    case 7: name = "sans-serif"; size =  8; break;  // want Helvetica
    case 8: name = "monospace"; size = 10; break;   // want Gacha
    default: name = "serif"; size = 10; break;      // treat like 0
}

pmcjones avatar May 10 '25 20:05 pmcjones

In #2119 (rmk88) the USER.CM can be provided in the opening properties.

rmkaplan avatar Jul 03 '25 20:07 rmkaplan