Hi
I woul like to know how to have font size different in different screen size (phone, tablette) in Canvas using drawtext or drawtextrotate ?
THX
Sub ecrit2 (Text As String, ax1 As Float, ay1 As Float, testes As Boolean, couleur As Int)
Dim haut, moitie As Float
haut = th.Height - 32dip
moitie = haut/2
Dim tailleL, espace As Float
tailleL = 100%y
'Log("Taille :" & tailleL)
If tailleL > 1150 Then
'tailleL = 30dip
espace = 0
Else
'tailleL = 10dip
espace = 0
End If
tailleL = IntToDIP((tailleL/100))
If testes Then
cvsTest.DrawTextRotated(Text, ax1+espace, ay1+moitie, Typeface.DEFAULT, tailleL, couleur, "RIGHT", 90)
Else
cvsTest.DrawTextRotated(Text, ax1+espace, ay1, Typeface.DEFAULT, tailleL, couleur, "RIGHT", 90)
End If
End Sub
Sub IntToDIP(Integer As Int) As Int
Dim r As Reflector
Dim scale As Float
r.Target = r.GetContext
r.Target = r.RunMethod("getResources")
r.Target = r.RunMethod("getDisplayMetrics")
scale = r.GetField("density")
Dim DIP As Int
DIP = Integer * scale + 0.5
Return DIP
End Sub
I woul like to know how to have font size different in different screen size (phone, tablette) in Canvas using drawtext or drawtextrotate ?
THX
Sub ecrit2 (Text As String, ax1 As Float, ay1 As Float, testes As Boolean, couleur As Int)
Dim haut, moitie As Float
haut = th.Height - 32dip
moitie = haut/2
Dim tailleL, espace As Float
tailleL = 100%y
'Log("Taille :" & tailleL)
If tailleL > 1150 Then
'tailleL = 30dip
espace = 0
Else
'tailleL = 10dip
espace = 0
End If
tailleL = IntToDIP((tailleL/100))
If testes Then
cvsTest.DrawTextRotated(Text, ax1+espace, ay1+moitie, Typeface.DEFAULT, tailleL, couleur, "RIGHT", 90)
Else
cvsTest.DrawTextRotated(Text, ax1+espace, ay1, Typeface.DEFAULT, tailleL, couleur, "RIGHT", 90)
End If
End Sub
Sub IntToDIP(Integer As Int) As Int
Dim r As Reflector
Dim scale As Float
r.Target = r.GetContext
r.Target = r.RunMethod("getResources")
r.Target = r.RunMethod("getDisplayMetrics")
scale = r.GetField("density")
Dim DIP As Int
DIP = Integer * scale + 0.5
Return DIP
End Sub