Пример #1
0
  static void Main(string[] args)
  {
    InstalledFontCollection ifc = new InstalledFontCollection();
    foreach (FontFamily ff in ifc.Families) {
    	PrintEmHeight(ff.Name);
	}
  }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (this.IsPostBack == false)
        {
            // Set color options.
            //string[] colorArray = Enum.GetNames(typeof(KnownColor));
            //lstBackColor.DataSource = colorArray;
            //lstBackColor.DataBind();
            //lstBackColor.SelectedValue = "Crimson";

            // Set font options.
            InstalledFontCollection fonts = new InstalledFontCollection();
            foreach (FontFamily family in fonts.Families)
            {
                lstFontName.Items.Add(family.Name);
            }
            lstFontName.SelectedValue = "Segoe Script";

            // Select the first border option.
            lstBorder.SelectedIndex = 1;

            // Set border style options.
            string[] borderStyleArray = Enum.GetNames(typeof(BorderStyle));
            lstBorder.DataSource = borderStyleArray;
            lstBorder.DataBind();
        }
        //System.Threading.Thread.Sleep(2000);
    }
Пример #3
0
 public static void Main()
 {
     InstalledFontCollection correction = new InstalledFontCollection();
     FontFamily[] family = correction.Families;
     for (int i = 0; i < family.Length; ++i)
     {
     Console.WriteLine("[{0}] {1}", i, family[i].Name);
     }
 }
Пример #4
0
    private void LoadFont()
    {
        InstalledFontCollection fonts = new InstalledFontCollection();
        foreach (FontFamily family in fonts.Families)
        {
            if (family.IsStyleAvailable(FontStyle.Regular & FontStyle.Bold & FontStyle.Italic & FontStyle.Underline))
            {
                ddlFont.Items.Add(family.Name);
            }
        }

        ddlFont.SelectedValue = "宋体";
    }
Пример #5
0
 private void LoadFonts()
 {
     using (InstalledFontCollection fontsCollection = new InstalledFontCollection())
     {
         FontFamily[] fontFamilies = fontsCollection.Families;
         foreach (FontFamily font in fontFamilies)
         {
             if (font.Name != "")
             {
                 CBFonts.Items.Add(font.Name);
             }
         }
     }
     CBFonts.SelectedIndex = 0;
 }
Пример #6
0
        /// <summary>
        ///     Load Fonts
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void cbFonts_Loaded(object sender, RoutedEventArgs e)
        {
            Mouse.OverrideCursor = Cursors.Wait;
            InstalledFontCollection installedFontCollection = new InstalledFontCollection();

            _fonts = installedFontCollection.Families.ToList();
            foreach (FontFamily font in _fonts)
            {
                CbFonts.Items.Add(font.Name);
            }
            int index = CbFonts.Items.IndexOf("Segoe MDL2 Assets");

            CbFonts.SelectedIndex = index == -1 ? 0 : index;
            Mouse.OverrideCursor  = null;
        }
        /// <summary>
        /// 获取已安装字体
        /// </summary>
        private void getFonts()
        {
            System.Drawing.FontFamily[] fontFamilies;
            InstalledFontCollection     installedFontCollection = new InstalledFontCollection();

            fontFamilies = installedFontCollection.Families;
            int count = fontFamilies.Length;

            Trace.Write("fontFamilies.Length=" + fontFamilies.Length);
            for (int i = 0; i < count; i++)
            {
                string fontName = fontFamilies[i].Name;
                Trace.Write("fontName: " + fontName);
            }
        }
Пример #8
0
        public void HandleFontList(HttpListenerContext context)
        {
            InstalledFontCollection fontsCollection = new InstalledFontCollection();

            FontFamily[]  fontFamilies = fontsCollection.Families;
            List <string> fonts        = new List <string>();

            foreach (FontFamily font in fontFamilies)
            {
                fonts.Add(font.Name);
            }

            context.Response.AppendHeader("Access-Control-Allow-Origin", "*");
            this.SendTextResponse(context, JsonConvert.SerializeObject(fonts));
        }
