Font isn't available in TWPRichText

  • Hi,

    I use the code below to populate the installed fonts into a combobox.
    One of my customers installed a new font "Myriad pro" (on Windows 7), but this font doesn't always become available in the combobox of my application.

    The TWPRichText contains some mergefields, that were placed inside the component at designtime.
    When a user selects these mergefields, the new font isn't available. When he selects any other part of the text in the TWPRichText, the font is shown.

    Is there any way to solve this?

    Code
    // fill the combo with Font names
     ComboBox1.Items := Screen.Fonts;
    • Offizieller Beitrag

    Hi,

    I don't understand.

    If you populate the dropdown with
    ComboBox1.Items := Screen.Fonts;

    The problem rather appears to be in the VCL, function TScreen.GetFonts: TStrings;

    But there I see no problem myself. It adds all fonts which are available to EnumFontFamiliesEx.

    With the display of fonts used by selected text, please note that the fontName reports "" if the selected text uses different fonts in different parts. That can be the case for the mergefields.

    Julian

  • Hi,

    It seems to be a little different.
    The customer copies text from MS Word to TRichText. The copied text has font Myriad Pro. This font is available in MS Word, but not in the ComboBox where all fonts are loaded into by:

    Code
    ComboBox1.Items := Screen.Fonts;

    When the copied text in TRichText is selected the correct font is however shown in the combobox, but even then It's still not available in the dropdown.

    When the user selects some other text in TRichText (f.e. Arial). The text can even be changed into "Myriad Pro", by typing the fontname into the combobox and pressing enter.

    So what could cause a font to be available in MS Word but not in Screen.Fonts? Does MS Word look at another place?