B4A Library Fontometrics - apply any of 24 different fonts/typefaces to for eg B4A Label and EditText views

A wrap for this Github project. You can apply it to for eg B4A labels etc that you have added via the B4A designer or via B4A code.

(".....A Simple Android Library to use Custom Fonts with Ease. Use Customs Fonts in your Android project without adding any .ttf/.otf in Assets Folder......")

Library:
FontoMetrics
Author:
Github: Ishmeet Singh, Wrapped by: Johan Schoeman
Version: 1
  • FontoMetrics
    Methods:
    • Initialize
    • admiration_pains As Typeface
    • amatic_bold As Typeface
    • amatic_regular As Typeface
    • back_black As Typeface
    • bella_donna As Typeface
    • capture_it As Typeface
    • christians_united As Typeface
    • coffee_with_sugar As Typeface
    • electricity As Typeface
    • elephant As Typeface
    • eyes_wide As Typeface
    • la_bataille As Typeface
    • mybigheart As Typeface
    • myepicselfie As Typeface
    • pacifico As Typeface
    • ricard_crime As Typeface
    • safira_shine As Typeface
    • seasrn As Typeface
    • sentimental As Typeface
    • the_quest As Typeface
    • thunderstrike As Typeface
    • too_freakin_cute As Typeface
    • tunderstrike3d As Typeface
    • windsong As Typeface

Sample Code:
B4X:
#Region  Project Attributes
    #ApplicationLabel: b4aFontoMetrics
    #VersionCode: 1
    #VersionName:
    'SupportedOrientations possible values: unspecified, landscape or portrait.
    #SupportedOrientations: unspecified
    #CanInstallToExternalStorage: False
#End Region

#AdditionalRes: ..\LibRes

#Region  Activity Attributes
    #FullScreen: False
    #IncludeTitle: True
#End Region

Sub Process_Globals
    'These global variables will be declared once when the application starts.
    'These variables can be accessed from all modules.

End Sub

Sub Globals
    'These global variables will be redeclared each time the activity is created.
    'These variables can only be accessed from this module.
 
    Dim fm As FontoMetrics

    Private Label1 As Label
    Private Label2 As Label
    Private Label3 As Label
 
 
    Private Label4 As Label
End Sub

Sub Activity_Create(FirstTime As Boolean)
    'Do not forget to load the layout file created with the visual designer. For example:
    Activity.LoadLayout("main")
    fm.Initialize
 
    Label1.Typeface = fm.coffee_with_sugar
    Label1.Text = "Goodbye 2016"
    Label1.TextSize = 15
    Label1.Gravity = Gravity.CENTER
    Label1.TextColor = Colors.Yellow
    Label1.Color = Colors.Blue
 
    Label2.Typeface = fm.amatic_regular
    Label2.Text = "Hello 2017"
    Label2.TextSize = 25
    Label2.Gravity = Gravity.CENTER
    Label2.TextColor = Colors.Red 
    Label2.Color = Colors.Green
 
    Label3.Typeface = fm.elephant
    Label3.Text = "Hope it is a good one!"
    Label3.TextSize = 25
    Label3.Gravity = Gravity.CENTER
    Label3.TextColor = Colors.Red 
    Label3.Color = Colors.Gray 
 
    Label4.Typeface = fm.electricity
    Label4.Text = "May you be blessed...."
    Label4.TextSize = 20
    Label4.Gravity = Gravity.CENTER
    Label4.TextColor = Colors.Magenta
    Label4.Color = Colors.DarkGray
 
End Sub

Sub Activity_Resume

End Sub

Sub Activity_Pause (UserClosed As Boolean)

End Sub

Download LibRes.zip from here (https://www.dropbox.com/s/pwkcpqfdtlvrys3/LibRes.zip?dl=0) and then extract it and copy folder LibRes (with its contents) to be on the same folder level as that of the B4A project's /Files and /Objects folders.

1.png


Copy the attached library files to your additional library folder.
 

Attachments

  • FontoMetricsLibFiles.zip
    5.4 KB · Views: 410
  • b4aFontoMetrics.zip
    8 KB · Views: 392
  • TheJavaCode.zip
    3.2 KB · Views: 340
Last edited:

susu

Well-Known Member
Licensed User
Longtime User
Thank you Johan but what is the difference of this lib and "normal" Typeface?
 

Johan Schoeman

Expert
Licensed User
Longtime User
Thank you Johan but what is the difference of this lib and "normal" Typeface?
Not sure what you mean by "normal" Typeface....? The standard Typeface in B4A does not accommodate this unless I am mistaken?
 
Top