Пример #9
0
        public static ArrayList GetInstallFont()
        {
            InstalledFontCollection MyFont = new InstalledFontCollection();

            FontFamily[] MyFontFamilies = MyFont.Families;
            ArrayList    list           = new ArrayList();
            int          Count          = MyFontFamilies.Length;

            for (int i = 0; i < Count; i++)
            {
                string FontName = MyFontFamilies[i].Name;
                list.Add(FontName);
            }
            return(list);
        }
Пример #10
0
        public MainForm()
        {
            InitializeComponent();
            InstalledFontCollection fonts = new InstalledFontCollection();

            foreach (FontFamily family in fonts.Families)
            {
                tscbFontStyles.Items.Add(family.Name);
            }

            for (int i = 2; i <= 72; i += 2)
            {
                tscbFontSize.Items.Add(i);
            }
        }
Пример #11
0
        public MainWindow()
        {
            InitializeComponent();
            colorList.SelectedColor = Color.FromRgb(0, 0, 0);

            var fonts = new InstalledFontCollection();

            foreach (var family in fonts.Families)
            {
                list.Items.Add(new ListBoxItem {
                    Content    = family.Name,
                    FontFamily = new FontFamily(family.Name)
                });
            }
        }
Пример #12
0
        private void FontForm_Load(object sender, EventArgs e)
        {
            this.Text = "Font";

            lbFontSize.Items.Clear();
            lbFontStyle.Items.Clear();
            lbFontNames.Items.Clear();

            for (int i = 8; i <= 12; i++)
            {
                lbFontSize.Items.Add(i);
            }

            for (int i = 14; i <= 28; i += 2)
            {
                lbFontSize.Items.Add(i);
            }

            lbFontSize.Items.Add(36);
            lbFontSize.Items.Add(48);
            lbFontSize.Items.Add(72);

            lbFontStyle.Items.Add("Regular");
            lbFontStyle.Items.Add("Bold");
            lbFontStyle.Items.Add("Italic");
            lbFontStyle.Items.Add("Bold Italic");

            FontCollection    fCollection = new InstalledFontCollection();
            List <FontFamily> fonts       = fCollection.Families.ToList();
            List <string>     FontNames   = new List <string>();

            foreach (var f in fonts)
            {
                FontNames.Add(f.Name);
            }

            lbFontNames.Items.AddRange(FontNames.ToArray());

            txtFontName.Text  = "Consolas";
            txtFontSize.Text  = "11";
            txtFontStyle.Text = "Regular";

            lbFontNames.SelectedIndex = 0;
            lbFontStyle.SelectedIndex = 0;
            lbFontSize.SelectedIndex  = 0;

            loaded = true;
        }
Пример #13
0
        private void Form1_Load(object sender, EventArgs e)
        {
            InstalledFontCollection fonts = new InstalledFontCollection();

            try
            {
                foreach (FontFamily font in fonts.Families)
                {
                    FontListBox.Items.Add(font.Name);
                }
            }
            catch (Exception)
            {
                MessageBox.Show(e.ToString());
            }
        }
Пример #14
0
        private void fontbind()
        {
            FontFamily[] fontFamilies;

            InstalledFontCollection installedFontCollection = new InstalledFontCollection();

            // Get the array of FontFamily objects.
            fontFamilies = installedFontCollection.Families;

            // The loop below creates a large string that is a comma-separated
            // list of all font family names.
            List <FontFamily> fontfamiles = new List <FontFamily>(fontFamilies);

            cbo_font.DataSource    = fontfamiles;
            cbo_font.DisplayMember = "Name";
        }
