Exemplo n.º 1
0
 private static WFFontStyle FindFirstAvailableFontStyle(System.Drawing.FontFamily ff)
 {
     if (ff.IsStyleAvailable(WFFontStyle.Regular))
     {
         return(WFFontStyle.Regular);
     }
     else if (ff.IsStyleAvailable(WFFontStyle.Bold))
     {
         return(WFFontStyle.Bold);
     }
     else if (ff.IsStyleAvailable(WFFontStyle.Italic))
     {
         return(WFFontStyle.Italic);
     }
     else if (ff.IsStyleAvailable(WFFontStyle.Strikeout))
     {
         return(WFFontStyle.Strikeout);
     }
     else if (ff.IsStyleAvailable(WFFontStyle.Underline))
     {
         return(WFFontStyle.Underline);
     }
     else
     {
         Logger.Log("resource pool", "no available font style found: " + ff.Name);
         throw new NoAvailableFontStyleException();
     }
 }
Exemplo n.º 2
0
        public FontFamily(string fontPath)
        {
            if (ffs.ContainsKey(fontPath))
            {
                var ff = ffs[fontPath];
                this.id         = ff.id;
                this.fontFamily = ff.fontFamily;
                this.fontStyle  = ff.fontStyle;
            }
            else
            {
                if (pfc == null)
                {
                    pfc = new System.Drawing.Text.PrivateFontCollection();
                }
                id = pfc.Families.Length;

                pfc.AddFontFile(fontPath);
                fontFamily = pfc.Families[id];

                // 自動でフォントスタイルを設定する
                if (fontFamily.IsStyleAvailable(System.Drawing.FontStyle.Regular))
                {
                    this.fontStyle = System.Drawing.FontStyle.Regular;
                }
                else if (fontFamily.IsStyleAvailable(System.Drawing.FontStyle.Bold))
                {
                    this.fontStyle = System.Drawing.FontStyle.Bold;
                }
                else if (fontFamily.IsStyleAvailable(System.Drawing.FontStyle.Italic))
                {
                    this.fontStyle = System.Drawing.FontStyle.Italic;
                }
                else if (fontFamily.IsStyleAvailable(System.Drawing.FontStyle.Strikeout))
                {
                    this.fontStyle = System.Drawing.FontStyle.Strikeout;
                }
                else if (fontFamily.IsStyleAvailable(System.Drawing.FontStyle.Underline))
                {
                    this.fontStyle = System.Drawing.FontStyle.Strikeout;
                }

                ffs.Add(fontPath, this);
            }
        }
Exemplo n.º 3
0
 void UpdateFontStyles()
 {
     fontStyle.Items.Clear();
     using (var font = new System.Drawing.FontFamily(settings.fontName))
     {
         foreach (var k in fontStyles.Keys)
         {
             if (font.IsStyleAvailable(k))
             {
                 fontStyle.Items.Add(new ComboBoxItem()
                 {
                     Content = fontStyles[k]
                 });
             }
         }
     }
     fontStyle.SelectedIndex = 0;
 }
