X-Authentication-Warning: delorie.com: mail set sender to geda-user-bounces using -f X-Recipient: geda-user AT delorie DOT com X-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to; bh=ullYoFWSKChXItyR+lJjsstCQWhcOQr7D4QehnCxgDA=; b=jQhURzPofQgFf+dYq6BAG8P9DGYZWM8aTi/+S4GxPu3jkRs+Ls6ZZnuSBD0S8vOM3O R7ynb3IxXO9ndxGPevYEhYRC39ifppHMXJ4U3qOvfddI8Kd06ki0yaHRmbz1/6yvtlDu nDFILVZHZjJtLCPQWP0sXfrn67BJC+nOTuJSSdUOQbckHqtpfsjtkq2PE+fwfzdU/L+y jaarV+7PbeVXJXNIcCMmoGI4NFk+6DHXA+5kGIRLmKvsfgFpCm7YeyWGjsOXZsF1G0P4 MmWMkb8k1K6dAowgng3P+hSrquhc0f1leM7LBeW5ptrEC4Ey8hNeFpbKBSks23E6lnvN 3lrw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to; bh=ullYoFWSKChXItyR+lJjsstCQWhcOQr7D4QehnCxgDA=; b=ic6Lal6LpDOybGQ8QRO+lReQ6jow8hN1rVjkRyuwdn02jcMVkmESgWbrgD9mAQ56z7 1fav+lfGhLxE0mR7/udaa2+CijfaRQ/zCgXb7eeiI/ggIOJ42MBzefoBK/jex2BBjDpg UOWWcRHtOp3Pf5uQDRD/nl8hNuJCa1T6EPZOu4OFvK0ef9cDGT/4jHiVVLuogfzjVy5u rzAlgXXb8eTxVZGQtCFK69m61u4sr6htFQTsLrzhQs66wXs9TLx1S2kpxNAEYGmci/v4 bylkvCJRZEG0MsuyfD2kCcqHdHPcuQ6Y35kA19p80DIjNPGCoVrhuS/TIyraCpUBgjKn cBMA== X-Gm-Message-State: APjAAAU8ZgpG0nUIyA168GLOZxiU2ADfRErJN4j8oy1MNBhPNFxbPPZR bgOYpsg5BSdPea5CnEwlxjk23ZCok9gDiy3YAC4UAw== X-Google-Smtp-Source: APXvYqzqSfsIYkU+0ni4FFZOJ1huLXQSXVp1Ph3glFqQpID/qrgIxqogGQYWxMS4Ebyaw01fMPfQLfAG8JgFW38/b5Y= X-Received: by 2002:adf:f14f:: with SMTP id y15mr13203559wro.223.1552922583891; Mon, 18 Mar 2019 08:23:03 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: References: <20190316182409 DOT 41886ca1 AT swips DOT iqo DOT uni-hannover DOT de> <9f3fa69a-4ea4-fcaf-d285-7852b327b5a2 AT fastmail DOT com> <20190316193156 DOT B65EB85E7F6C AT turkos DOT aspodata DOT se> From: "Alan Corey (alan01346 AT gmail DOT com) [via geda-user AT delorie DOT com]" Date: Mon, 18 Mar 2019 11:23:03 -0400 Message-ID: Subject: Re: [geda-user] Anybody use gschem to draw flowcharts? To: geda-user AT delorie DOT com Content-Type: text/plain; charset="UTF-8" Reply-To: geda-user AT delorie DOT com Errors-To: nobody AT delorie DOT com X-Mailing-List: geda-user AT delorie DOT com X-Unsubscribes-To: listserv AT delorie DOT com Precedence: bulk Aw, just google up a copy of PLRM.pdf (Postscript Language Reference Manual), it's not that bad. I do a little sometimes when I want to print something exactly the size I plan it to be without any scaling. Usually I write C that writes the Postscript. I can send the Postscript directly to my HP laser printer with lpr and I've checked some with dial calipers for accuracy. This makes a guitar note chart (on letter size paper) but the frets are spaced right: /* Guitar note chart in C and Postscript Alan Corey 1/2018 */ #define LEFTSTRING 15.42857142857142857148 #define PERSTRING 30.85714285714285714296 #include #include #include FILE *opf; // for 25 inch nut to bridge, 22 frets https://www.stewmac.com/FretCalculator.html double frets[23] = {0,1.403,2.728,3.978,5.157,6.271,7.322,8.315,9.251,10.135, 10.969,11.757,12.500,13.202,13.864,14.489,15.079,15.636,16.161,16.657, 17.125,17.567,17.985}; double newfretloc[23]; // after scaling/translating double stringx[6]; // horizontal positions of strings int markerloc[] = {3,5,7,9,12,15,17,19,21}; // markers at fret numbers // This is for standard tuning, you can replace just this part char notes[22][6][3] = {{"E","A","D","G","B","E"}, // open {"F","A#","D#","G#","C","F"}, // fret 1 {"F#","B","E","A","C#","F#"}, // fret 2 {"G","C","F","A#","D","G"}, // fret 3 {"G#","C#","F#","B","D#","G#"}, // fret 4 {"A","D","G","C","E","A"}, // fret 5 {"A#","D#","G#","C#","F","A#"}, // fret 6 {"B","E","A","D","F#","B"}, // fret 7 {"C","F","A#","D#","G","C"}, // fret 8 {"C#","F#","B","E","G#","C#"}, // fret 9 {"D","G","C","F","A","D"}, // fret 10 {"D#","G#","C#","F#","A#","D#"}, // fret 11 {"E","A","D","G","B","E"}, // fret 12 {"F","A#","D#","G#","C","F"}, // fret 13 {"F#","B","E","A","C#","F#"}, // fret 14 {"G","C","F","A#","D","G"}, // fret 15 {"G#","C#","F#","B","D#","G#"}, // fret 16 {"A","D","G","C","E","A"}, // fret 18 {"A#","D#","G#","C#","F","A#"}, // fret 19 {"B","E","A","D","F#","B"}, // fret 20 {"C","F","A#","D#","G","C"}, // fret 21 {"C#","F#","B","E","G#","C#"}}; // fret 22 void numfrets(void) { // number frets int i; double x,y; fprintf(opf,"\n/Helvetica findfont\n"); fprintf(opf,"13.0 scalefont setfont\n"); x = stringx[5] + 50; for (i=1; i<22; i++) { y = newfretloc[i]; fprintf(opf,"%f %f moveto\n",x,y); fprintf(opf,"(%i) show\n",i); } } void drawnotes(void) { // write the note letters int i,j; double x,y; double xofs, yofs; fprintf(opf,"/notenames { newpath\n"); fprintf(opf,"0.5 0.0 1.0 setrgbcolor\n"); // plumish fprintf(opf,"\n/Helvetica findfont\n"); fprintf(opf,"13.0 scalefont setfont\n"); xofs = -5; yofs = 1; for (i=0; i<22; i++) { // frets/notes y = newfretloc[i]; for (j=0; j<6; j++) { // strings x = stringx[j]; fprintf(opf,"%f %f moveto\n",(x+xofs),(y+yofs)); fprintf(opf,"(%s) show\n",notes[i][j]); } } fprintf(opf,"0.0 0.0 0.0 setrgbcolor\n"); // reset to black fprintf(opf,"} def\nnotenames stroke\n"); } void markers(void) { // like on the side of the neck, and fretboard int i; double y; double mofs = -6.0; // marker offset (font size matters) for (i=0; i<9; i++) { fprintf(opf,"\n/Helvetica findfont\n"); fprintf(opf,"12.5 scalefont setfont\n"); y = newfretloc[markerloc[i]] + mofs; fprintf(opf,"100 %f moveto\n",y); if (i == 4) fprintf(opf,"(**) show\n"); // 12th fret double marker else fprintf(opf,"(*) show\n"); printf("Marker at %f\n",y); } } void strings(void) { // draw strings int i; double n; // markers go left of neck edge fprintf(opf,"[1 5] 0 setdash\n"); fprintf(opf,"0 setlinewidth\n"); fprintf(opf,"/edges {\n newpath\n"); // using fixed numbers is a kludge, width change won't work fprintf(opf," 144 54 moveto\n"); // up 1/4" fprintf(opf," 144 756 lineto\n"); fprintf(opf," 329.142857428571 54 moveto\n"); fprintf(opf," 329.142857428571 756 lineto"); fprintf(opf,"} def\nedges stroke\n"); fprintf(opf,"/strings { newpath\n"); fprintf(opf,"0.5 setlinewidth\n"); // for actual strings fprintf(opf,"[] 0 setdash\n"); for (i=0; i<6; i++) { // draw strings n = LEFTSTRING + (i * PERSTRING) + 144; fprintf(opf,"%f %f moveto\n",n,54.0); fprintf(opf,"%f %f lineto\n",n,756.0); stringx[i] = n; } fprintf(opf,"} def\n strings stroke\n"); } void drawfrets(void) { int i; double y; fprintf(opf,"/frets { newpath\n"); fprintf(opf,"3 setlinewidth\n"); fprintf(opf,"%f %f moveto\n",stringx[0],newfretloc[0]); fprintf(opf,"%f %f lineto\n",stringx[5],newfretloc[0]); for (i=0; i<22; i++) { y = newfretloc[i]; fprintf(opf,"%f %f moveto\n",stringx[0],y); fprintf(opf,"%f %f lineto\n",stringx[5],y); } fprintf(opf,"}\n def\n frets stroke\n"); } void init(void) { int i; opf = fopen("guitar.ps","w"); if (opf == NULL) { printf("Creating postscript file failed.\n"); exit(1); } fprintf(opf,"%%!PS-Adobe-\n"); // starts Postscript interpreter // calc adjusted fret locations for (i=0; i<22; i++) { newfretloc[i] = 756 - ((frets[i]/17.895) * 702); printf("%i Old loc %f new loc %f\n",i,frets[i],newfretloc[i]); } } int main(void) { init(); fprintf(opf,"0.83 0.83 0.83 setrgbcolor\n"); /// light gray strings(); drawfrets(); fprintf(opf,"0.0 0.0 0.0 setrgbcolor\n"); // default black markers(); drawnotes(); numfrets(); fclose(opf); return 0; } On 3/17/19, Svenn Are Bjerkem (svenn DOT bjerkem AT gmail DOT com) [via geda-user AT delorie DOT com] wrote: > On Sat, 16 Mar 2019 at 23:27, Girvin Herr (gherrl AT fastmail DOT com) [via > geda-user AT delorie DOT com] wrote: > >> >> I am not into pain enough to create PostScript code directly. No thanks. >> The tools can do that much better than I. >> >> Girvin >> >> > You could use xcircuit to short-cut the hand typing of postscript as > xcircuit uses postscript as its storage format :) > > -- > Svenn > -- ------------- No, I won't call it "climate change", do you have a "reality problem"? - AB1JX Cities are cages built to contain excess people and keep them from cluttering up nature. Impeach Impeach Impeach Impeach Impeach Impeach Impeach Impeach