Пример #15
0
        /// <summary>
        /// Gets the string identifier for the client's current language.
        /// </summary>
        /// <param name="options"></param>
        public void getFontList(string options)
        {
            try
            {
                FontFamily[] fontFamilies;

                InstalledFontCollection installedFontCollection = new InstalledFontCollection();
                fontFamilies = installedFontCollection.Families;
                PluginResult result = new PluginResult(PluginResult.Status.OK, this.WrapIntoJSON(fontFamilies));
                this.DispatchCommandResult(result);
            }
            catch (Exception)
            {
                this.DispatchCommandResult(new PluginResult(PluginResult.Status.ERROR, new GlobalizationError()));
            }
        }
Пример #16
0
        public static Boolean CheckFontExist(String fontName)
        {
            InstalledFontCollection ifc = new InstalledFontCollection();

            FontFamily[] fontFamilys = ifc.Families;
            if (fontFamilys == null || fontFamilys.Length < 1)
            {
                return(false);
            }
            if (fontFamilys.Any(f => f.Name == fontName))
            {
                return(true);
            }

            return(false);
        }
Пример #17
0
        private void open(object sender, RoutedEventArgs e)
        {
            StringBuilder           sb         = new StringBuilder();
            InstalledFontCollection collection = new InstalledFontCollection();

            foreach (var item in collection.Families)
            {
                sb.Append(item.Name + "\t");
            }

            MessageBox.Show(sb.ToString());
            //FontDialog fontDialog = new FontDialog();
            //fontDialog.ShowEffects = false;
            //fontDialog.ShowDialog();
            //var t = fontDialog.Font;
        }
Пример #18
0
 public static IEnumerable <string> GetInstalledFonts()
 {
     using (InstalledFontCollection fontsCollection = new InstalledFontCollection())
     {
         FontFamily[]  fontFamilies = fontsCollection.Families;
         List <string> fonts        = new List <string>();
         foreach (FontFamily font in fontFamilies)
         {
             if (!string.IsNullOrEmpty(font.Name))
             {
                 fonts.Add(font.Name);
             }
         }
         return(fonts);
     }
 }
Пример #19
0
        //获取字体函数
        private List <string> rF()
        {
            List <string>           Font    = new List <string>();
            InstalledFontCollection IFCFont = new InstalledFontCollection();

            System.Drawing.FontFamily[] fontFamilys = IFCFont.Families;
            if (fontFamilys == null || fontFamilys.Length < 1)
            {
                return(null);
            }
            foreach (System.Drawing.FontFamily item in fontFamilys)
            {
                Font.Add(item.Name);
            }
            return(Font);
        }
Пример #20
0
        /// <summary>
        /// Get the collection of font names.
        /// </summary>
        /// <returns>The font name collection.</returns>
        public static string[] FontFamilyNames()
        {
            List <string>           _names        = new List <string>();
            InstalledFontCollection installedFont = new InstalledFontCollection();

            System.Drawing.FontFamily[] fonts = installedFont.Families;

            // For each font add the name.
            for (int i = 0; i < fonts.Length; i++)
            {
                _names.Add(fonts[i].Name);
            }

            // Return the list of names.
            return(_names.ToArray());
        }
Пример #21
0
        /// <summary>
        /// Get the font family for the font name.
        /// </summary>
        /// <param name="name">The name of the font family.</param>
        /// <returns>The font family if found; else null.</returns>
        public static System.Drawing.FontFamily FontFamily(string name)
        {
            InstalledFontCollection installedFont = new InstalledFontCollection();

            System.Drawing.FontFamily[]             fonts    = installedFont.Families;
            IEnumerable <System.Drawing.FontFamily> families = fonts.Where(u => u.Name.ToLower() == name.ToLower());

            if (families.Count() > 0)
            {
                return(families.First());
            }
            else
            {
                return(null);
            }
        }
Пример #22
0
        // ========================================
        // method
        // ========================================
        private void InitFontNames()
        {
            var names = new List <string>();

            using (var fcol = new InstalledFontCollection()) {
                var ffs = fcol.Families;
                foreach (var ff in ffs)
                {
                    //if (ff.IsStyleAvailable(FontStyle.Regular)) {
                    names.Add(ff.Name);
                    //}
                    ff.Dispose();
                }
            }
            _fontNames = names.ToArray();
        }
