Enumerating the Installed Fonts into a QUEUE

Hello.

Anyone did it already and willing to share the code? I know, this is a lazy question.

Regards

Download Clarion Templates and Tools from Icetips Alta LLC(with%20original

here’s the file itself. https://www.icetips.com/par2downloads/Charsets.zip

1 Like

Nice, thank you. But it uses outdated API calls.

I will get rid of my laziness… :slight_smile:

Thank you!

In winapi there is TLogicalFont class, here is an example of reading installed fonts:

logFont                         CLASS(TLogicalFont)
EnumFontFamiliesCB                PROCEDURE(LONG pLogFont, LONG ptextMetric, ULONG pFontType), LONG, PROTECTED, DERIVED
                                END

qFontNames                      QUEUE, PRE(qFontNames)
FontFace                          STRING(32)
                                END

  CODE
  logFont.EnumFontFamiliesEx()


logFont.EnumFontFamiliesCB    PROCEDURE(LONG pLogFont, LONG ptextMetric, ULONG pFontType)
lf                              &tagLOGFONTA, AUTO
  CODE
  lf &= (pLogFont)
  qFontNames:FontFace = lf.lfFaceName
  ADD(qFontNames)
  RETURN 1  !- continue
1 Like

Mike, like always, you are a great teacher.

Actually I was doing this…


							EnumFontFamiliesEx(UNSIGNED hdc,             | !handle to DC
								*LOGFONT lpLogfont,       | !font information
								*EnumFontFamExProc lpEnumFontFamExProc, | !callback function
								LONG        lParam,              | !additional data to pass to callback
								LONG        dwFlags=0            | !not used; must be 0
								),SIGNED,PROC,PASCAL,RAW,NAME('EnumFontFamiliesExA')

EnumFontFamExProc           PROCEDURE(LONG lpElf,    |! pointer to ENUMLOGFONTEX or ENUMLOGFONTEXDV
								LONG                        lpNtm,    |! pointer to TEXTMETRIC or NEWTEXTMETRICEX or ENUMTEXTMETRIC
								LONG                        FontType, |! font type bitmap
								LONG                        lParam    |! optional user defined data

But also I was being a fool.

FONTDIALOG() was a simple solution. And it does everything I need at the moment.

No need for me to reinvent the wheel.

Thank you!