Android Code Snippet [B4X] Using custom fonts on labels and canvases

Using custom fonts on labels and canvases.
Demo code attached.
1726414208410.png
 

Attachments

  • drawtext.zip
    62.5 KB · Views: 61

TILogistic

Expert
Licensed User
Longtime User
Another example of combinations.
B4X:
    Dim TextFont As B4XFont = GetTypeFont("Icip-AL3D2.ttf", 48)
    DrawTextWithOutline("Hello, World!", 100, 100, 1, xui.Color_Transparent, xui.Color_Blue, TextFont)
    
    Label1.Text = "Hello, World!"
    Label1.Font = TextFont
    Label1.TextColor = xui.Color_Blue
    
    Dim TextFont As B4XFont = GetTypeFont("KumarOneOutline-Regular.ttf", 48)
    DrawTextWithOutline("Hello, World!", 100, 180, 1, xui.Color_Transparent, xui.Color_Blue, TextFont)
    
    Label2.Text = "Hello, World!"
    Label2.Font = TextFont
    Label2.TextColor =  xui.Color_Blue
    
    Dim TextFont As B4XFont = xui.CreateDefaultFont(48)
    DrawTextWithOutline("Hello, World!", 100, 260, 2, xui.Color_Blue, xui.Color_White, TextFont)
    
    Label3.Text = "Hello, World!"
    Label3.Font = TextFont
    Label3.TextColor =  xui.Color_Blue
1726464957870.png
 
Top