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

Status
Not open for further replies.

William Lancee

Well-Known Member
Licensed User
Longtime User
That's the way it looks on my screen, like braille. Look at the Button, CustomListView and Images for how the text should look like.
 

jimmyF

Active Member
Licensed User
Longtime User

Erel

B4X founder
Staff member
Licensed User
Longtime User
It is related to the tablet low scale screen. Its scale is probably 1.0, right?
B4X:
Log(GetDeviceLayoutValues)

It will look better if you use the attached library (v1.03) which depends on the updated BitmapCreator library (v4.72, this is the same change as done in jBitmapCreator).
 

Attachments

  • BCTextEngine.b4xlib
    10 KB · Views: 310
  • BitmapCreator.zip
    46.1 KB · Views: 1,081

William Lancee

Well-Known Member
Licensed User
Longtime User
I don't have my equipment with me. I do know that 1dip=2. I'll try the new library in about 6 hours.
 

William Lancee

Well-Known Member
Licensed User
Longtime User
Log(GetDeviceLayoutValues) ==> 1536 x 2048, scale = 2.0 (320 dpi)

After updating the BCTextEngine.b4xlib and BitMapCreator library everything works beautifully.

Thanks. I am looking forward to using this new way of layout.

W
 

William Lancee

Well-Known Member
Licensed User
Longtime User
I have been experimenting with the new BBCodeView contruct. Here's my feedback for this Beta version.

I miss the ability to specify a Horizontal offset from the left/right margins when Alignment is Left/Right.
I came up with a klutzy method using a zero height panel, which works but not for multiple positions.
Apparently the MeasureText method doesn't measure the text in the new view accurately.

Although numbered Tab stops for the whole view might work, it won't be as flexible as an Horizontal tag.

For example, a two column text could be:

B4X:
BBCodeView1.Text = $"The first part[Alignment=Left Horizontal=50%x]The second part[/Alignment]"$
' or from the right
BBCodeView1.Text = $"[Alignment=Right Horizontal=50%x]The first part[/Alignment][Alignment=Right Horizontal=25%x]The second part[/Alignment]"$

Attached is the zip file of the klutzy workaround.

In the code, you'll also see a separate concern. It is assumed that Views added to the map have unique event names.
If they don't, the events are not send.
 

Attachments

  • BBCV-Beta.zip
    22.3 KB · Views: 291
Last edited:

Erel

B4X founder
Staff member
Licensed User
Longtime User
1.05 - New Span tag. The Span tag creates an unbreakable content. It supports the following keys: MinWidth and Alignment.
You can use it to create tables:



Width dimensions can be set with %x units. The percentage is relative to BBCodeView width.

See the updated examples.

Hi, on iPhone 5s am also getting the braille type of broken text. Am using the library version 1.03
Please try it with v1.05.
 

mcqueccu

Well-Known Member
Licensed User
Longtime User
I can't run on my iphone 5s again with the latest update. I kept getting this in the log.

Also, I realized my iBitmapCreator lib is NOT 4.71+. its version 4.70 could it be the cause?

NB: I am using Hosted Builder


B4X:
B4i Version: 5.51
Parsing code.    (0.08s)
Building folders structure.    (0.02s)
Compiling code.    Error
Error compiling program.
Error description: Unknown member: alphathresholdforcbcextraction
Error occurred on line: 463
CharBC.AlphaThresholdForCBCExtraction = 0
Word: alphathresholdforcbcextraction
 
Last edited:

asales

Expert
Licensed User
Longtime User
B4X:
B4i Version: 5.51

I get the same error in B4A:
B4X:
B4A Version: 9.01.2
Java Version: 8
Parsing code.    (0.04s)
Building folders structure.    (0.04s)
Compiling code.    Error
Error compiling program.
Error description: Unknown member: alphathresholdforcbcextraction
Error occurred on line: 463
CharBC.AlphaThresholdForCBCExtraction = 0
Word: alphathresholdforcbcextraction
 

Erel

B4X founder
Staff member
Licensed User
Longtime User

Erel

B4X founder
Staff member
Licensed User
Longtime User
1.50 - Large update. New BBLabel custom view. This is the lightweight version of BBCodeView. It is not scrollable and doesn't handle events.
- TextEngine.Initialize expects the parent view. It then searches the views tree for BB views and sets the engine. It is no longer needed to set the TextEngine for each view.
- New MaterialIcons and FontAwesome tags.
- The text can be set with the designer.

 

Toky Olivier

Active Member
Licensed User
Longtime User
And may be now, we can Measure width or height of richtext in BBCodeview or BBLabel?
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…