Exemplo n.º 4
0
        public WFFont GetFont(string familyName, double emSizeD, WFFontStyle wfs)
        {
            float emSize = (float)emSizeD;
#endif // WPF

#if DEBUG
            Stopwatch sw = Stopwatch.StartNew();
#endif // DEBUG

            if (string.IsNullOrEmpty(familyName))
            {
                familyName = System.Drawing.SystemFonts.DefaultFont.FontFamily.Name;
            }

            WFFont                    font      = null;
            List <WFFont>             fontGroup = null;
            System.Drawing.FontFamily family    = null;

            lock (this.fonts)
            {
                if (this.fonts.TryGetValue(familyName, out fontGroup))
                {
                    if (fontGroup.Count > 0)
                    {
                        family = fontGroup[0].FontFamily;
                    }

                    lock (fontGroup)
                    {
                        font = fontGroup.FirstOrDefault(f => f.Size == emSize && f.Style == wfs);
                    }
                }
            }

            if (font != null)
            {
                return(font);
            }

            if (family == null)
            {
                try
                {
                    family = new System.Drawing.FontFamily(familyName);
                }
                catch (ArgumentException ex)
                {
                    //throw new FontNotFoundException(ex.ParamName);
                    family = System.Drawing.SystemFonts.DefaultFont.FontFamily;
                    Logger.Log("resource pool", "font family error: " + familyName + ": " + ex.Message);
                }

                if (!family.IsStyleAvailable(wfs))
                {
                    try
                    {
                        wfs = FindFirstAvailableFontStyle(family);
                    }
                    catch
                    {
                        return(System.Drawing.SystemFonts.DefaultFont);
                    }
                }
            }

            lock (this.fonts)
            {
                if (fonts.TryGetValue(family.Name, out fontGroup))
                {
                    lock (fontGroup)
                    {
                        font = fontGroup.FirstOrDefault(f => f.Size == emSize && f.Style == wfs);
                    }
                }
            }

            if (font == null)
            {
                font = new WFFont(family, emSize, wfs);

                if (fontGroup == null)
                {
                    lock (this.fonts)
                    {
                        fonts.Add(family.Name, fontGroup = new List <WFFont> {
                            font
                        });
                    }
                    Logger.Log("resource pool", "font resource group added. font groups: " + fonts.Count);
                }
                else
                {
                    lock (fontGroup)
                    {
                        fontGroup.Add(font);
                    }
                    Logger.Log("resource pool", "font resource added. fonts: " + fontGroup.Count);
                }
            }

#if DEBUG
            sw.Stop();
            long ms = sw.ElapsedMilliseconds;
            if (ms > 10)
            {
                Debug.WriteLine("resource pool: font scan: " + sw.ElapsedMilliseconds + " ms.");
            }
#endif // DEBUG
            return(font);
        }
Exemplo n.º 5
0
        public sFont(String name, String path, int scale, bool replacement)
        {
            String fontPath  = cProperties.getProperty("path_fonts");
            String skinPath  = cProperties.getProperty("path_skin");
            String skinsPath = cProperties.getProperty("path");

            pfc = new PrivateFontCollection();

            Name = name;
            Path = path;

            Scale       = scale;
            Replacement = replacement;

            //This way we have only the file name, but what happens if the fonts are in the skin directory ?
            //Lets check all posibilities
            Filename = Path.Substring(Path.LastIndexOf('/') > 0?Path.LastIndexOf('/') + 1:0);
            String AbsolutPathFont         = fontPath + "/" + Filename;
            String AbsolutPathSkinPathFont = skinsPath + "/" + skinPath + "/" + Filename;
            String RelativPathFont         = Path;
            String RelativPathSkinPathFont = skinsPath + "/" + skinPath + "/" + Path;

            RelativPathFont = Path;
            RelativPathFont = RelativPathFont.Replace("enigma2", "");
            RelativPathFont = RelativPathFont.Replace("usr", "");
            RelativPathFont = RelativPathFont.Replace("local", "");
            RelativPathFont = RelativPathFont.Replace("share", "");
            RelativPathFont = RelativPathFont.Replace("var", "");
            RelativPathFont = skinsPath + "/" + RelativPathFont;

            AbsolutPathFont         = AbsolutPathFont.Replace("\\", "/");
            AbsolutPathSkinPathFont = AbsolutPathSkinPathFont.Replace("\\", "/");
            RelativPathFont         = RelativPathFont.Replace("\\", "/");
            RelativPathSkinPathFont = RelativPathSkinPathFont.Replace("\\", "/");


            //RelativPathFont = fontPath.Replace("fonts", "") + RelativPathFont;

            String lookupPath = "";

            if (File.Exists(AbsolutPathFont))
            {
                lookupPath = new FileInfo(AbsolutPathFont).FullName;
            }
            else if (File.Exists(AbsolutPathSkinPathFont))
            {
                lookupPath = new FileInfo(AbsolutPathSkinPathFont).FullName;
            }
            else if (File.Exists(RelativPathFont))
            {
                lookupPath = new FileInfo(RelativPathFont).FullName;
            }
            else if (File.Exists(RelativPathSkinPathFont))
            {
                lookupPath = new FileInfo(RelativPathSkinPathFont).FullName;
            }
            else
            {
                String errorMessage = "";
                errorMessage += "e2skinner2 has searched in several places for the font \"" + Filename + ".\"\n";
                errorMessage += "Unfortunatly the search was not successful.\n";
                errorMessage += "\n";
                errorMessage += "Search Locations:\n";
                errorMessage += "\t" + new FileInfo(AbsolutPathFont).FullName + "\n";
                errorMessage += "\t" + new FileInfo(AbsolutPathSkinPathFont).FullName + "\n";
                errorMessage += "\t" + new FileInfo(RelativPathFont).FullName + "\n";
                errorMessage += "\t" + new FileInfo(RelativPathSkinPathFont).FullName + "\n";

                MessageBox.Show(errorMessage,
                                "Error while loading fonts",
                                MessageBoxButtons.OK,
                                MessageBoxIcon.Information,
                                MessageBoxDefaultButton.Button1);

                return;
            }

            try
            {
                pfc.AddFontFile(lookupPath);
            }
            catch (FileNotFoundException error)
            {
                String errorMessage = "";
                errorMessage += "e2skinner2 has tried to open the font \"" + Filename + "\".\n";
                errorMessage += "Unfortunatly this was not successful.\n";
                errorMessage += "Either the font type is not supported by e2kinner2,\n";
                errorMessage += "or it is not a vaild font.\n";
                errorMessage += "\n";
                errorMessage += "Location:\n";
                errorMessage += "\t" + new FileInfo(lookupPath).FullName + "\n" + error + "\n";

                MessageBox.Show(errorMessage,
                                "Error while loading fonts",
                                MessageBoxButtons.OK,
                                MessageBoxIcon.Information,
                                MessageBoxDefaultButton.Button1);

                return;
            }

            FontFamily = pfc.Families[0];
            String name2 = FontFamily.GetName(0);

            FontStyle = System.Drawing.FontStyle.Regular;
            if (FontFamily.IsStyleAvailable(System.Drawing.FontStyle.Regular))
            {
                FontStyle = System.Drawing.FontStyle.Regular;
            }
            else
            {
                FontStyle = System.Drawing.FontStyle.Bold;
            }

            int t1 = FontFamily.GetCellAscent(FontStyle);
            int t2 = FontFamily.GetCellDescent(FontStyle);
            int t3 = FontFamily.GetEmHeight(FontStyle);
            int t4 = FontFamily.GetLineSpacing(FontStyle);
        }