Пример #23
0
        private void MainForm_Load(object sender, EventArgs e)
        {
            // System.Drawing 네임스페이스를 사용해야 한다.
            FontFamily[] fontFamilies;

            // System.Drawing.Text 네임스페이스를 사용해야 한다.
            InstalledFontCollection installedFontCollection = new InstalledFontCollection();

            // OS에 설치되어 있는 모든 Font정보를 가져 온다.
            fontFamilies = installedFontCollection.Families;

            foreach (var fontFamily in fontFamilies)
            {
                cboFont.Items.Add(fontFamily.Name);
            }
        }
Пример #24
0
        private bool chkFont()
        {
            InstalledFontCollection MyFont = new InstalledFontCollection();

            FontFamily[] MyFontFamilies = MyFont.Families;
            int          Count          = MyFontFamilies.Length;

            for (int i = 0; i < Count; i++)
            {
                if (MyFontFamilies[i].Name.IndexOf("3 of 9 Barcode") != -1)
                {
                    return(false);
                }
            }
            return(true);
        }
Пример #25
0
        //метод передающий все шрифты установленные на ПК, а так же задёт размеры
        public void fontAndSizePapam()
        {
            this.font = new InstalledFontCollection();
            int count = font.Families.Length;

            //Заполняем fontBox именами шрифтов
            for (int j = 0; j < count; ++j)
            {
                fontBox.Items.Add(font.Families[j].Name);
            }
            //размеры шрифтов
            for (int i = 1; i < 100; i++)
            {
                sizeFontBox.Items.Add(i);
            }
        }
Пример #26
0
        public static List <TextFont> GetFontList()
        {
            if (_fontList == null)
            {
                InstalledFontCollection installedFontCollection = new InstalledFontCollection();
                FontFamily[]            families = installedFontCollection.Families;
                _fontList = new List <TextFont>();
                foreach (FontFamily ff in families)
                {
                    TextFont tf = new TextFont(ff.Name);
                    _fontList.Add(tf);
                }
            }

            return(_fontList);
        }
Пример #27
0
        /// <summary>
        /// Get a list of installed fonts.
        /// </summary>
        /// <returns>A list of font names.</returns>
        public static List <string> GetFontList()
        {
            List <string> fonts = new List <string>();

            InstalledFontCollection installedFonts =
                new InstalledFontCollection();

            FontFamily[] families = installedFonts.Families;

            foreach (FontFamily family in families)
            {
                fonts.Add(family.Name);
            }

            return(fonts);
        }
Пример #28
0
        private void AddBaseData()
        {
            const int MINIMUM_FONT_SIZE   = 8;
            const int MAXIMUM_FONT_SIZE   = 73;
            InstalledFontCollection fonts = new InstalledFontCollection();

            foreach (var font in fonts.Families)
            {
                fontFamilyComboBox.Items.Add(font.Name);
            }

            for (int i = MINIMUM_FONT_SIZE; i < MAXIMUM_FONT_SIZE; i++)
            {
                fontSizeComboBox.Items.Add(i);
            }
        }
        /// <summary>
        /// Loads the Form and Initialises the combo boxes in toolstrip
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Main_Text_Pad_Load(object sender, EventArgs e)
        {
            InstalledFontCollection fonts = new InstalledFontCollection();

            foreach (FontFamily family in fonts.Families)
            {
                tscbx_Fontfamily.Items.Add(family.Name);
            }
            tscbx_Fontfamily.SelectedIndex = 0;

            for (int i = 1; i <= 72; i++)
            {
                tscbx_Fontsize.Items.Add(i);
            }
            tscbx_Fontsize.SelectedIndex = 11;
        }
