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

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
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…