B4A Library CustomFonts

This library will allow you to set custom fonts to views easily.

Requirements:

1- B4A 7.x.

2- Copy the CustomFonts.xml and CustomFonts.jar to your additional libraries directory.

Usage:
B4X:
Private RobotoThin As CustomFonts

RobotoThin.Initialize("Roboto-Thin.ttf")
RobotoThin.SetCustomFontsToAllViews(Activity)

The methods are self-explanatory, see attached sample for more details.

Screenshot:

x3Oam6q.png
 

Attachments

  • CustomFonts_Lib_1.0.zip
    4.5 KB · Views: 1,144
  • CustomFonts_Sample.zip
    189.4 KB · Views: 1,047

Star-Dust

Expert
Licensed User
Longtime User
Wow. Great
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
Thank you for sharing!

As this is a B4A written library, it would be great if you can share the library source code as well.
The benefits are:

1. Other developers can change if needed.
2. The source code can probably be slightly modified and be supported by B4J and B4i as well.
3. Source code is more future proof than compiled libraries.
 

Mahares

Expert
Licensed User
Longtime User
It is amazing. Every time @NJDude develops a library , here is what you get out of it:
1. A real library and not a wrapper that has real world applications.
2. Simple to understand and use.
3. Small footprint.
4. No extra Read Only files or folders.
5 His example is simple enough for all of us to follow and apply to ours.
 

MitchBu

Well-Known Member
Licensed User
Longtime User
Sorry for asking the obvious, but ... Where is "your additional libraries directory" ? I tried putting the files in Objects\b4xlibs but it does nothing...
 

mangojack

Expert
Licensed User
Longtime User
Sorry for asking the obvious, but ... Where is "your additional libraries directory" ? I tried putting the files in Objects\b4xlibs but it does nothing...

I would avoid placing any additional libs within a project folder. (That lib might serve another project in the future)

I have mine located in a Documents/Dropbox folder titled 'B4A' .. it contains various project folders & another for 'Additional Libraries'

Then just point to that folder in IDE > Tools > Configure Paths > Additional Libraries.
 
Last edited:

Napier

New Member
Licensed User
Thanks NJDude. Just translating my project over to b4a and this was very helpful. I thought the conversion would be straightforward, and I was a bit shocked at how fonts are so very different than in b4i.
 
Top