Home How to filter out non-readable screen-fonts?
Reply: 0

How to filter out non-readable screen-fonts?

user1580348
1#
user1580348 Published in 2017-09-13 13:50:33Z

In a Delphi 10.1.2 VCL Forms Application, I fill a TComboBox with the Screen.Fonts list and display the font items using their own font-faces:

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:

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

So how can I filter out those empty items? And how can I filter out those items which are unreadable? And how can I filter out the fonts which contain only symbols? You know what I mean.

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.311825 second(s) , Gzip On .

© 2016 Powered by cudou.com design MATCHINFO