예제 #1
0
파일: Metadata.cs 프로젝트: suvjunmd/Moritz
        /// <summary>
        /// Writes a metadata element compatible with Inkscape's
        /// </summary>
        /// <param name="w"></param>
        /// <param name="pageNumber"></param>
        /// <param name="nScorePages"></param>
        public void WriteSVG(SvgWriter w, int pageNumber, int nScorePages, string aboutThePieceLinkURL, int nOutputVoices, int nInputVoices)
        {
            Debug.Assert(!String.IsNullOrEmpty(MainTitle));

            string pageTitle;
            if(pageNumber == 0)
            {
                pageTitle = MainTitle + " (scroll)";
            }
            else
            {
                pageTitle = MainTitle + ", page " + pageNumber.ToString() + " of " + nScorePages.ToString();
            }

            w.WriteStartElement("title");
            w.WriteAttributeString("id", "pageTitle");
            w.WriteString(pageTitle);
            w.WriteEndElement();

            w.WriteStartElement("metadata"); // Inkscape compatible
            w.WriteAttributeString("id", "metadata");
            w.WriteStartElement("rdf", "RDF", null);
            w.WriteStartElement("cc", "Work", null);
            w.WriteAttributeString("rdf", "about", null, "");

            w.WriteStartElement("dc", "format", null);
            w.WriteString("image/svg+xml");
            w.WriteEndElement(); // ends the dc:format element

            w.WriteStartElement("dc", "type", null);
            w.WriteAttributeString("rdf", "resource", null, "http://purl.org/dc/dcmitype/StillImage");
            w.WriteEndElement(); // ends the dc:type element

            w.WriteStartElement("dc", "title", null);
            w.WriteString(pageTitle);
            w.WriteEndElement(); // ends the dc:title element

            w.WriteStartElement("dc", "date", null);
            w.WriteString(M.NowString);
            w.WriteEndElement(); // ends the dc:date element

            w.WriteStartElement("dc", "creator", null);
            w.WriteStartElement("cc", "Agent", null);
            w.WriteStartElement("dc", "title", null);
            w.WriteString("James Ingram");
            w.WriteEndElement(); // ends the dc:title element
            w.WriteEndElement(); // ends the cc:Agent element
            w.WriteEndElement(); // ends the dc:creator element

            w.WriteStartElement("dc", "source", null);
            w.WriteString("Website: http://www.james-ingram-act-two.de");
            w.WriteEndElement(); // ends the dc:source element

            if(!string.IsNullOrEmpty(Keywords))
            {
                w.WriteStartElement("dc", "subject", null);
                w.WriteStartElement("rdf", "Bag", null);
                w.WriteStartElement("rdf", "li", null);
                w.WriteString(Keywords);
                w.WriteEndElement(); // ends the rdf:li element
                w.WriteEndElement(); // ends the rdf:Bag element
                w.WriteEndElement(); // ends the dc:subject element
            }

            StringBuilder desc = new StringBuilder("About: " + aboutThePieceLinkURL );
            if(pageNumber == 0)
            {
                desc.Append("\nNumber of pages in the score: 1");
            }
            else
            {
                desc.Append("\nNumber of pages in the score: " + nScorePages.ToString());
            }
            desc.Append("\nNumber of output voices: " + nOutputVoices.ToString());
            desc.Append("\nNumber of input voices: " + nInputVoices.ToString());
            if(!String.IsNullOrEmpty(Comment))
                desc.Append("\nComments: " + Comment);

            w.WriteStartElement("dc", "description", null);
            w.WriteString(desc.ToString());
            w.WriteEndElement(); // ends the dc:description element

            string contributor = "Originally created using Assistant Composer software:" +
                            "\nhttp://james-ingram-act-two.de/moritz3/assistantComposer/assistantComposer.html" +
                            "\nAnnotations, if there are any, have been made using Inkscape.";
            w.WriteStartElement("dc", "contributor", null);
            w.WriteStartElement("cc", "Agent", null);
            w.WriteStartElement("dc", "title", null);
            w.WriteString(contributor);
            w.WriteEndElement(); // ends the dc:title element
            w.WriteEndElement(); // ends the cc:Agent element
            w.WriteEndElement(); // ends the dc:creator element

            w.WriteEndElement(); // ends the cc:Work element
            w.WriteEndElement(); // ends the rdf:RDF element
            w.WriteEndElement(); // ends the metadata element
        }
