Ejemplo n.º 1
0
        public void ReadXml(XmlReader reader)
        {
            _fonts.Clear();
            reader.MoveToContent();
            string nameAttribute = reader.GetAttribute(NameAttributeName);

            if (string.IsNullOrEmpty(nameAttribute))
            {
                throw new InvalidDataException("Font family name can't be empty");
            }
            _name = nameAttribute;
            while (!reader.EOF)
            {
                if (reader.IsStartElement())
                {
                    switch (reader.Name)
                    {
                    case  CSSFont.FontElementName:
                        var font = new CSSFont();
                        font.ReadXml(reader.ReadSubtree());
                        _fonts.Add(font);
                        continue;
                    }
                }
                reader.Read();
            }
        }
Ejemplo n.º 2
0
 private void ShowCurrentFontDetails(CSSFont currentFont)
 {
     if (currentFont != null)
     {
         SetStyleCheck(currentFont.FontStyle);
         SetVariantCheck(currentFont.FontVariant);
         SetWidthBox(currentFont.FontWidth);
         SetStretchBox(currentFont.FontStretch);
     }
     buttonDeleteFont.Enabled = (currentFont != null);
 }
Ejemplo n.º 3
0
 private void buttonAddFont_Click(object sender, EventArgs e)
 {
     var newFont = new CSSFont
                           {
                               FontStretch = FontStretch.Normal,
                               FontStyle = FontStylesEnum.Normal,
                               FontVariant = FontVaiantEnum.Normal,
                               FontWidth = FontBoldnessEnum.Normal
                           };
     _fontSettings.Fonts[_familyFontName].Fonts.Add(newFont);
     _myDataSourceFonts.ResetBindings(false);
 }
Ejemplo n.º 4
0
        private void buttonAddFont_Click(object sender, EventArgs e)
        {
            var newFont = new CSSFont
            {
                FontStretch = FontStretch.Normal,
                FontStyle   = FontStylesEnum.Normal,
                FontVariant = FontVaiantEnum.Normal,
                FontWidth   = FontBoldnessEnum.Normal
            };

            _fontSettings.Fonts[_familyFontName].Fonts.Add(newFont);
            _myDataSourceFonts.ResetBindings(false);
        }
Ejemplo n.º 5
0
        void MyDataSourceFontsCurrentChanged(object sender, EventArgs e)
        {
            CSSFont currentFont = _myDataSourceFonts.Current as CSSFont;

            ShowCurrentFontDetails(currentFont);

            var currentSource = _myDataSourceSources.Current as FontSource;

            if (currentSource != null)
            {
                ShowCurrentSourceDetails(currentSource);
            }
        }
Ejemplo n.º 6
0
 /// <summary>
 /// Copy from another CSSFontFamily allocating new objects
 /// </summary>
 /// <param name="cssFontFamily"></param>
 public void CopyFrom(ICSSFontFamily cssFontFamily)
 {
     if (cssFontFamily == null)
     {
         throw new ArgumentNullException("cssFontFamily");
     }
     if (cssFontFamily == this)
     {
         return;
     }
     _name = cssFontFamily.Name;
     _fonts.Clear();
     foreach (var cssFont in cssFontFamily.Fonts)
     {
         CSSFont newFont = new CSSFont();
         newFont.CopyFrom(cssFont);
         _fonts.Add(newFont);
     }
 }
        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);
        }
Ejemplo n.º 8
0
 /// <summary>
 /// Copy from another CSSFontFamily allocating new objects
 /// </summary>
 /// <param name="cssFontFamily"></param>
 public void CopyFrom(ICSSFontFamily cssFontFamily)
 {
     if (cssFontFamily == null)
     {
         throw new ArgumentNullException("cssFontFamily");
     }
     if (cssFontFamily == this)
     {
         return;
     }
     _name = cssFontFamily.Name;
     _fonts.Clear();
     foreach (var cssFont in cssFontFamily.Fonts)
     {
         CSSFont newFont = new CSSFont();
         newFont.CopyFrom(cssFont);
         _fonts.Add(newFont);
     }
 }
Ejemplo n.º 9
0
 public void ReadXml(XmlReader reader)
 {
     _fonts.Clear();
     reader.MoveToContent();
     string nameAttribute = reader.GetAttribute(NameAttributeName);
     if (string.IsNullOrEmpty(nameAttribute))
     {
         throw new InvalidDataException("Font family name can't be empty");
     }
     _name = nameAttribute;
     while (!reader.EOF)
     {
         if (reader.IsStartElement())
         {
             switch (reader.Name)
             {
                 case  CSSFont.FontElementName:
                     var font = new CSSFont();
                     font.ReadXml(reader.ReadSubtree());
                     _fonts.Add(font);
                     continue;
             }
         }
         reader.Read();
     }
 }
Ejemplo n.º 10
0
 private void ShowCurrentFontDetails(CSSFont currentFont)
 {
     if (currentFont != null)
     {
         SetStyleCheck(currentFont.FontStyle);
         SetVariantCheck(currentFont.FontVariant);
         SetWidthBox(currentFont.FontWidth);
         SetStretchBox(currentFont.FontStretch);
     }
     buttonDeleteFont.Enabled = (currentFont != null);
 }