[Gambas-user] R: Fitting RichtText into several limited areas

Rolf-Werner Eilert eilert-sprachen at ...221...
Fri Dec 4 13:04:28 CET 2015


I don't think so, because it describes the wideth of a single line of 
richtext.

Paint.Richtext or Paint.DrawRichtext accept a Height for the textframe, 
but it is practically unused. The function goes on drawing beyond this 
point. This is where you would have to start helping.

Let's see what would be necessary to do what I was looking for, 
something pseudo code:

frameLength = 70 'mm

sRtext = File.Load("myrichtext")

If Paint.RichTextHeight(sRtext) > frameLength Then

     'if it stopped drawing at 70 mm
     Paint.DrawRichText(sRtext, x1, y1, width, frameLength)
   Paint.DrawRichText(RSTring.Mid(sRtext, RichTextLength(sRtext, 
frameLength) + 1, x2, y2, W, frameLength)

     'like it is now, not stopping, with special cutting function
     Paint.DrawRichText(RString.Left(sRtext, RichTextLength(sRtext, 
frameLength)), x1, y1, W, frameLength)
     Paint.DrawRichText(RString.Mid(sRtext, RichTextLength(sRtext, 
frameLength) + 1, x2, y2, W, frameLength)

Else

     Paint.DrawRichText(sRtext, x1, y1, width, frameLength)

Endif


So, this is just phantasy, but does it make it clearer? A class RString 
would be needed, and a function that finds the position of the last 
printable character in a RichText of given width. But I know, catenating 
of these tagged strings would mean interpreting them, it's rather tricky...

Regards
Rolf


Am 04.12.2015 12:05, schrieb Ru Vuott:
> Hello,
>
> ...could .Font.RichTextWidth() function help you ?
>
> vuott
>
>
>
> --------------------------------------------
> Ven 4/12/15, Rolf-Werner Eilert <eilert-sprachen at ...221...> ha scritto:
>
>   Oggetto: [Gambas-user] Fitting RichtText into several limited areas
>   A: "mailing list for gambas users" <gambas-user at lists.sourceforge.net>
>   Data: Venerdì 4 dicembre 2015, 10:01
>   
>   Can I somehow predict where a
>   RichText will be too long for a box of
>   text on a page, then cut it there, and let the rest flow
>   into another box?
>   
>   You all know this from DTP programs: you have several text
>   frames, and
>   text is running on from one frame into the next if too
>   long.
>   
>   I guess this isn't possible because there seems to be no
>   intelligent
>   helper function that can handle RichText strings like e. g.
>   UTF-8
>   strings are handled in contrary to ASCII strings. As far as
>   I can see,
>   RichText is simply a UTF-8 string containing a lot of XML
>   tags. A
>   special Left, Mid or Right function would have to
>   reconstruct these tags
>   for the other part of the string to keep the tags
>   functionable.
>   
>   A workaround would be to extract the pure text and store the
>   tagged
>   values somewhere else until the text has been cut apart. But
>   it would
>   make the whole automatic in RichText senseless.
>   
>   But maybe I just didn't find this functionality?
>   
>   Regards
>   Rolf
>   
>   
>   ------------------------------------------------------------------------------
>   Go from Idea to Many App Stores Faster with Intel(R) XDK
>   Give your users amazing mobile app experiences with Intel(R)
>   XDK.
>   Use one codebase in this all-in-one HTML5 development
>   environment.
>   Design, debug & build mobile apps & 2D/3D
>   high-impact games for multiple OSs.
>   http://pubads.g.doubleclick.net/gampad/clk?id=254741911&iu=/4140
>   _______________________________________________
>   Gambas-user mailing list
>   Gambas-user at lists.sourceforge.net
>   https://lists.sourceforge.net/lists/listinfo/gambas-user
>





More information about the User mailing list