コード例 #1
0
 void ChangeSelectedTypeface(InstalledTypeface typeface)
 {
     if (typeface == null)
     {
         return;
     }
     //
     _options.InstalledTypeface = typeface;
     _options.InvokeAttachEvents();
     _txtTypefaceInfo.Text = "file: " + typeface.FontPath + "\r\n" + "weight:" + typeface.Weight;
 }
コード例 #2
0
        void SetupFontList()
        {
            InstalledTypeface selectedInstalledTypeface = null;
            int  selected_index = 0;
            int  ffcount        = 0;
            bool found          = false;


            var tempList = new System.Collections.Generic.List <InstalledTypeface>();

            tempList.AddRange(_options.GetInstalledTypefaceIter());
            tempList.Sort((f1, f2) => f1.ToString().CompareTo(f2.ToString()));

            //add to list and find default font
            string defaultFont = "Tahoma";

            //string defaultFont = "Alef"; //test hebrew
            //string defaultFont = "Century";
            foreach (InstalledTypeface installedTypeface in tempList)
            {
                if (!found && installedTypeface.FontName == defaultFont)
                {
                    selectedInstalledTypeface  = installedTypeface;
                    selected_index             = ffcount;
                    _options.InstalledTypeface = installedTypeface;
                    found = true;
                }
                lstFontList.Items.Add(installedTypeface);
                ffcount++;
            }
            //set default font for current text printer
            //


            if (selected_index < 0)
            {
                selected_index = 0;
            }



            lstFontList.SelectedIndex         = selected_index;
            lstFontList.SelectedIndexChanged += (s, e) =>
            {
                InstalledTypeface ff = lstFontList.SelectedItem as InstalledTypeface;
                if (ff != null)
                {
                    _options.InstalledTypeface = ff;
                    _options.InvokeAttachEvents();
                }
            };
        }
コード例 #3
0
        void SetupFontList()
        {
            InstalledFont selectedFF     = null;
            int           selected_index = 0;
            int           ffcount        = 0;
            bool          found          = false;

            string defaultFont = "Tahoma";

            //string defaultFont = "Alef"; //test hebrew
            //string defaultFont = "Century";
            foreach (InstalledFont ff in _options.GetInstalledFontIter())
            {
                if (!found && ff.FontName == defaultFont)
                {
                    selectedFF             = ff;
                    selected_index         = ffcount;
                    _options.InstalledFont = ff;
                    found = true;
                }
                lstFontList.Items.Add(ff);
                ffcount++;
            }
            //set default font for current text printer
            //


            if (selected_index < 0)
            {
                selected_index = 0;
            }
            lstFontList.SelectedIndex         = selected_index;
            lstFontList.SelectedIndexChanged += (s, e) =>
            {
                InstalledFont ff = lstFontList.SelectedItem as InstalledFont;
                if (ff != null)
                {
                    _options.InstalledFont = ff;
                    _options.InvokeAttachEvents();
                }
            };
        }
コード例 #4
0
 private void ChkEnableMultiTypefaces_CheckedChanged(object sender, EventArgs e)
 {
     _options.EnableMultiTypefaces = chkEnableMultiTypefaces.Checked;
     _options.InvokeAttachEvents();
 }