Four Js Development Tools Forum

General => Ask Reuben => Topic started by: Reuben B. on July 30, 2020, 05:10:46 am



Title: Ask Reuben 40 - Right Justified Labels
Post by: Reuben B. on July 30, 2020, 05:10:46 am
To understand why your right justified field labels may not right align as intended, it is first necessary to have an understanding of …

   • fonts, and the concept of monospaced fonts, and proportional fonts.
   • how field labels inside a .per are compiled as a LABEL widget with a posX and gridWidth property.

A font has the property that it is either monospaced or proportional.  A monospaced font has the property that each character takes up the same amount of space.  A proportional font has the property that each character will take up a different amount of space.  Typically i is the narrowest, whilst M or W are the widest.

When compiling raw text inside a Genero form, a LABEL is created that has a posX and gridWidth property.  If a proportional font is used, then two words with the same posX and gridWidth values are not guaranteed to end in the same position.  As a result whilst the developer might have intended this raw text to right align, there is no guarantee that they will.

The solution is to explicitly define a LABEL and use the JUSTIFY=RIGHT property.  Explicitly defining a LABEL also has other advantages.

Read more at https://4js.com/ask-reuben/ig-40/