KNOWLEDGE BASE
Log In    |    Knowledge Base    |    4D Home
Tech Tip: Working with the List of Recent fonts
PRODUCT: 4D | VERSION: 14.3 | PLATFORM: Mac & Win
Published On: January 12, 2015

4D v14 introduces a new command, SET RECENT FONTS. This command takes in a Text array of font names and sets it to the Recent fonts list. Using this command a set of fonts typically used fonts for a database can be set allowing users to easily find change the fonts of the multi styled text.

A newly opened database will not contain any recent fonts as shown:


Applying the following code, the list can be populated with recent fonts:

ARRAY TEXT($recent_at;0)
APPEND TO ARRAY($recent_at;"Times New Roman")
APPEND TO ARRAY($recent_at;"Arial")
APPEND TO ARRAY($recent_at;"Calibri")
APPEND TO ARRAY($recent_at;"Courier")
SET RECENT FONTS($recent_at)


Having the code ran when a form is loaded will present users with quick access to a list of fonts as shown:


The SET RECENT FONTS command replaces the current list with the text array passed and does not append it.

For example, the current Recent fonts contain Comic Sans MS:


Running the following code the list is completly replaced:
ARRAY TEXT($arrRecent;0)
APPEND TO ARRAY($arrRecent;"Times New Roman")
SET RECENT FONTS($recent_at)



To maintain the current list of recent fonts simply use the FONT LIST command with the second parameter set to 2 to populate a text array with the list of recent fonts then append the new fonts desired:
ARRAY TEXT($arrRecent;0)
FONT LIST($arrRecent;2)
APPEND TO ARRAY($arrRecent;"Times New Roman")
SET RECENT FONTS($recent_at)



Knowing this the list can also be cleared simply by passing an empty array:
ARRAY TEXT($arrRecent;0)
SET RECENT FONTS($recent_at)


Applying these features can provide convienence to the users by allowing the ability to access a list of commonly used fonts in a database by loading a list at startup or allow them to clear their list without restarting the application.