How to filter unreadable screen fonts?

In the Delphi 10.1.2 VCL forms application, I populate the TComboBoxlist Screen.Fontsand display the font elements using my own fonts:

procedure TForm2.FormCreate(Sender: TObject);
begin
  AddFontsToComboList;
end;

procedure TForm2.AddFontsToComboList;
var
  i: Integer;
begin
  ComboBox1.Items.BeginUpdate;
  try
    for i := 0 to Screen.Fonts.Count - 1 do
    begin
      ComboBox1.Items.Add(Screen.Fonts[i]);
    end;
  finally
    ComboBox1.Items.EndUpdate;
  end;
end;

procedure TForm2.ComboBox1DrawItem(Control: TWinControl; Index: Integer; Rect: TRect; State: TOwnerDrawState);
// ComboBox1.Style must be csOwnerDrawVariable
begin
  with ComboBox1 do
  begin
    Canvas.fillrect(rect);
    Canvas.Font.Style := [fsbold];
    Canvas.Font.Name  := ComboBox1.Items[Index];
    Canvas.Textout(rect.Left, rect.Top, ComboBox1.Items[Index]);
  end;
end;

This is the result:

enter image description here

You can see that there are some missing elements. In the above screenshot, the missing font is Cambria Math .

So how can I filter out these empty elements? And how can I filter out those elements that are not readable? And how can I filter out fonts containing only characters? You know what I mean.

+4
source share

Source: https://habr.com/ru/post/1685603/


All Articles