% =================================================================== % Copyright (C) 2013, David Lacroix. %==================================================================== % This program is free software; you can redistribute it and/or modify % it under the terms of the GNU General Public License as published by % the Free Software Foundation; either version 3 of the License, or % (at your option) any later version. % % This program is distributed in the hope that it will be useful, % but WITHOUT ANY WARRANTY; without even the implied warranty of % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the % GNU General Public License for more details. % % You should have received a copy of the GNU General Public License % along with this program; if not, write to the Free Software % Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA % ============================================================================== % There are some fragments of code from Jef Moine, coming from the file "syms.c", % which is part of the abcm2ps program, and from the file "deco.abc", % which is an experimental purpose to create or modify some deco. % This part is published under the GNU GPL License % The primary abcm2ps site is: http://moinejf.free.fr/ % --------------------------------------------------------- % The rest of the code is written by myself. % This part is published under the GNU GPL License % http://davidlacroix.fr % email: contact(at)davidlacroix(dot)fr %*********************************************************************************** % col.fmt is a single format file to be used in conjunction with abcm2ps 7.5.4 or later % single purpose for colors manipulation for notes-blocks and, in other way, for decos % thanks to Hudson Lacerda for helping me to fix the code in a safe way % this format file should be used in conjunction with my ps.fmt % wich you can download at http://hudsonlacerda.webs.com/abc/ps_fmt.tgz % ----------------------------------------------------------------------------------- % the header of .abc file should be precised : %%format /home/username/ps.fmt %%format /home/username/col.fmt % if ps.fmt and col.fmt are put in the directory /home/username/ % --------------------------------------------------- % in other way, please use the abcm2ps command line % with -D and -F (see option.txt in abcm2ps) %**************************************************************** beginps /SGR{setgray}! /RGB{setrgbcolor}! % =============================================================== % save the graphic state of certains elements (0 0 0 RGB) in black % ================================================================ % keep black staff lines /staff{gsave dlw M{dup 0 RL dup neg 6 RM}repeat pop 0 0 0 RGB stroke grestore}! % keep black braces (system begin) /hbrce{gsave -2.5 1 RM -4.5 -4.6 -7.5 -12.2 -4.4 -26.8 RC 3.5 -14.3 3.2 -21.7 -2.1 -24.2 RC 7.4 2.4 7.3 14.2 3.5 29.5 RC -2.7 9.5 -1.5 16.2 3 21.5 RC 0 0 0 RGB fill grestore}! /bracket{gsave M -5 2 RM currentpoint -1.7 2 RM 10.5 -1 12 4.5 12 3.5 RC 0 -1 -3.5 -5.5 -8.5 -5.5 RC 0 0 0 RGB fill 3 SLW M 0 2 RM 0 exch neg 8 sub RL currentpoint 0 0 0 RGB stroke M -1.7 0 RM 10.5 1 12 -4.5 12 -3.5 RC 0 1 -3.5 5.5 -8.5 5.5 RC 0 0 0 RGB fill grestore}! % keep black clefs /tclef{gsave T -10 0 T .045 dup scale utclef 0 0 0 RGB ufill grestore}! /stclef{gsave T -10 0 T .037 dup scale utclef 0 0 0 RGB ufill grestore}! /bclef{gsave T -10 0 T .045 dup scale ubclef 0 0 0 RGB ufill grestore}! /sbclef{gsave T -10 3 T .037 dup scale ubclef 0 0 0 RGB ufill grestore}! /cclef{gsave T -12 0 T .045 dup scale ucclef 0 0 0 RGB ufill grestore}! /scclef{gsave T -12 2 T .037 dup scale ucclef 0 0 0 RGB ufill grestore}! /pclef{gsave exch 2.7 sub exch 2 add 5.4 20 1.4 SLW 0 0 0 RGB rectstroke grestore}! % keep black 8 up or down for clef /octu{gsave /Times-Roman 12 selectfont M -2.5 0 RM(8) 0 0 0 RGB show grestore}! /octl{gsave /Times-Roman 12 selectfont M -3.5 0 RM(8) 0 0 0 RGB show grestore}! % keep black time-signature don't work for C or C|) /tsig{gsave M /Bookman-Demi 14 selectfont 1.2 1 scale 0 1 RM currentpoint 3 -1 roll 0 0 0 RGB showc 12 add M 0 0 0 RGB showc grestore}! /stsig{gsave M /Bookman-Demi 16 selectfont 1.2 1 scale 0 6.5 RM 0 0 0 RGB showc grestore}! % keep black bars /bar{M dlw 0 exch RL 0 0 0 RGB stroke}! /thbar{3 -1 roll 3 exch 0 0 0 RGB rectfill}! /rdots{ 2 copy 9 add M currentpoint 1.2 0 360 arc 15 add M currentpoint 1.2 0 360 arc 0 0 0 RGB fill}! % keep black accidentals /sh0{gsave T -4 -5 T .018 dup scale usharp 0 0 0 RGB ufill grestore}! /ft0{gsave T -3.5 -3.5 T .018 dup scale uflat 0 0 0 RGB ufill grestore}! /nt0{gsave T -3 -5 T .018 dup scale unat 0 0 0 RGB ufill grestore}! /dsh0{gsave T -4 -5 T .018 dup scale udblesharp 0 0 0 RGB ufill grestore}! /dft0{gsave T -4 -3.5 T .018 dup scale udbleflat 0 0 0 RGB ufill grestore}! % ================================================================================== % change : gray slurs /SL{gsave .2 SGR M RC RL RC closepath fill grestore}! /dSL{gsave .2 SGR M [4] 0 setdash .8 SLW RC stroke [] 0 setdash grestore}! % change : gray tuplets /bnum{gsave M/Times-Italic 12 selectfont .2 SGR showc grestore}! /bnumb{gsave currentgray/Times-Italic 12 selectfont 3 index stringwidth pop 4 add dup .5 mul neg 4 index add 3 index 3 -1 roll 8 1.0 setgray rectfill setgray M showc grestore}! /tubr{gsave 3 sub M 0 3 RL RL 0 -3 RL dlw .2 SGR stroke grestore}! /tubrl{gsave 3 add M 0 -3 RL RL 0 3 RL dlw .2 SGR stroke grestore}! % usage [I:ps red] changing color of notes-blocks /blk{0 0 0 RGB }! /red{1 0 0 RGB }! /blu{0 0 1 RGB }! /mag{1 0 1 RGB }! /gre{0.0 0.5 0.0 RGB }! /bro{.7 .2 0 RGB }! /yel{1 1 0 RGB }! /ora{1.0 0.4 0.0 RGB }! % usage for deco (see below) /_blk{blk pop pop}! /_red{red pop pop}! /_blu{blu pop pop}! /_mag{mag pop pop}! /_gre{gre pop pop}! /_bro{bro pop pop}! /_yel{yel pop pop}! /_ora{ora pop pop}! endps % usage !mag! , deco changing colors of decos deco blk 3 _blk 0 0 0 deco red 3 _red 0 0 0 deco blu 3 _blu 0 0 0 deco mag 3 _mag 0 0 0 deco gre 3 _gre 0 0 0 deco bro 3 _bro 0 0 0 deco yel 3 _yel 0 0 0 deco ora 3 _ora 0 0 0 % user k !blk! % end of col.fmt % ==========================