Public Sub fonsize(size As Float)
Dim LayoutVal As LayoutValues = GetDeviceLayoutValues 'Preleva dimensione del dispositivo
Dim Dens As Float = Density 'Preleva la densità del dispositivo
Dim Scale As Int = LayoutVal.Scale
If Scale = 1 Then ' for low-density
size = (size * 2) / Dens
Else If Scale = 2 Then ' for medium-density
size = size / Dens
Else If Scale = 3 Then ' for high-density
size = (size * 1.5) / Dens
Else If Scale = 4 Then ' for extra-high-density
size = (size * 2) / Dens
Else If Scale = 5 Then ' for extra-extra-high-density
size = (size * 2.5) / Dens
Else If Scale = 6 Then ' for extra-extra-extra-high-density (launcher icon only; see note above)
size = (size * 3) / Dens
End If
Return size
End Sub