Exemplo n.º 6
0
        private void TextEditor_SelectionChanged(object sender, EventArgs e)
        {
            try
            {
                #region Alignment
                if (TextEditor.SelectionAlignment == ExtendedRichTextBox.RichTextAlign.Left)
                {
                    DesignerPage.self.btnAlignLeft.IsChecked   = true;
                    DesignerPage.self.btnAlignCenter.IsChecked = false;
                    DesignerPage.self.btnAlignRight.IsChecked  = false;
                    DesignerPage.self.btnJustify.IsChecked     = false;
                }
                else if (TextEditor.SelectionAlignment == ExtendedRichTextBox.RichTextAlign.Center)
                {
                    DesignerPage.self.btnAlignLeft.IsChecked   = false;
                    DesignerPage.self.btnAlignCenter.IsChecked = true;
                    DesignerPage.self.btnAlignRight.IsChecked  = false;
                    DesignerPage.self.btnJustify.IsChecked     = false;
                }
                else if (TextEditor.SelectionAlignment == ExtendedRichTextBox.RichTextAlign.Right)
                {
                    DesignerPage.self.btnAlignLeft.IsChecked   = false;
                    DesignerPage.self.btnAlignCenter.IsChecked = false;
                    DesignerPage.self.btnAlignRight.IsChecked  = true;
                    DesignerPage.self.btnJustify.IsChecked     = false;
                }
                else if (TextEditor.SelectionAlignment == ExtendedRichTextBox.RichTextAlign.Justify)
                {
                    DesignerPage.self.btnAlignLeft.IsChecked   = false;
                    DesignerPage.self.btnAlignRight.IsChecked  = false;
                    DesignerPage.self.btnAlignCenter.IsChecked = false;
                    DesignerPage.self.btnJustify.IsChecked     = true;
                }
                else
                {
                    DesignerPage.self.btnAlignLeft.IsChecked   = true;
                    DesignerPage.self.btnAlignCenter.IsChecked = false;
                    DesignerPage.self.btnAlignRight.IsChecked  = false;
                }

                #endregion

                #region Tab positions
                this.Ruler.SetTabPositionsInPixels(this.TextEditor.SelectionTabs);
                #endregion

                #region Color
                System.Drawing.Color       curColor = this.TextEditor.SelectionColor2;
                System.Windows.Media.Color selColor = System.Windows.Media.Color.FromArgb(255, curColor.R, curColor.G, curColor.B);

                foreach (DesignerPage.ColorInfo cf in DesignerPage.self.cmbColorName.Items)
                {
                    if (cf.Color == selColor)
                    {
                        DesignerPage.self.cmbColorName.SelectedItem = cf;
                        break;
                    }
                }
                #endregion

                #region Font
                try
                {
                    DesignerPage.self.cmbFontSize.Text = Convert.ToInt32(this.TextEditor.SelectionFont2.Size).ToString();
                }
                catch
                {
                    DesignerPage.self.cmbFontSize.Text = "";
                }

                try
                {
                    DesignerPage.self.cmbFontName.Text = this.TextEditor.SelectionFont2.Name;
                }
                catch
                {
                    DesignerPage.self.cmbFontName.Text = "";
                }

                if (DesignerPage.self.cmbFontName.Text != "")
                {
                    System.Drawing.FontFamily ff = new System.Drawing.FontFamily(DesignerPage.self.cmbFontName.Text);
                    if (ff.IsStyleAvailable(System.Drawing.FontStyle.Bold) == true)
                    {
                        DesignerPage.self.btnBold.IsEnabled = true;
                        DesignerPage.self.btnBold.IsChecked = this.TextEditor.SelectionCharStyle.Bold;
                    }
                    else
                    {
                        DesignerPage.self.btnBold.IsEnabled = false;
                        DesignerPage.self.btnBold.IsChecked = false;
                    }

                    if (ff.IsStyleAvailable(System.Drawing.FontStyle.Italic) == true)
                    {
                        DesignerPage.self.btnItalic.IsEnabled = true;
                        DesignerPage.self.btnItalic.IsChecked = this.TextEditor.SelectionCharStyle.Italic;
                    }
                    else
                    {
                        DesignerPage.self.btnItalic.IsEnabled = false;
                        DesignerPage.self.btnItalic.IsChecked = false;
                    }

                    if (ff.IsStyleAvailable(System.Drawing.FontStyle.Underline) == true)
                    {
                        DesignerPage.self.btnUnderline.IsEnabled = true;
                        DesignerPage.self.btnUnderline.IsChecked = this.TextEditor.SelectionCharStyle.Underline;
                    }
                    else
                    {
                        DesignerPage.self.btnUnderline.IsEnabled = false;
                        DesignerPage.self.btnUnderline.IsChecked = false;
                    }

                    if (ff.IsStyleAvailable(System.Drawing.FontStyle.Strikeout) == true)
                    {
                        DesignerPage.self.btnStrikeThrough.IsEnabled = true;
                        DesignerPage.self.btnStrikeThrough.IsChecked = this.TextEditor.SelectionCharStyle.Strikeout;
                    }
                    else
                    {
                        DesignerPage.self.btnStrikeThrough.IsEnabled = false;
                        DesignerPage.self.btnStrikeThrough.IsChecked = false;
                    }

                    ff.Dispose();
                }
                else
                {
                    DesignerPage.self.btnBold.IsChecked          = false;
                    DesignerPage.self.btnItalic.IsChecked        = false;
                    DesignerPage.self.btnUnderline.IsChecked     = false;
                    DesignerPage.self.btnStrikeThrough.IsChecked = false;
                }
                #endregion

                if (this.TextEditor.SelectionLength < this.TextEditor.TextLength - 1)
                {
                    this.Ruler.LeftIndent = (int)(this.TextEditor.SelectionIndent / this.Ruler.DotsPerMillimeter);                                              //convert pixels to millimeter

                    this.Ruler.LeftHangingIndent = (int)((float)this.TextEditor.SelectionHangingIndent / this.Ruler.DotsPerMillimeter) + this.Ruler.LeftIndent; //convert pixels to millimeters

                    this.Ruler.RightIndent = (int)(this.TextEditor.SelectionRightIndent / this.Ruler.DotsPerMillimeter);                                        //convert pixels to millimeters
                }

                switch (this.TextEditor.SelectionListType.Type)
                {
                case ExtendedRichTextBox.ParaListStyle.ListType.None:
                    DesignerPage.self.btnNumberedList.IsChecked = false;
                    DesignerPage.self.btnBulletedList.IsChecked = false;
                    break;

                case ExtendedRichTextBox.ParaListStyle.ListType.SmallLetters:
                    DesignerPage.self.btnNumberedList.IsChecked = false;
                    DesignerPage.self.btnBulletedList.IsChecked = false;
                    break;

                case ExtendedRichTextBox.ParaListStyle.ListType.CapitalLetters:
                    DesignerPage.self.btnNumberedList.IsChecked = false;
                    DesignerPage.self.btnBulletedList.IsChecked = false;
                    break;

                case ExtendedRichTextBox.ParaListStyle.ListType.SmallRoman:
                    DesignerPage.self.btnNumberedList.IsChecked = false;
                    DesignerPage.self.btnBulletedList.IsChecked = false;
                    break;

                case ExtendedRichTextBox.ParaListStyle.ListType.CapitalRoman:
                    DesignerPage.self.btnNumberedList.IsChecked = false;
                    DesignerPage.self.btnBulletedList.IsChecked = false;
                    break;

                case ExtendedRichTextBox.ParaListStyle.ListType.Bullet:
                    DesignerPage.self.btnNumberedList.IsChecked = false;
                    DesignerPage.self.btnBulletedList.IsChecked = true;
                    break;

                case ExtendedRichTextBox.ParaListStyle.ListType.Numbers:
                    DesignerPage.self.btnNumberedList.IsChecked = true;
                    DesignerPage.self.btnBulletedList.IsChecked = false;
                    break;

                case ExtendedRichTextBox.ParaListStyle.ListType.CharBullet:
                    DesignerPage.self.btnNumberedList.IsChecked = true;
                    DesignerPage.self.btnBulletedList.IsChecked = false;
                    break;

                default:
                    break;
                }


                this.TextEditor.UpdateObjects();
            }
            catch (Exception)
            {
            }
        }
