EDIT June 2018: easier solution in QGIS 2.18+ !
It's possible to do it directly, without a virtual field as in my previous answer :
- Open the Label properties
- At the end of the line, click on the data defined icon
- Select Edit
- Write in the field
ln($area) (or log(base, $area) as suggested by @Stephen Kay in comments, with base an integer you choose)
- If necessary, do the same for the text buffer and write
ln($area)/15 in the data defined properties of the size.
EDIT June 2018: I leave my previous solution below for info
An easy way to do this is by using the ln() function (for example).
- create a virtual field named VRT_FONT
- Use the formula
- Set the lable font size to the data defined field VRT_FONT
- Draw new polygons, it will label automatically your polygon depending on it's area.
This basic formula answers my needs but you can of course tweak it to suits yours by adding/multiplying values (or else).
Tip : you can combine this with the following tip : do a virtual field VRT_BUFF with the formula
"VRT_FONT"/15 and set the lable font buffer to this field to have an area adaptive buffer too.
Tip 2 : you can modify the formula to fit your own scale needs and the size of buffer you would like.
What it does :
The field properties :
The attribute table :
A new polygon :