Emme Developer Well-Known Member Licensed User Longtime User Oct 18, 2017 #1 Hi! Can anyone explain how can i right use b4x font? I have a code module utils in which i load some fonts, i want to use same code on b4i.. thanks Code: Public const SansSemibold As Typeface = Typeface.LoadFromAssets("SourceSansPro-Semibold.otf") Public const SansLight As Typeface = Typeface.LoadFromAssets("SourceSansPro-Light.ttf") Public const SansBold As Typeface = Typeface.LoadFromAssets("SourceSansPro-Bold.otf") Public const SansBlack As Typeface = Typeface.LoadFromAssets("SourceSansPro-Black.ttf") Public const SansRegular As Typeface = Typeface.LoadFromAssets("SourceSansPro-Regular.otf")
Hi! Can anyone explain how can i right use b4x font? I have a code module utils in which i load some fonts, i want to use same code on b4i.. thanks Code: Public const SansSemibold As Typeface = Typeface.LoadFromAssets("SourceSansPro-Semibold.otf") Public const SansLight As Typeface = Typeface.LoadFromAssets("SourceSansPro-Light.ttf") Public const SansBold As Typeface = Typeface.LoadFromAssets("SourceSansPro-Bold.otf") Public const SansBlack As Typeface = Typeface.LoadFromAssets("SourceSansPro-Black.ttf") Public const SansRegular As Typeface = Typeface.LoadFromAssets("SourceSansPro-Regular.otf")
D Deleted member 103 Guest Oct 19, 2017 #2 Emme Developer said: Hi! Can anyone explain how can i right use b4x font? I have a code module utils in which i load some fonts, i want to use same code on b4i.. thanks Code: Public const SansSemibold As Typeface = Typeface.LoadFromAssets("SourceSansPro-Semibold.otf") Public const SansLight As Typeface = Typeface.LoadFromAssets("SourceSansPro-Light.ttf") Public const SansBold As Typeface = Typeface.LoadFromAssets("SourceSansPro-Bold.otf") Public const SansBlack As Typeface = Typeface.LoadFromAssets("SourceSansPro-Black.ttf") Public const SansRegular As Typeface = Typeface.LoadFromAssets("SourceSansPro-Regular.otf") Click to expand... https://www.b4x.com/android/forum/threads/custom-fonts.46461/#content Upvote 0
Emme Developer said: Hi! Can anyone explain how can i right use b4x font? I have a code module utils in which i load some fonts, i want to use same code on b4i.. thanks Code: Public const SansSemibold As Typeface = Typeface.LoadFromAssets("SourceSansPro-Semibold.otf") Public const SansLight As Typeface = Typeface.LoadFromAssets("SourceSansPro-Light.ttf") Public const SansBold As Typeface = Typeface.LoadFromAssets("SourceSansPro-Bold.otf") Public const SansBlack As Typeface = Typeface.LoadFromAssets("SourceSansPro-Black.ttf") Public const SansRegular As Typeface = Typeface.LoadFromAssets("SourceSansPro-Regular.otf") Click to expand... https://www.b4x.com/android/forum/threads/custom-fonts.46461/#content
Erel B4X founder Staff member Licensed User Longtime User Oct 19, 2017 #3 Moved to B4i forum. Upvote 0
Emme Developer Well-Known Member Licensed User Longtime User Oct 19, 2017 #4 Filippo said: https://www.b4x.com/android/forum/threads/custom-fonts.46461/#content Click to expand... I know this, but i don't know how use XUI Font and if is possibile to use same code. Obviously in b4i we need to declare apps font as wrote in tutorial Erel said: Moved to B4i forum. Click to expand... Sorry for mistake Upvote 0
Filippo said: https://www.b4x.com/android/forum/threads/custom-fonts.46461/#content Click to expand... I know this, but i don't know how use XUI Font and if is possibile to use same code. Obviously in b4i we need to declare apps font as wrote in tutorial Erel said: Moved to B4i forum. Click to expand... Sorry for mistake
Erel B4X founder Staff member Licensed User Longtime User Oct 19, 2017 #5 The first step is to load the B4i Font with Font.CreateNew. You can then convert it to a B4XFont with: Code: Dim xfont As B4XFont = xui.CreateFont(Font, 16) Upvote 0
The first step is to load the B4i Font with Font.CreateNew. You can then convert it to a B4XFont with: Code: Dim xfont As B4XFont = xui.CreateFont(Font, 16)
Emme Developer Well-Known Member Licensed User Longtime User Oct 19, 2017 #6 Erel said: The first step is to load the B4i Font with Font.CreateNew. You can then convert it to a B4XFont with: Code: Dim xfont As B4XFont = xui.CreateFont(Font, 16) Click to expand... So there is not a general load from assets.. i need something like this? Code: #If b4a Public SansSemibold As B4XFont= xui.CreateFont(Typeface.LoadFromAssets("SourceSansPro-Semibold.otf"), 16) #else if b4i Public SansSemibold As B4XFont= xui.CreateFont(Font.CreateNew2("SourceSansPro-Semibold", 30), 16) #end if Upvote 0
Erel said: The first step is to load the B4i Font with Font.CreateNew. You can then convert it to a B4XFont with: Code: Dim xfont As B4XFont = xui.CreateFont(Font, 16) Click to expand... So there is not a general load from assets.. i need something like this? Code: #If b4a Public SansSemibold As B4XFont= xui.CreateFont(Typeface.LoadFromAssets("SourceSansPro-Semibold.otf"), 16) #else if b4i Public SansSemibold As B4XFont= xui.CreateFont(Font.CreateNew2("SourceSansPro-Semibold", 30), 16) #end if
Erel B4X founder Staff member Licensed User Longtime User Oct 19, 2017 #7 Emme Developer said: So there is not a general load from assets.. i need something like this? Click to expand... Yes. It might be added in the future, though there are several nuances here such as the file name vs. the font name. Remember that XUI library doesn't replace the native libraries. It is intended to work together. Upvote 0
Emme Developer said: So there is not a general load from assets.. i need something like this? Click to expand... Yes. It might be added in the future, though there are several nuances here such as the file name vs. the font name. Remember that XUI library doesn't replace the native libraries. It is intended to work together.