예제 #2
0
파일: SvgScore.cs 프로젝트: notator/Moritz
        private void WriteFontDefs(SvgWriter w)
        {
            string fontDefs =
            @"
            @font-face
            {
                font-family: 'CLicht';
                src: url('http://james-ingram-act-two.de/fonts/clicht_plain-webfont.eot');
                src: url('http://james-ingram-act-two.de/fonts/clicht_plain-webfont.eot?#iefix') format('embedded-opentype'),
                url('http://james-ingram-act-two.de/fonts/clicht_plain-webfont.woff') format('woff'),
                url('http://james-ingram-act-two.de/fonts/clicht_plain-webfont.ttf') format('truetype'),
                url('http://james-ingram-act-two.de/fonts/clicht_plain-webfont.svg#webfontl9D2oOyX') format('svg');
                font-weight: normal;
                font-style: normal;
            }
            @font-face
            {
                font-family: 'Arial';
                src: url('http://james-ingram-act-two.de/fonts/arial.ttf') format('truetype');
                font-weight:400;
                font-style: normal;
            }
            @font-face
            {
                font-family: 'Open Sans';
                src: url('http://james-ingram-act-two.de/fonts/OpenSans-Regular.ttf') format('truetype');
                font-weight:400;
                font-style: normal;
            }
            @font-face
            {
                font-family: 'Open Sans Condensed';
                src: url('http://james-ingram-act-two.de/fonts/OpenSans-CondBold.ttf') format('truetype');
                font-weight:600;
                font-style: normal;
            }
            ";

            w.WriteStartElement("style");
            w.WriteAttributeString("type", "text/css");
            w.WriteString(fontDefs);
            w.WriteEndElement();
        }