Пример #30
0
        private void GetFonts()
        {
            InstalledFontCollection fontCollection = new InstalledFontCollection();

            System.Drawing.FontFamily[] fontFamily = fontCollection.Families;
            Fonts = new List <string>();

            foreach (System.Drawing.FontFamily font in fontFamily)
            {
                if (!string.IsNullOrEmpty(font.ToString()))
                {
                    Fonts.Add(font.Name);
                }
            }
            Fonts.RemoveAt(0);
        }
Пример #31
0
        void InstalledFonts()
        {
            InstalledFontCollection fonts = new InstalledFontCollection();

            for (int i = 0; i < fonts.Families.Length; i++)
            {
                tb_Font.Items.Add(fonts.Families[i].Name);
            }

            if (Properties.Settings.Default.FontIndex >= 0 && Properties.Settings.Default.FontIndex < tb_Font.Items.Count)
            {
                tb_Font.SelectedIndex = Properties.Settings.Default.FontIndex;
                Font fnt = new System.Drawing.Font(tb_Font.Text, txtDocument.SelectionFont.Size, txtDocument.SelectionFont.Style);
                txtDocument.Font = fnt;
            }
        }
Пример #32
0
        public MainForm(string codeType, string fileName, string selectedText)
        {
            Application.EnableVisualStyles();
            _codeType = codeType;
            _fileName = fileName;
            InitializeComponent();
            LoadThemes();
            txtCode.Text = selectedText;
            InstalledFontCollection installedFontCollection = new InstalledFontCollection();

            cbx_font.DrawMode = DrawMode.OwnerDrawFixed;
            foreach (FontFamily f in installedFontCollection.Families)
            {
                cbx_font.Items.Add(f.Name);
            }
        }
Пример #33
0
        public OpenFontIFonts(IFontLoader fontloader)
        {
            this._fontloader             = fontloader;
            typefaceStore                = new TypefaceStore();
            typefaceStore.FontCollection = InstalledFontCollection.GetSharedFontCollection(null);
            glyphLayout = new GlyphLayout();

            glyphLayout.ScriptLang        = Typography.OpenFont.ScriptLangs.Thai;//test conplex script
            glyphLayout.PositionTechnique = PositionTechnique.OpenFont;
            //assign fitting engine


            //
            userGlyphPlanList      = new List <GlyphPlan>();
            userCharToGlyphMapList = new List <UserCharToGlyphIndexMap>();
        }
Пример #34
0
        static FontUtil()
        {
            List <FontFamily> usableFonts = new List <FontFamily>();

            using (InstalledFontCollection intstalledFonts = new InstalledFontCollection())
            {
                foreach (FontFamily font in intstalledFonts.Families)
                {
                    if (font.IsStyleAvailable(FontStyle.Regular & FontStyle.Bold & FontStyle.Italic & FontStyle.Underline & FontStyle.Strikeout))
                    {
                        usableFonts.Add(font);
                    }
                }
            }
            UsableFontFamilies = usableFonts.ToArray();
        }
Пример #35
0
    /// <summary>
    /// 加载默认数据
    /// </summary>
    private void LoadDefaultData()
    {
        ddlWatermarkFontName.Items.Clear();
        InstalledFontCollection fonts = new InstalledFontCollection();
        foreach (FontFamily family in fonts.Families)
        {
            ddlWatermarkFontName.Items.Add(new ListItem(family.Name, family.Name));
        }

        ddlWatermarkQuality.Items.Clear();
        for (int i = 100; i >= 0; i--)
        {
            string text = i.ToString();
            if (i == 100)
            {
                text += "(最高)";
            }
            if (i == 80)
            {
                text += "(推荐)";
            }
            ddlWatermarkQuality.Items.Add(new ListItem(text, i.ToString()));

        }

        ddlWatermarkTransparency.Items.Clear();
        for (int i = 10; i > 0; i--)
        {
            string text = i.ToString();
            if (i == 10)
            {
                text += "(不透明)";
            }

            ddlWatermarkTransparency.Items.Add(new ListItem(text, i.ToString()));

        }
    }