Exemplo n.º 7
0
        public sFont(String name, String path, int scale, int size, String fontName, bool replacement, bool isAlias = false)
        {
            String fontPath  = cProperties.getProperty("path_fonts");
            String skinPath  = cProperties.getProperty("path_skin");
            String skinsPath = cProperties.getProperty("path");

            pfc = new PrivateFontCollection();

            this.Name = name;
            this.Path = path;

            this.Scale       = scale;
            this.Replacement = replacement;
            this.Size        = size;
            this.FontName    = fontName;
            this.isAlias     = isAlias;

            //This way we have only the file name, but what happens if the fonts are in the skin directory ?
            //Lets check all posibilities
            Filename = Path.Substring(Path.LastIndexOf('/') > 0?Path.LastIndexOf('/') + 1:0);
            String AbsolutPathFont         = fontPath + "/" + Filename;
            String AbsolutPathSkinPathFont = skinsPath + "/" + skinPath + "/" + Filename;
            String RelativPathFont         = Path;
            // RelativPathSkinPathFont was the same path as AbsolutPathSkinPathFont
            String RelativPathSkinPathFont = skinsPath + "/" + skinPath + "/" + Path;

            // so changed it to look up in skin-path / fonts
            RelativPathSkinPathFont = skinsPath + "/" + skinPath + "/" + "fonts" + "/" + Path;

            RelativPathFont = Path;
            RelativPathFont = RelativPathFont.Replace("enigma2", "");
            RelativPathFont = RelativPathFont.Replace("usr", "");
            RelativPathFont = RelativPathFont.Replace("local", "");
            RelativPathFont = RelativPathFont.Replace("share", "");
            RelativPathFont = RelativPathFont.Replace("var", "");
            RelativPathFont = skinsPath + "/" + RelativPathFont;

            AbsolutPathFont         = AbsolutPathFont.Replace("\\", "/");
            AbsolutPathSkinPathFont = AbsolutPathSkinPathFont.Replace("\\", "/");
            RelativPathFont         = RelativPathFont.Replace("\\", "/");
            RelativPathSkinPathFont = RelativPathSkinPathFont.Replace("\\", "/");


            //RelativPathFont = fontPath.Replace("fonts", "") + RelativPathFont;

            String lookupPath = "";

            if (File.Exists(AbsolutPathFont))
            {
                lookupPath = new FileInfo(AbsolutPathFont).FullName;
            }
            else if (File.Exists(AbsolutPathSkinPathFont))
            {
                lookupPath = new FileInfo(AbsolutPathSkinPathFont).FullName;
            }
            else if (File.Exists(RelativPathFont))
            {
                lookupPath = new FileInfo(RelativPathFont).FullName;
            }
            else if (File.Exists(RelativPathSkinPathFont))
            {
                lookupPath = new FileInfo(RelativPathSkinPathFont).FullName;
            }
            else
            {
                Found = false;
                String errorMessage = "";
                errorMessage += "OpenSkinDesigner has searched in several places for the font \"" + Filename + ".\"\n";
                errorMessage += "Unfortunatly the search was not successful.\n";
                errorMessage += "\n";
                errorMessage += "Search Locations:\n\n";
                errorMessage += new FileInfo(AbsolutPathFont).FullName + "\n\n";
                errorMessage += new FileInfo(AbsolutPathSkinPathFont).FullName + "\n\n";
                errorMessage += new FileInfo(RelativPathFont).FullName + "\n\n";
                errorMessage += new FileInfo(RelativPathSkinPathFont).FullName + "\n\n";

                // Openskindesigner contains lcd.ttf by default and should be existing...
                AbsolutPathFont = fontPath + "/" + "lcd.ttf";
                if (File.Exists(AbsolutPathFont))
                {
                    errorMessage += "\n" + "Using 'lcd.tff' instead of " + Filename + "\n";
                }

                errorMessage += Environment.NewLine + Environment.NewLine + "Show this message again?";

                DialogResult dr = new DialogResult();
                if (MyGlobaleVariables.ShowMsgFontNotFound == true)
                {
                    dr = MessageBox.Show(errorMessage,
                                         "Error while loading fonts",
                                         MessageBoxButtons.YesNo,
                                         MessageBoxIcon.Information,
                                         MessageBoxDefaultButton.Button1);
                }
                if (dr == DialogResult.No)
                {
                    MyGlobaleVariables.ShowMsgFontNotFound = false;
                }


                if (File.Exists(AbsolutPathFont))
                {
                    lookupPath = new FileInfo(AbsolutPathFont).FullName;
                }
                else
                {
                    return;
                }
            }

            try
            {
                pfc.AddFontFile(lookupPath);
            }
            catch (FileNotFoundException error)
            {
                String errorMessage = "";
                errorMessage += "OpenSkinDesigner has tried to open the font \"" + Filename + "\".\n";
                errorMessage += "Unfortunatly this was not successful.\n";
                errorMessage += "Either the font type is not supported by OpenSkinDesigner,\n";
                errorMessage += "or it is not a valid font.\n";
                errorMessage += "\n";
                errorMessage += "Location:\n";
                errorMessage += "\t" + new FileInfo(lookupPath).FullName + "\n" + error + "\n";

                MessageBox.Show(errorMessage,
                                "Error while loading fonts",
                                MessageBoxButtons.OK,
                                MessageBoxIcon.Information,
                                MessageBoxDefaultButton.Button1);

                return;
            }

            FontFamily = pfc.Families[0];
            String name2 = FontFamily.GetName(0);

            FontStyle = System.Drawing.FontStyle.Regular;
            if (FontFamily.IsStyleAvailable(System.Drawing.FontStyle.Regular))
            {
                FontStyle = System.Drawing.FontStyle.Regular;
            }
            else
            {
                FontStyle = System.Drawing.FontStyle.Bold;
            }

            int t1 = FontFamily.GetCellAscent(FontStyle);
            int t2 = FontFamily.GetCellDescent(FontStyle);
            int t3 = FontFamily.GetEmHeight(FontStyle);
            int t4 = FontFamily.GetLineSpacing(FontStyle);
        }
