B4J Tutorial [ABMaterial] Change font type

This post is the answer @alwaysbusy gave me to my question about how to implement a label to look like a clock:

Make a new css file and put it in /css/custom) In my case, 'Digital-7.css'
B4X:
@font-face {
   font-family:"Digital-7";
   src:url("../../font/digital-7/Digital-7.ttf") format("truetype");
}
In BuildPage(), load this css file:
B4X:
page.AddExtraCSSFile("custom/Digital-7.css")
Where you set the text of something, use the {ST} tags:
B4X:
Dim lblClock As ABMLabel
lblClock.
lblClock.Initialize(page,"lblClock","{ST:font-family:Digital-7;}"&"20:00{/ST}",ABM.SIZE_H1,False,"")

The font file was saved on "\Objects\www\font\digital7" inside my project.

Hope this help anyone.
 

Harris

Expert
Licensed User
Longtime User
Got a picture of your groovy fonts in use?
 

Descartex

Well-Known Member
Licensed User
Longtime User
Sure, it looks as good as you can do it on a raw HMTL.
 

Attachments

  • digital.png
    digital.png
    1.5 KB · Views: 380
Top