ivanomonti Expert Licensed User Longtime User Nov 28, 2014 #1 Hi community, how can I use a font just installed on the system. error Object was not initialized (UIFont)
Hi community, how can I use a font just installed on the system. error Object was not initialized (UIFont)
stevel05 Expert Licensed User Longtime User Nov 28, 2014 #2 Have a look here: https://www.b4x.com/android/forum/threads/custom-fonts.46461/ Upvote 0
ivanomonti Expert Licensed User Longtime User Nov 28, 2014 #3 Code: Copy #AppFont: 28-Days-Later.ttf #AppFont: a-song-for-jennifer-bold.ttf #AppFont: a-song for-jennifer.ttf Code: Copy Application_Start Application_Active Error occurred on line: 0 (classmenuday) Object was not initialized (UIFont) Stack Trace: ( CoreFoundation <redacted> + 150 libobjc.A.dylib objc_exception_throw + 38 CoreFoundation <redacted> + 0 BarAndRestaurant -[B4IObjectWrapper object] + 180 BarAndRestaurant -[B4ILabelWrapper setFont:] + 116 CoreFoundation <redacted> + 68 CoreFoundation <redacted> + 300 BarAndRestaurant +[B4I runDynamicMethod:method:throwErrorIfMissing:args:] + 1928 BarAndRestaurant -[B4IShell runMethod:] + 496 BarAndRestaurant -[B4IShell raiseEventImpl:method:args::] + 1846 BarAndRestaurant -[B4IShellBI raiseEvent:event:params:] + 1280 BarAndRestaurant __33-[B4I raiseUIEvent:event:params:]_block_invoke + 74 libdispatch.dylib <redacted> + 10 libdispatch.dylib <redacted> + 22 libdispatch.dylib <redacted> + 712 CoreFoundation <redacted> + 8 CoreFoundation <redacted> + 1512 CoreFoundation CFRunLoopRunSpecific + 476 CoreFoundation CFRunLoopRunInMode + 106 GraphicsServices GSEventRunModal + 136 UIKit UIApplicationMain + 1440 BarAndRestaurant main + 116 libdyld.dylib <redacted> + 2 ) Upvote 0
Code: Copy #AppFont: 28-Days-Later.ttf #AppFont: a-song-for-jennifer-bold.ttf #AppFont: a-song for-jennifer.ttf Code: Copy Application_Start Application_Active Error occurred on line: 0 (classmenuday) Object was not initialized (UIFont) Stack Trace: ( CoreFoundation <redacted> + 150 libobjc.A.dylib objc_exception_throw + 38 CoreFoundation <redacted> + 0 BarAndRestaurant -[B4IObjectWrapper object] + 180 BarAndRestaurant -[B4ILabelWrapper setFont:] + 116 CoreFoundation <redacted> + 68 CoreFoundation <redacted> + 300 BarAndRestaurant +[B4I runDynamicMethod:method:throwErrorIfMissing:args:] + 1928 BarAndRestaurant -[B4IShell runMethod:] + 496 BarAndRestaurant -[B4IShell raiseEventImpl:method:args::] + 1846 BarAndRestaurant -[B4IShellBI raiseEvent:event:params:] + 1280 BarAndRestaurant __33-[B4I raiseUIEvent:event:params:]_block_invoke + 74 libdispatch.dylib <redacted> + 10 libdispatch.dylib <redacted> + 22 libdispatch.dylib <redacted> + 712 CoreFoundation <redacted> + 8 CoreFoundation <redacted> + 1512 CoreFoundation CFRunLoopRunSpecific + 476 CoreFoundation CFRunLoopRunInMode + 106 GraphicsServices GSEventRunModal + 136 UIKit UIApplicationMain + 1440 BarAndRestaurant main + 116 libdyld.dylib <redacted> + 2 )
stevel05 Expert Licensed User Longtime User Nov 28, 2014 #4 The file name has spaces, as does the family name. You need to ignore these when creating the font. Also as the layout is reloaded in page _resize (unless you turn it off) you need to re-apply the font there. The font in the example was downloaded from here:http://www.dafont.com/28-days-later.font , please check the license if you want to use it. Attachments 28Font.zip 28Font.zip 194.5 KB · Views: 395 Upvote 0
The file name has spaces, as does the family name. You need to ignore these when creating the font. Also as the layout is reloaded in page _resize (unless you turn it off) you need to re-apply the font there. The font in the example was downloaded from here:http://www.dafont.com/28-days-later.font , please check the license if you want to use it.
Erel B4X founder Staff member Licensed User Longtime User Nov 30, 2014 #5 stevel05 said: Also as the layout is reloaded in page _resize (unless you turn it off) you need to re-apply the font there. Click to expand... Note that the layout is not fully reloaded when the page is resized. Only views sizes and positions are set at that point. Other properties are ignored. Upvote 0
stevel05 said: Also as the layout is reloaded in page _resize (unless you turn it off) you need to re-apply the font there. Click to expand... Note that the layout is not fully reloaded when the page is resized. Only views sizes and positions are set at that point. Other properties are ignored.
stevel05 Expert Licensed User Longtime User Nov 30, 2014 #6 Erel said: Only views sizes and positions are set at that point. Other properties are ignored. Click to expand... Could you check this one please @Erel, the font does not appear on the label if it is applied in Application_Start. It does when moved to Page1_Resize. Thanks Upvote 0
Erel said: Only views sizes and positions are set at that point. Other properties are ignored. Click to expand... Could you check this one please @Erel, the font does not appear on the label if it is applied in Application_Start. It does when moved to Page1_Resize. Thanks
Erel B4X founder Staff member Licensed User Longtime User Nov 30, 2014 #7 You are correct. There is a bug in AutoScaleAll that causes the designer font to be loaded. It will be fixed for the next update. Note that you will still need to set the correct size in the designer. Upvote 0
You are correct. There is a bug in AutoScaleAll that causes the designer font to be loaded. It will be fixed for the next update. Note that you will still need to set the correct size in the designer.
R Ramezanpour Active Member Licensed User Longtime User May 15, 2015 #8 Erel said: You are correct. There is a bug in AutoScaleAll that causes the designer font to be loaded. It will be fixed for the next update. Note that you will still need to set the correct size in the designer. Click to expand... I have this problem Code: Copy Copying updated assets files (4) Application_Start Application_Active Error occurred on line: 55 (first) Object was not initialized (UIFont) Stack Trace: ( CoreFoundation <redacted> + 150 libobjc.A.dylib objc_exception_throw + 38 CoreFoundation <redacted> + 0 i -[B4IObjectWrapper object] + 180 i -[B4ITabBarItemItemWrapper SetFont:] + 132 i -[b4i_first _sethome::] + 752 i -[b4i_first _showpageme] + 1404 i -[b4i_main _t_tick] + 366 CoreFoundation <redacted> + 68 CoreFoundation <redacted> + 300 i +[B4I runDynamicMethod:method:throwErrorIfMissing:args:] + 1928 i -[B4IShell runMethod:] + 496 i -[B4IShell raiseEventImpl:method:args::] + 1846 i -[B4IShellBI raiseEvent:event:params:] + 1316 i __24-[B4ITimer startTicking]_block_invoke + 298 libdispatch.dylib <redacted> + 10 libdispatch.dylib <redacted> + 66 libdispatch.dylib <redacted> + 22 libdispatch.dylib <redacted> + 1606 libdispatch.dylib <redacted> + 212 libdispatch.dylib _dispatch_main_queue_callback_4CF + 396 CoreFoundation <redacted> + 8 CoreFoundation <redacted> + 1512 CoreFoundation CFRunLoopRunSpecific + 476 CoreFoundation CFRunLoopRunInMode + 106 GraphicsServices GSEventRunModal + 136 UIKit UIApplicationMain + 1440 i main + 116 libdyld.dylib <redacted> + 2 ) I add this to Project Attributes Code: Copy #AppFont: tahoma.ttf And Add this to seccond Process_Globals Code: Copy Dim ta15 As Font ta15 = Font.CreateNew2("tahoma",15) And use in : Code: Copy Sub Setone(p As Page, title As String) Dim tb As TabBarItem tb.Initialize(title,LoadBitmap(File.DirAssets,"a.png"), Null) tb.SetFont(ta15) tb.SetTitleOffset(0, 0) p.TabBarItem = tb End Sub Upvote 0
Erel said: You are correct. There is a bug in AutoScaleAll that causes the designer font to be loaded. It will be fixed for the next update. Note that you will still need to set the correct size in the designer. Click to expand... I have this problem Code: Copy Copying updated assets files (4) Application_Start Application_Active Error occurred on line: 55 (first) Object was not initialized (UIFont) Stack Trace: ( CoreFoundation <redacted> + 150 libobjc.A.dylib objc_exception_throw + 38 CoreFoundation <redacted> + 0 i -[B4IObjectWrapper object] + 180 i -[B4ITabBarItemItemWrapper SetFont:] + 132 i -[b4i_first _sethome::] + 752 i -[b4i_first _showpageme] + 1404 i -[b4i_main _t_tick] + 366 CoreFoundation <redacted> + 68 CoreFoundation <redacted> + 300 i +[B4I runDynamicMethod:method:throwErrorIfMissing:args:] + 1928 i -[B4IShell runMethod:] + 496 i -[B4IShell raiseEventImpl:method:args::] + 1846 i -[B4IShellBI raiseEvent:event:params:] + 1316 i __24-[B4ITimer startTicking]_block_invoke + 298 libdispatch.dylib <redacted> + 10 libdispatch.dylib <redacted> + 66 libdispatch.dylib <redacted> + 22 libdispatch.dylib <redacted> + 1606 libdispatch.dylib <redacted> + 212 libdispatch.dylib _dispatch_main_queue_callback_4CF + 396 CoreFoundation <redacted> + 8 CoreFoundation <redacted> + 1512 CoreFoundation CFRunLoopRunSpecific + 476 CoreFoundation CFRunLoopRunInMode + 106 GraphicsServices GSEventRunModal + 136 UIKit UIApplicationMain + 1440 i main + 116 libdyld.dylib <redacted> + 2 ) I add this to Project Attributes Code: Copy #AppFont: tahoma.ttf And Add this to seccond Process_Globals Code: Copy Dim ta15 As Font ta15 = Font.CreateNew2("tahoma",15) And use in : Code: Copy Sub Setone(p As Page, title As String) Dim tb As TabBarItem tb.Initialize(title,LoadBitmap(File.DirAssets,"a.png"), Null) tb.SetFont(ta15) tb.SetTitleOffset(0, 0) p.TabBarItem = tb End Sub
Erel B4X founder Staff member Licensed User Longtime User May 15, 2015 #9 1. Make sure to go carefully over the tutorial: https://www.b4x.com/android/forum/threads/custom-fonts.46461/ If you still see this error then please start a new thread and upload the font file. Upvote 0
1. Make sure to go carefully over the tutorial: https://www.b4x.com/android/forum/threads/custom-fonts.46461/ If you still see this error then please start a new thread and upload the font file.
A Andrea Falcucci Member Licensed User Longtime User Oct 31, 2015 #10 Hi! I'm using a custom font on B4i and I'm creating all the labels via code without designer. I'm unable to let the createnew2 procedure works. #AppFont: lcddot.ttf in the Project Attributes later in the code Label1.initialize("Label1") Label1.Text = "Test" Label1.TextColor = Colors.White Label1.TextAlignment = Label1.ALIGNMENT_LEFT Label1.Font = Font.CreateNew2("LCDDot",10) MyPage.RootPanel.AddView(Label1, 0dip, 0dip, 100dip, 100dip) doesn't work if I use Label1.Font = Font.CreateNew(10) everything works fine. Thank you. Upvote 0
Hi! I'm using a custom font on B4i and I'm creating all the labels via code without designer. I'm unable to let the createnew2 procedure works. #AppFont: lcddot.ttf in the Project Attributes later in the code Label1.initialize("Label1") Label1.Text = "Test" Label1.TextColor = Colors.White Label1.TextAlignment = Label1.ALIGNMENT_LEFT Label1.Font = Font.CreateNew2("LCDDot",10) MyPage.RootPanel.AddView(Label1, 0dip, 0dip, 100dip, 100dip) doesn't work if I use Label1.Font = Font.CreateNew(10) everything works fine. Thank you.
Erel B4X founder Staff member Licensed User Longtime User Nov 1, 2015 #11 Please start a new thread for this and upload the font file is possible. Upvote 0
A Andrea Falcucci Member Licensed User Longtime User Nov 2, 2015 #12 Done! https://www.b4x.com/android/forum/threads/custom-font-doesnt-work.59944/ Upvote 0