Example #1
0
        private void DisplayFont(FontInfo font)
        {
            tlpDisplayFont.Visible = !string.IsNullOrEmpty(font.FaceName);
            if (!tlpDisplayFont.Visible)
            {
                return;
            }
            var pfc = new PrivateFontCollection();

            pfc.AddFontFile(font.FullName);

            textBoxSample.Text = $"{font.FamilyName.ToUpper()} {font.FaceName.ToUpper()} {trackBarSize.Value}" +
                                 "\r\nThe quick brown fox jumps over the lazy dog." +
                                 "\r\n1234567890      R$ 123.456,78" +
                                 "\r\náéíóú ÁÉÍÓÚ ãõ ÃÕ âêîôû ÂÊÎÔÛ";
            try {
                textBoxSample.Font = new Font(pfc.Families[0], trackBarSize.Value, font.FStyle());
            }
            catch {
                MessageBox.Show("Unable to display font sample.", "Font Catalog",
                                MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }

            labelPath.Text             = font.FullName;
            labelDate.Text             = font.FileDate.ToString();
            labelSize.Text             = $"{font.FileSize:N0} bytes";
            labelName.Text             = $"Name: {font.FaceName}";
            labelFamily.Text           = $"Family: {font.FamilyName}";
            labelBaseline.Text         = $"Baseline: {font.Baseline}";
            labelCapsHeight.Text       = $"Caps Height: {font.CapsHeight}";
            textBoxDescription.Text    = font.Description;
            labelManufacturerName.Text = $"Manufacturer: {font.ManufacturerName}";
            labelGlyphs.Text           = $"Glyphs: {font.GlyphCount}";
            labelHeight.Text           = $"Height: {font.Height}";
            labelStretch.Text          = $"Stretch: {font.Stretch}";
            labelStyle.Text            = $"Style: {font.Style}";
            labelSymbol.Text           = $"Symbol: {font.Symbol}";
            labelTrademark.Text        = $"Trademark: {font.Trademark}";
            labelVersion.Text          = $"Version: {font.Version}";
            labelWeight.Text           = $"Weight: {font.Weight}";
            labelXHeight.Text          = $"Height: {font.Height}";
        }