Exemplo n.º 8
0
        public sFont(String name, String path, int scale, bool replacement)
        {
            String fontPath = cProperties.getProperty("path_fonts");
            String skinPath = cProperties.getProperty("path_skin");
            String skinsPath = cProperties.getProperty("path");

            pfc = new PrivateFontCollection();

            Name = name; 
            Path = path;

            Scale = scale;
            Replacement = replacement;

            //This way we have only the file name, but what happens if the fonts are in the skin directory ?
            //Lets check all posibilities
            Filename = Path.Substring(Path.LastIndexOf('/')>0?Path.LastIndexOf('/')+1:0);
            String AbsolutPathFont = fontPath + "/" + Filename;
            String AbsolutPathSkinPathFont = skinsPath + "/" + skinPath + "/" + Filename;
            String RelativPathFont = Path;
            String RelativPathSkinPathFont = skinsPath + "/" + skinPath + "/" + Path;
            RelativPathFont = Path;
            RelativPathFont = RelativPathFont.Replace("enigma2", "");
            RelativPathFont = RelativPathFont.Replace("usr", "");
            RelativPathFont = RelativPathFont.Replace("local", "");
            RelativPathFont = RelativPathFont.Replace("share", "");
            RelativPathFont = RelativPathFont.Replace("var", "");
            RelativPathFont = skinsPath + "/" + RelativPathFont;

            AbsolutPathFont = AbsolutPathFont.Replace("\\", "/");
            AbsolutPathSkinPathFont = AbsolutPathSkinPathFont.Replace("\\", "/");
            RelativPathFont = RelativPathFont.Replace("\\", "/");
            RelativPathSkinPathFont = RelativPathSkinPathFont.Replace("\\", "/");


            //RelativPathFont = fontPath.Replace("fonts", "") + RelativPathFont;

            String lookupPath = "";
            if (File.Exists(AbsolutPathFont))
                lookupPath = new FileInfo(AbsolutPathFont).FullName;
            else if (File.Exists(AbsolutPathSkinPathFont))
                lookupPath = new FileInfo(AbsolutPathSkinPathFont).FullName;
            else if (File.Exists(RelativPathFont))
                lookupPath = new FileInfo(RelativPathFont).FullName;
            else if (File.Exists(RelativPathSkinPathFont))
                lookupPath = new FileInfo(RelativPathSkinPathFont).FullName;
            else
            {
                String errorMessage = "";
                errorMessage += "e2skinner2 has searched in several places for the font \"" + Filename + ".\"\n";
                errorMessage += "Unfortunatly the search was not successful.\n";
                errorMessage += "\n";
                errorMessage += "Search Locations:\n";
                errorMessage += "\t" + new FileInfo(AbsolutPathFont).FullName + "\n";
                errorMessage += "\t" + new FileInfo(AbsolutPathSkinPathFont).FullName + "\n";
                errorMessage += "\t" + new FileInfo(RelativPathFont).FullName + "\n";
                errorMessage += "\t" + new FileInfo(RelativPathSkinPathFont).FullName + "\n";

                MessageBox.Show(errorMessage,
                    "Error while loading fonts",
                    MessageBoxButtons.OK,
                    MessageBoxIcon.Information,
                    MessageBoxDefaultButton.Button1);

                return;
            }

            try
            {
                pfc.AddFontFile(lookupPath);
            }
            catch (FileNotFoundException error)
            {
                String errorMessage = "";
                errorMessage += "e2skinner2 has tried to open the font \"" + Filename + "\".\n";
                errorMessage += "Unfortunatly this was not successful.\n";
                errorMessage += "Either the font type is not supported by e2kinner2,\n";
                errorMessage += "or it is not a vaild font.\n";
                errorMessage += "\n";
                errorMessage += "Location:\n";
                errorMessage += "\t" + new FileInfo(lookupPath).FullName + "\n" + error + "\n";

                MessageBox.Show(errorMessage,
                    "Error while loading fonts",
                    MessageBoxButtons.OK,
                    MessageBoxIcon.Information,
                    MessageBoxDefaultButton.Button1);

                return;
            }

            FontFamily = pfc.Families[0];
            String name2 = FontFamily.GetName(0);
            FontStyle = System.Drawing.FontStyle.Regular;
            if (FontFamily.IsStyleAvailable(System.Drawing.FontStyle.Regular))
                FontStyle = System.Drawing.FontStyle.Regular;
            else
                FontStyle = System.Drawing.FontStyle.Bold;

            int t1 = FontFamily.GetCellAscent(FontStyle);
            int t2 = FontFamily.GetCellDescent(FontStyle);
            int t3 = FontFamily.GetEmHeight(FontStyle);
            int t4 = FontFamily.GetLineSpacing(FontStyle);
        }