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

Fabien Bodard gambas.fr at ...626...
Sat Dec 5 11:10:39 CET 2015


re OOpps, I've just see i've forgotten to manage when one line not fit
in the area.

2015-12-05 11:04 GMT+01:00 Fabien Bodard <gambas.fr at ...626...>:
> Hoops an insidious bug .
>
> 2015-12-05 10:19 GMT+01:00 Fabien Bodard <gambas.fr at ...626...>:
>> So this is my two cents. It's not optimized i should do better if i've
>> time. I will use something like this in a near time for reportLabels.
>>
>> Regards
>> --
>> Fabien Bodard
>>
>> 2015-12-04 13:04 GMT+01:00 Rolf-Werner Eilert <eilert-sprachen at ...221...>:
>>> 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 ...625...t>
>>>>   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
>>>>
>>>
>>>
>>> ------------------------------------------------------------------------------
>>> 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
>>
>>
>>
>> --
>> Fabien Bodard
>
>
>
> --
> Fabien Bodard



-- 
Fabien Bodard
-------------- next part --------------
A non-text attachment was scrubbed...
Name: RichTextBroke-0.0.3.tar.gz
Type: application/x-gzip
Size: 13313 bytes
Desc: not available
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20151205/4238f215/attachment.bin>


More information about the User mailing list