locked
How to get all the font names that is installed in the system? RRS feed

  • Question

  • I am making a Windows Mobile Application.

    I want to get all the names of fonts that is installed in the system.

    In Windows, we get all the fonts names using following source cord.

    public
    void FillFontComboBox(ComboBox comboBoxFonts)
    {
        // Enumerate the current set of system fonts,
        // and fill the combo box with the names of the fonts.
        foreach (FontFamily fontFamily in Fonts.SystemFontFamilies)
        {
            // FontFamily.Source contains the font family name.
            comboBoxFonts.Items.Add(fontFamily.Source);
        }

        comboBoxFonts.SelectedIndex = 0;
    }

    But in Windows Mobile, we cannot use the source cord because .NET Compact Framework doesn't have Fonts.SystemFontFamilies.

    How can I get the all the names of fonts installed in the system?

    Please help me.

    Wednesday, February 3, 2010 8:06 AM

Answers

  • Hi,

    The following code snippet should help you :-

    System.Drawing.Text.InstalledFontCollection currentFontCollection = new System.Drawing.Text.InstalledFontCollection();
    foreach (System.Drawing.FontFamily currentFontFamily in currentFontCollection.Families)
    {
    }

    Hope this helps.

    Paul Diston
    http://www.smartmobiledevice.co.uk/
    • Marked as answer by Wait4him Wednesday, February 3, 2010 12:55 PM
    Wednesday, February 3, 2010 9:20 AM

All replies

  • Hi,

    The following code snippet should help you :-

    System.Drawing.Text.InstalledFontCollection currentFontCollection = new System.Drawing.Text.InstalledFontCollection();
    foreach (System.Drawing.FontFamily currentFontFamily in currentFontCollection.Families)
    {
    }

    Hope this helps.

    Paul Diston
    http://www.smartmobiledevice.co.uk/
    • Marked as answer by Wait4him Wednesday, February 3, 2010 12:55 PM
    Wednesday, February 3, 2010 9:20 AM
  • Thank you very much for your kind help.
    Wednesday, February 3, 2010 12:56 PM