示例#1
0
 public PageDrawOptions(float pgwi, float pghi, PersistentFont headerFont, PersistentFont footerFont, string header, string footer, float mmky)
 {
     FormatOptions.ConvertFont(headerFont, out HeaderFont, out HeaderColor, mmky);
     FormatOptions.ConvertFont(footerFont, out FooterFont, out FooterColor, mmky);
     Header = header;
     Footer = footer;
     PageWidth = pgwi;
     PageHeight = pghi;
 }
示例#2
0
 public static string FontToRtfStyle(PersistentFont font, int fontindex)
 {
     string res = "";
     res += "\\cf";
     res += fontindex.ToString();
     if (font.Italic) res += "\\i";
     if (font.Underline) res += "\\ul";
     if (font.Bold) res += "\\b";
     return res;
 }
示例#3
0
        public SongPrintFormatOptions(float pgwi, XGraphics infoContext, PersistentFont titleFont, PersistentFont authorFont, SongFormatOptions songOptions, float mmky)
            : base(pgwi, infoContext)
        {
            SongOptions = songOptions;

            ConvertFont(titleFont, out TitleFont, out TitleColor, mmky);
            ConvertFont(authorFont, out AuthorFont, out AuthorColor, mmky);
            TitleHeight = (float)InfoContext.MeasureString("M", TitleFont).Height;
            AuthorHeight = (float)InfoContext.MeasureString("M", AuthorFont).Height;
            HeaderHeight = TitleHeight + AuthorHeight;
        }
示例#4
0
        /*
        public static void SetFont(TextWriter fw, int index, string style, int size)
        {
            fw.Write("\\plain\\f");
            fw.Write(index);
            fw.Write("\\fs");
            fw.Write(size);
            fw.Write(style);
            fw.Write(" ");
        }

        public static string FontToRtfStyle(PersistentFont font, int fontindex)
        {
            string res = "";
            res += "\\cf";
            res += fontindex.ToString();
            if (font.Italic) res += "\\i";
            if (font.Underline) res += "\\ul";
            if (font.Bold) res += "\\b";
            return res;
        }

        public static string ColorToRtfColor(Color color)
        {
            string res = "";
            res += "\\red"; res += color.R;
            res += "\\green"; res += color.G;
            res += "\\blue"; res += color.B;
            res += ";";
            return res;
        }

        public static void SetFont(TextWriter fw, PersistentFont font, int fontindex)
        {
            SetFont(fw, fontindex, FontToRtfStyle(font, fontindex), (int)(font.FontSize * 2));
        }
        */

        public static void WriteFontDef(string cls, PersistentFont font, TextWriter fw)
        {
            fw.Write("." + cls + " { ");
            fw.Write("font-family: " + font.FontName.ToString() + ";");
            fw.Write("font-size: " + ((int)font.FontSize).ToString() + "pt;");
            fw.Write("color: " + HtmlColorName(font.FontColor) + ";");
            if (font.Bold) fw.Write("font-weight: bold;");
            if (font.Italic) fw.Write("font-style: italic;");
            if (font.Underline) fw.Write("text-decoration: underline;");
            fw.Write("}\n");
        }
示例#5
0
        public SongFormatOptions(float pgwi, XGraphics infoContext, PersistentFont textFont, PersistentFont chordFont, PersistentFont labelFont, float mmky)
            : base(pgwi, infoContext)
        {
            //float mmky = CfgTools.Getmmky(infoContext);
            ConvertFont(textFont, out TextFont, out TextColor, mmky);
            ConvertFont(chordFont, out ChordFont, out ChordColor, mmky);
            ConvertFont(labelFont, out LabelFont, out LabelColor, mmky);

            HTextSpace = (float)InfoContext.MeasureString("i", TextFont).Width;
            HChordSpace = (float)InfoContext.MeasureString("i", ChordFont).Width;
            TextHeight = (float)InfoContext.MeasureString("M", TextFont).Height;
            ChordHeight = (float)InfoContext.MeasureString("M", ChordFont).Height;
            LabelHeight = (float)InfoContext.MeasureString("M", LabelFont).Height;
        }
示例#6
0
        public OutlineFormatOptions(float pgwi, float pghi, XGraphics infoContext, PersistentFont titleFont, PersistentFont numberFont, int columns, SongBook songBook, float mmky)
            : base(pgwi, infoContext)
        {
            ConvertFont(titleFont, out TitleFont, out TitleColor, mmky);
            ConvertFont(numberFont, out NumberFont, out NumberColor, mmky);
            PageHeight = pghi;
            Columns = columns;

            ColumnWidth = PageWidth / Columns;
            float numwi = (float)InfoContext.MeasureString("99999", NumberFont).Width;
            ColumnWidthForText = ColumnWidth - numwi;
            NumberLeft = ColumnWidthForText + numwi / 4;
            TitleHeight = (float)InfoContext.MeasureString("M", TitleFont).Height;
            NumberHeight = (float)InfoContext.MeasureString("M", NumberFont).Height;
            SongBook = songBook;
        }
示例#7
0
 public static void SetFont(TextWriter fw, PersistentFont font, int fontindex)
 {
     SetFont(fw, fontindex, FontToRtfStyle(font, fontindex), (int)(font.FontSize * 2));
 }
示例#8
0
 public static void ConvertFont(PersistentFont pfont, out XFont xfont, out XBrush xcolor, float mmky)
 {
     xfont = pfont.ToXFont(mmky);
     using (Brush br = new SolidBrush(pfont.FontColor)) xcolor = (XBrush)br;
 }
 private static XFontStyle ToXFontStyle(PersistentFont font)
 {
     return
       (font.Bold ? XFontStyle.Bold : 0) |
       (font.Italic ? XFontStyle.Italic : 0) |
       (font.Strikeout ? XFontStyle.Strikeout : 0) |
       (font.Underline ? XFontStyle.Underline : 0);
 }
示例#10
0
 public static PersistentFont FromFont(Font font, Color color)
 {
     PersistentFont result = new PersistentFont();
     result.FontName = font.Name;
     result.FontSize = font.Size;
     result.FontStyle = font.Style;
     result.FontColor = color;
     return result;
 }