Font number

Jari

New Member
When I have for example the following font "Courier New, size=10". How can I get the corresponding font number?
 
As far as I know, there is no method within the 4GL to provide this information. But what you could do is read the registry (or the .ini file, whichever you are using) to find what you're looking for.

Depending on your version, you'll find the fonts in the registry here:

HKEY_CURRENT_USER\Software\PSC\PROGRESS\9.n\fonts

The simplest way would be to create a loop to examine each entry in turn until you find a match. Although, if it's something that you want to call many times over, it might be better to read them all into a temp-table and then look them up from there.

Assuming '{&REGKEY}' defines the regkey value above, and that 'getRegKey' is a user-defined function to read a registry key, you can create a function to return the font number:

FUNCTION getFontNumber RETURNS INTEGER
(pFont AS CHARACTER):

DO iCount = 0 TO FONT-TABLE:NUM-ENTRIES:

IF getRegKey("{&REGKEY}\font" + STRING(iCount)) = pFont THEN LEAVE.

END.

RETURN iCount.

END FUNCTION.
 
Top