Tech Tip: Finding objects that have no fonts set
PRODUCT: 4D | VERSION: 16 | PLATFORM: Win
Published On: June 8, 2018
A recent update of Windows 10 may have altered the fonts in a Windows machine. If objects in the forms contain no fonts that are set as the following:
4D will try to find the best available font to display. That font maybe something that is not suitable for your application. The following utilty method will find objects in a form that contain no fonts assigned:
// ----------------------------------------------------------- // Method: FIND_OBJECTS_NO_FONTS // Description: Method will add retrieve the objects in a form that // have blank fonts assigned in the properties // // Parameters: // $1 (POINTER) - Pointer to an array to list the blank fonts assigned // $2 (POINTER) - Pointer to an array to list the page in the form // ----------------------------------------------------------- C_POINTER($1;$arrPtrObj) C_POINTER($2;$arrPtrPage) C_LONGINT($i) C_TEXT($blank) ARRAY TEXT($arrObj;0) ARRAY POINTER($arrVar;0) ARRAY LONGINT($arrPage;0) If (count parameters=2) $arrPtrObj:=$1 $arrPtrPage:=$2 FORM GET OBJECTS($arrObj;$arrVar;$arrPage;Form all pages) For ($i;1;Size of array($arrObj) $blank:=OBJECT Get font(*;$arrObj{$i}) If ($blank="") APPEND TO ARRAY($arrPtrObj->;$arrObj{$i}) APPEND TO ARRAY($arrPtrPage->;$arrPage{$i}) End if End for End if |
Here is an example of using the method:
ARRAY TEXT(arrObjNoFont;0) ARRAY LONGINT(arrObjNoFontPage;0) FIND_OBJECTS_NO_FONTS (->arrObjNoFont;->arrObjNoFontPage) |