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

Discussion in 'Additional libraries, classes and official updates' started by Erel, May 28, 2019.

  1. Sandman

    Sandman Well-Known Member Licensed User

    You might want to post a somewhat bigger picture to better show the problem, your current picture looks like braille. :)
     
  2. William Lancee

    William Lancee Member Licensed 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.
     
  3. jimmyF

    jimmyF Active Member Licensed User

    Have you tried this:
    Code:
    BBCodeView1.DefaultFont = xui.CreateDefaultBoldFont(20)
    -j
     
  4. William Lancee

    William Lancee Member Licensed User

    Thanks, I tried it, but that just made the "braille" bolder.
     
  5. Erel

    Erel Administrator Staff Member Licensed User

    It is related to the tablet low scale screen. Its scale is probably 1.0, right?
    Code:
    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).
     

    Attached Files:

    Toky Olivier and William Lancee like this.
  6. William Lancee

    William Lancee Member Licensed 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.
     
  7. William Lancee

    William Lancee Member Licensed 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
     
    Erel likes this.
  8. William Lancee

    William Lancee Member Licensed 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:

    Code:
    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.
     

    Attached Files:

    Last edited: Jun 7, 2019
  9. mcqueccu

    mcqueccu Active Member Licensed User

    Hi, on iPhone 5s am also getting the braille type of broken text. Am using the library version 1.03
     
  10. Erel

    Erel Administrator Staff Member Licensed 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:

    [​IMG]

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

    See the updated examples.

    Please try it with v1.05.
     
    William Lancee likes this.
  11. mcqueccu

    mcqueccu Active Member Licensed 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


    Code:
    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: Jun 9, 2019
  12. William Lancee

    William Lancee Member Licensed User

    The unbreakable span tag is a very good alternative to an horizontal offset.
     
  13. asales

    asales Well-Known Member Licensed User

    I get the same error in B4A:
    Code:
    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
     
  14. Erel

    Erel Administrator Staff Member Licensed User

    You need to download the latest version of BitmapCreator: https://www.b4x.com/android/forum/attachments/bitmapcreator-zip.81067/

    Yes. The latest version is included in B4i v5.80 (currently in beta).
     
    asales likes this.
  15. mcqueccu

    mcqueccu Active Member Licensed User


    So does it mean that BCTextEngine will not support B4i 5.50?
     
  16. DonManfred

    DonManfred Expert Licensed User

    Yes, Based on #1 you need 5.8+
     
  17. mcqueccu

    mcqueccu Active Member Licensed User

    ok Thank you, didnt see that notice at First
     
  18. Erel

    Erel Administrator Staff Member Licensed User

    1.06 - New Indent and List tags.

    [​IMG]
     
  19. Erel

    Erel Administrator Staff Member Licensed 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.

    [​IMG]
     
  20. Toky Olivier

    Toky Olivier Member Licensed User

    And may be now, we can Measure width or height of richtext in BBCodeview or BBLabel?
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice