Exemple #1
0
 public CSSStyleDeclaration()
 {
     Color         = new CSSColor();
     Background    = new CSSBackground();
     Padding       = new CSSPadding();
     Margin        = new CSSMargin();
     Border        = new CSSBorder();
     Cursor        = new CSSCursor();
     Float         = new CSSFloat();
     Font          = new CSSFont();
     Left          = new CSSNumber();
     Right         = new CSSNumber();
     Width         = new CSSNumber();
     Height        = new CSSNumber();
     Display       = new CSSDisplay();
     Position      = new CSSPosition();
     ChangedFields = new List <string>();
 }
        public void SetupDefaults()
        {
            _transliterateFileName = false;
            _addFB2Info            = true;
            _addSeqToTitle         = true;
            _sequenceFormat        = @"%bt% %sa.l%-%sn%";
            _noSequenceFormat      = @"%bt% (%sf.l%)";
            _noSeriesFormat        = @"%bt%";
            _authorFormat          = @"%f.c% %m.c% %l.c% %n.c:b%";
            _fileAsFormat          = @"%l.c% %f.c%";
            _skipAboutPage         = false;
            _ignoreTitle           = IgnoreInfoSourceOptions.IgnoreNothing;
            _ignoreAuthors         = IgnoreInfoSourceOptions.IgnoreNothing;
            _ignoreTranslators     = IgnoreInfoSourceOptions.IgnoreNothing;
            _ignoreGenres          = IgnoreInfoSourceOptions.IgnoreNothing;
            _decorateFontNames     = true;
            _transliterationSettings.CopyFrom(new TransliterationSettingsImp {
                Mode = TranslitModeEnum.None
            });


            _fonts.FontFamilies.Clear();
            _fonts.CssElements.Clear();

            CSSFontFamily family = new CSSFontFamily()
            {
                Name = @"LiberationSerif"
            };

            CSSFont font1 = new CSSFont
            {
                FontStyle   = FontStylesEnum.Normal,
                FontVariant = FontVaiantEnum.Normal,
                FontWidth   = FontBoldnessEnum.B400,
                FontStretch = FontStretch.Normal
            };

            font1.Sources.Add(new FontSource()
            {
                Type = SourceTypes.Embedded, Format = FontFormat.Unknown, Location = @"%ResourceFolder%\Fonts/LiberationSerif-Regular.ttf"
            });
            family.Fonts.Add(font1);

            CSSFont font2 = new CSSFont
            {
                FontStyle   = FontStylesEnum.Italic,
                FontVariant = FontVaiantEnum.Normal,
                FontWidth   = FontBoldnessEnum.B400,
                FontStretch = FontStretch.Normal
            };

            font2.Sources.Add(new FontSource()
            {
                Type = SourceTypes.Embedded, Format = FontFormat.Unknown, Location = @"%ResourceFolder%\Fonts/LiberationSerif-Italic.ttf"
            });
            family.Fonts.Add(font2);

            CSSFont font3 = new CSSFont
            {
                FontStyle   = FontStylesEnum.Normal,
                FontVariant = FontVaiantEnum.Normal,
                FontWidth   = FontBoldnessEnum.B700,
                FontStretch = FontStretch.Normal
            };

            font3.Sources.Add(new FontSource()
            {
                Type = SourceTypes.Embedded, Format = FontFormat.Unknown, Location = @"%ResourceFolder%\Fonts/LiberationSerif-Bold.ttf"
            });
            family.Fonts.Add(font3);

            CSSFont font4 = new CSSFont
            {
                FontStyle   = FontStylesEnum.Italic,
                FontVariant = FontVaiantEnum.Normal,
                FontWidth   = FontBoldnessEnum.B700,
                FontStretch = FontStretch.Normal
            };

            font4.Sources.Add(new FontSource()
            {
                Type = SourceTypes.Embedded, Format = FontFormat.Unknown, Location = @"%ResourceFolder%\Fonts/LiberationSerif-BoldItalic.ttf"
            });
            family.Fonts.Add(font4);

            _fonts.FontFamilies.Add(family);



            CSSStylableElement css1 = new CSSStylableElement()
            {
                Name = "body"
            };

            css1.AssignedFontFamilies.Add(family.Name);
            _fonts.CssElements.Add(css1);

            CSSStylableElement css2 = new CSSStylableElement()
            {
                Name = "code"
            };

            css2.AssignedFontFamilies.Add(family.Name);
            _fonts.CssElements.Add(css2);

            CSSStylableElement css3 = new CSSStylableElement()
            {
                Name = "epub"
            };

            css3.AssignedFontFamilies.Add(family.Name);
            _fonts.CssElements.Add(css3);
        }