예제 #3
0
        public void WriteSVG(SvgWriter w, int pageNumber, int nScorePages, int nOutputVoices)
        {
            string pageTitle;

            if (pageNumber == 0)
            {
                pageTitle = base.Title + " (scroll)";
            }
            else
            {
                pageTitle = base.Title + ", page " + pageNumber.ToString() + " of " + nScorePages.ToString();
            }

            w.WriteStartElement("title");
            w.WriteAttributeString("class", "pageTitle");
            w.WriteString(pageTitle);
            w.WriteEndElement();

            w.WriteStartElement(CSSObjectClass.metadata.ToString()); // Inkscape compatible
            w.WriteAttributeString("class", CSSObjectClass.metadata.ToString());
            w.WriteStartElement("rdf", "RDF", null);
            w.WriteStartElement("cc", "Work", null);
            w.WriteAttributeString("rdf", "about", null, "");

            w.WriteStartElement("dc", "format", null);
            w.WriteString("image/svg+xml");
            w.WriteEndElement();             // ends the dc:format element

            w.WriteStartElement("dc", "type", null);
            w.WriteAttributeString("rdf", "resource", null, "http://purl.org/dc/dcmitype/StillImage");
            w.WriteEndElement();             // ends the dc:type element

            w.WriteStartElement("dc", "title", null);
            w.WriteString(pageTitle);
            w.WriteEndElement();             // ends the dc:title element

            w.WriteStartElement("dc", "date", null);
            w.WriteString(M.NowString);
            w.WriteEndElement();             // ends the dc:date element

            w.WriteStartElement("dc", "creator", null);
            w.WriteStartElement("cc", "Agent", null);
            w.WriteStartElement("dc", "title", null);
            w.WriteString("James Ingram");
            w.WriteEndElement();             // ends the dc:title element
            w.WriteEndElement();             // ends the cc:Agent element
            w.WriteEndElement();             // ends the dc:creator element

            w.WriteStartElement("dc", "source", null);
            w.WriteString("Website: https://www.james-ingram-act-two.de");
            w.WriteEndElement();             // ends the dc:source element

            if (!string.IsNullOrEmpty(Keywords))
            {
                w.WriteStartElement("dc", "subject", null);
                w.WriteStartElement("rdf", "Bag", null);
                w.WriteStartElement("rdf", "li", null);
                w.WriteString(Keywords);
                w.WriteEndElement();                 // ends the rdf:li element
                w.WriteEndElement();                 // ends the rdf:Bag element
                w.WriteEndElement();                 // ends the dc:subject element
            }

            StringBuilder desc = new StringBuilder();

            if (pageNumber == 0)
            {
                desc.Append("\nNumber of pages in the score: 1");
            }
            else
            {
                desc.Append("\nNumber of pages in the score: " + nScorePages.ToString());
            }
            desc.Append("\nNumber of output voices: " + nOutputVoices.ToString());
            if (!String.IsNullOrEmpty(Comment))
            {
                desc.Append("\nComments: " + Comment);
            }

            w.WriteStartElement("dc", "description", null);
            w.WriteString(desc.ToString());
            w.WriteEndElement();             // ends the dc:description element

            string contributor = "Originally created using Assistant Composer software:" +
                                 "\nhttps://james-ingram-act-two.de/moritz3/assistantComposer/assistantComposer.html" +
                                 "\nAnnotations, if there are any, have been made using Inkscape.";

            w.WriteStartElement("dc", "contributor", null);
            w.WriteStartElement("cc", "Agent", null);
            w.WriteStartElement("dc", "title", null);
            w.WriteString(contributor);
            w.WriteEndElement();             // ends the dc:title element
            w.WriteEndElement();             // ends the cc:Agent element
            w.WriteEndElement();             // ends the dc:creator element

            w.WriteEndElement();             // ends the cc:Work element
            w.WriteEndElement();             // ends the rdf:RDF element
            w.WriteEndElement();             // ends the metadata element
        }
예제 #4
0
 /// <summary>
 /// [g id="trebleClef"]
 ///   [text x="0" y="0" font-size="1px" font-family="CLicht"] &amp; [/text]
 /// [/g]
 /// </summary>
 private void WriteTrebleClefSymbolDef(SvgWriter svgw)
 {
     svgw.WriteStartElement("g");
     svgw.WriteAttributeString("id", "trebleClef");
     svgw.WriteStartElement("text");
     svgw.WriteAttributeString("x", "0");
     svgw.WriteAttributeString("y", "0");
     svgw.WriteAttributeString("font-size", "1px");
     svgw.WriteAttributeString("font-family", "CLicht");
     svgw.WriteString("&");
     svgw.WriteEndElement(); // text
     svgw.WriteEndElement(); // g
 }
