B4A Library [B4X] BCTextEngine / BBCodeView - Text engine + BBCode parser + Rich Text View

Status
Not open for further replies.

Erel

B4X founder
Staff member
Licensed User
Longtime User
Worth saying that the default value of WordBoundaries (not WordBoundariesThatCanConnectToPrevWord) is:
B4X:
"&*+-/.<>=\' ,:{}" & TAB & CRLF & Chr(13)
Other characters that you add to WordBoundariesThatCanConnectToPrevWord will not matter.

It makes sense to remove dot and comma from WordBoundaries if there is a space or end of line after these characters. This will cause them to be treated like regular characters.
 

William Lancee

Well-Known Member
Licensed User
Longtime User
Or... should I remove the single quote from WordBoundaries? So that 'Bob' will stay as one entity?
 

tuhatinhvn

Active Member
Licensed User
Longtime User
This library is very good, but sometimes, has some crashs because memory is out, settext,... I found it on some my apps on google play, when i test on my phone it is ok, but some users or phone has crashs, so i remove it now and use label or webview
 

trueboss323

Active Member
Licensed User
Longtime User
Is this a bug in the library?
 

William Lancee

Well-Known Member
Licensed User
Longtime User
Italics would be nice.

Note, if you don't need bold then this is a workaround.

B4X:
BBCodeView1.ParseData.DefaultBoldFont = xui.CreateFont(Typeface.CreateNew(Typeface.SANS_SERIF, Typeface.STYLE_ITALIC), 12)
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
V1.71 adds support for custom fonts.
Example:
B4X:
TextEngine.CustomFonts.Put("italic",xui.CreateFont(Typeface.CreateNew(Typeface.DEFAULT, Typeface.STYLE_ITALIC), 10)) 'size not important
BBCodeView1.Text = $"Example of using [font=italic]custom[/font] font. We can also [font=italic size=30]change its size.[/font]"$

Cross platform italic font:
B4X:
Sub AddItalicFont
#If B4A
TextEngine.CustomFonts.Put("italic",xui.CreateFont(Typeface.CreateNew(Typeface.DEFAULT, Typeface.STYLE_ITALIC), 10)) 
#Else If B4J
TextEngine.CustomFonts.Put("italic",xui.CreateFont(fx.CreateFont("System", 10, False, True), 10))
#Else If B4i
TextEngine.CustomFonts.Put("italic",xui.CreateFont(Font.CreateNew2("HelveticaNeue-Italic", 10), 10))
#End If
End Sub
 

William Lancee

Well-Known Member
Licensed User
Longtime User
That's a fantastic improvement! My father was a typesetter, and I inherited a distaste for ugly fonts.
 

peacemaker

Expert
Licensed User
Longtime User
Please, mark some difference on the screenshot with\without kerning, where to see the difference, i cannot detect .
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…