예제 #5
0
        /// <summary>
        /// (the actual numbers have changed -- see function below)
        /// [g id="trebleClef2x8"]
        ///     [text x="0" y="0" font-size="1px" font-family="CLicht"]&amp;[/text]
        ///     [text x="0.037" y="-1.17" font-size="0.67px" font-family="CLicht"]™[/text]
        ///     [text x="0.252" y="-1.17" font-size="0.4px" font-family="Arial"]x[/text]
        ///     [text x="0.441" y="-1.17" font-size="0.67px" font-family="CLicht"]•[/text]
        /// [/g]
        /// and
        /// [g id="trebleClef3x8"]
        ///     [text x="0" y="0" font-size="1px" font-family="CLicht"]&amp;[/text]
        ///     [text x="0.037" y="-1.17" font-size="0.67px" font-family="CLicht"]£[/text]
        ///     [text x="0.252" y="-1.17" font-size="0.4px" font-family="Arial"]x[/text]
        ///     [text x="0.441" y="-1.17" font-size="0.67px" font-family="CLicht"]•[/text]
        /// [/g]
        /// </summary>
        private void WriteTrebleClefMulti8SymbolDef(SvgWriter svgw, int octaveShift)
        {
            svgw.WriteStartElement("g");
            svgw.WriteAttributeString("id", "trebleClef" + octaveShift.ToString() + "x8");

            svgw.WriteStartElement("text");
            svgw.WriteAttributeString("x", "0");
            svgw.WriteAttributeString("y", "0");
            svgw.WriteAttributeString("font-size", "1px");
            svgw.WriteAttributeString("font-family", "CLicht");
            svgw.WriteString("&");
            svgw.WriteEndElement(); // text

            svgw.WriteStartElement("text");
            svgw.WriteAttributeString("x", "0.036");
            svgw.WriteAttributeString("y", "-1.17");
            svgw.WriteAttributeString("font-size", "0.67px");
            svgw.WriteAttributeString("font-family", "CLicht");
            switch(octaveShift)
            {
                case 2:
                    svgw.WriteString("™");
                    break;
                case 3:
                    svgw.WriteString("£");
                    break;
            }
            svgw.WriteEndElement(); // text

            svgw.WriteStartElement("text");
            svgw.WriteAttributeString("x", "0.252");
            svgw.WriteAttributeString("y", "-1.17");
            svgw.WriteAttributeString("font-size", "0.4px");
            svgw.WriteAttributeString("font-family", "Arial");
            svgw.WriteString("x");
            svgw.WriteEndElement(); // text

            svgw.WriteStartElement("text");
            svgw.WriteAttributeString("x", "0.48");
            svgw.WriteAttributeString("y", "-1.17");
            svgw.WriteAttributeString("font-size", "0.67px");
            svgw.WriteAttributeString("font-family", "CLicht");
            svgw.WriteString("•");
            svgw.WriteEndElement(); // text

            svgw.WriteEndElement(); // g
        }
예제 #6
0
 /// <summary>
 /// [g id="bassClef8"]
 ///    [text x="0" y="0" font-size="1px" font-family="CLicht"]?[/text]
 ///    [text x="0.16" y="1.1" font-size="0.67px" font-family="CLicht"]•[/text]
 /// [/g]
 /// </summary>
 private void WriteBassClef8SymbolDef(SvgWriter svgw)
 {
     svgw.WriteStartElement("g");
     svgw.WriteAttributeString("id", "bassClef8");
     svgw.WriteStartElement("text");
     svgw.WriteAttributeString("x", "0");
     svgw.WriteAttributeString("y", "0");
     svgw.WriteAttributeString("font-size", "1px");
     svgw.WriteAttributeString("font-family", "CLicht");
     svgw.WriteString("?");
     svgw.WriteEndElement(); // text
     svgw.WriteStartElement("text");
     svgw.WriteAttributeString("x", "0.16");
     svgw.WriteAttributeString("y", "1.1");
     svgw.WriteAttributeString("font-size", "0.67px");
     svgw.WriteAttributeString("font-family", "CLicht");
     svgw.WriteString("•");
     svgw.WriteEndElement(); // text
     svgw.WriteEndElement(); // g
 }
예제 #7
0
파일: Metrics.cs 프로젝트: notator/Moritz
 public override void WriteSVG(SvgWriter w)
 {
     w.WriteStartElement("text");
     w.WriteAttributeString("x", _originX.ToString(M.En_USNumberFormat));
     w.WriteAttributeString("y", _originY.ToString(M.En_USNumberFormat));
     w.WriteAttributeString("font-size", _fontHeight.ToString(M.En_USNumberFormat));
     w.WriteAttributeString("font-family", "CLicht");
     if(! string.IsNullOrEmpty(_colorAttribute))
     {
         w.WriteAttributeString("fill", _colorAttribute);
     }
     switch(_textHorizAlign)
     {
         case TextHorizAlign.left:
             break;
         case TextHorizAlign.center:
             w.WriteAttributeString("text-anchor", "middle");
             break;
         case TextHorizAlign.right:
             w.WriteAttributeString("text-anchor", "end");
             break;
     }
     w.WriteString(_objectType); // e.g. Unicode character
     w.WriteEndElement();
 }