Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.clipper.visual-objects > #10784

Re: RP2 and Creators Update

From Karl Wochele <kw@ecos-system.invalid>
Newsgroups comp.lang.clipper.visual-objects
Subject Re: RP2 and Creators Update
Date 2017-07-21 13:38 +0200
Organization solani.org
Message-ID <oksp4a$lm0$1@solani.org> (permalink)
References <et6hdoF54r3U1@mid.individual.net> <oklorj$8i2$1@gioia.aioe.org> <okr12p$nas$1@gioia.aioe.org>

Show all headers | View raw


Hi Willi,

I remember we once also had a problem with right-aligned text. Very long 
ago I made the following changes in Drawtwxt of Rp2Dsn32.dll (luckily we 
have the source-code-version):

Changed:

STATIC FUNCTION rpCalcTextWidth(sDrawText AS RpDrawTextStruct,hDC AS 
PTR,nStartChar AS LONGINT,nStopChar AS LONGINT) AS DWORD

     LOCAL sSaveProp,sChrProp,sNextChrProp	AS CharProp
     LOCAL sParaProp						AS ParaProp
     LOCAL nWidth,nHeight					AS DWORD
     LOCAL ptrText							AS BYTE PTR
     LOCAL nTestChars						AS LONGINT
     LOCAL nTextExt							AS DWORD
// [KW---]
LOCAL winSize	IS _winSIZE
// [---KW]

     sSaveProp	:=sDrawText.sChrProp					// save the current pointer
     sChrProp	:=sDrawText.sChrProp					// get a pointer the RTF state 
structures
     sParaProp	:=sDrawText.sParaProp				// dereference the paragraph 
structure
     nWidth		:=0									// total width of the text
     nHeight		:=0									// max height of the text


     SetTextJustification(hDC,0,0)						// reset the text justification 
error term
     DO WHILE TRUE
         // calc the pointer to the text
         ptrText:=sDrawText.ptrText+nStartChar-1
         IF sChrProp.ptrNextState==NULL_PTR			// if there are no more 
attributes...
             nTestChars:=nStopChar-nStartChar+1 		// test the whole string
         ELSE
             sNextChrProp:=sChrProp.ptrNextState		// dereference the 
next state

             IF sNextChrProp.nStartChar<=nStartChar
                 sChrProp:=sNextChrProp
                 LOOP
             ELSEIF sNextChrProp.nStartChar<=nStopChar  	// if the next 
state starts on the before
                 // the end of the string test a substr
                 nTestChars:=sNextChrProp.nStartChar-nStartChar
             ELSE
                 nTestChars:=nStopChar-nStartChar+1	 	// test the whole 
string
             ENDIF
         ENDIF

         rpCreateFont(sDrawText,sChrProp) 				// create the font for the 
testing
         // get the width of this text

         IF nTestChars>0								// if there are characters with this 
attribrute

// [KW---] Korrektur des rechtsbündigen Ausdrucks (Problem war nur beim 
Drucker, nicht in der Vorschau)
//             nTextExt 
:=GetTabbedTextExtent(hDC,PSZ(_CAST,ptrText),nTestChars,sParaProp.nTabs,@sDrawText.aTabs)
//             nWidth		+= LoWord(nTextExt)
				IF sParaProp.nTabs > 0
	            nTextExt	:= 
GetTabbedTextExtent(hDC,PSZ(_CAST,ptrText),nTestChars,sParaProp.nTabs,@sDrawText.aTabs)
				ELSE
					GetTextExtentPoint32(hDC,PSZ(_CAST,ptrText),nTestChars,@winSize)
					nTextExt	:= DWORD(winSize.cy) << 16
					nTextExt	+= DWORD(winSize.cx)
				ENDIF
				nWidth += LoWord(nTextExt)
// [---KW]

             nStartChar	+=nTestChars
         ELSE
             nTextExt	:=GetTabbedTextExtent(hDC,PSZ(_CAST," "),1,0,NULL)
         ENDIF

         IF DWORD(HiWord(nTextExt))>nHeight				// adjust the height if 
required
             nHeight:=HiWord(nTextExt)
         ENDIF

         // if there is another state and it takes affect
         // before the end of our text, reference the
         // structure
         IF !sNextChrProp==NULL_PTR .AND. sNextChrProp.nStartChar<=nStopChar
             sChrProp:=sNextChrProp
         ENDIF

         IF nStartChar>nStopChar 						// bail out if we are finished...
             EXIT
         ENDIF
     ENDDO
     sDrawText.sChrProp:=sSaveProp

     nTextExt	:= DWORD(nHeight) << 16
     nTextExt	+= nWidth

     RETURN nTextExt


Original:

STATIC FUNCTION rpCalcTextWidth(sDrawText AS RpDrawTextStruct,hDC AS 
PTR,nStartChar AS LONGINT,nStopChar AS LONGINT) AS DWORD

     LOCAL sSaveProp,sChrProp,sNextChrProp	AS CharProp
     LOCAL sParaProp						AS ParaProp
     LOCAL nWidth,nHeight					AS DWORD
     LOCAL ptrText							AS BYTE PTR
     LOCAL nTestChars						AS LONGINT
     LOCAL nTextExt							AS DWORD

     sSaveProp	:=sDrawText.sChrProp					// save the current pointer
     sChrProp	:=sDrawText.sChrProp					// get a pointer the RTF state 
structures
     sParaProp	:=sDrawText.sParaProp				// dereference the paragraph 
structure
     nWidth		:=0									// total width of the text
     nHeight		:=0									// max height of the text

     SetTextJustification(hDC,0,0)						// reset the text justification 
error term
     DO WHILE TRUE
         // calc the pointer to the text
         ptrText:=sDrawText.ptrText+nStartChar-1
         IF sChrProp.ptrNextState==NULL_PTR			// if there are no more 
attributes...
             nTestChars:=nStopChar-nStartChar+1 		// test the whole string
         ELSE
             sNextChrProp:=sChrProp.ptrNextState		// dereference the 
next state

             IF sNextChrProp.nStartChar<=nStartChar
                 sChrProp:=sNextChrProp
                 LOOP
             ELSEIF sNextChrProp.nStartChar<=nStopChar  	// if the next 
state starts on the before
                 // the end of the string test a substr
                 nTestChars:=sNextChrProp.nStartChar-nStartChar
             ELSE
                 nTestChars:=nStopChar-nStartChar+1	 	// test the whole 
string
             ENDIF
         ENDIF

         rpCreateFont(sDrawText,sChrProp) 				// create the font for the 
testing
         // get the width of this text
         IF nTestChars>0								// if there are characters with this 
attribrute
             nTextExt 
:=GetTabbedTextExtent(hDC,PSZ(_CAST,ptrText),nTestChars,sParaProp.nTabs,@sDrawText.aTabs)
             nWidth		+= loword(nTextExt)
             nStartChar	+=nTestChars
         ELSE
             nTextExt	:=GetTabbedTextExtent(hDC,PSZ(_CAST," "),1,0,NULL)
         ENDIF

         IF DWORD(hiword(nTextExt))>nHeight				// adjust the height if 
required
             nHeight:=hiword(nTextExt)
         ENDIF
         // if there is another state and it takes affect
         // before the end of our text, reference the
         // structure
         IF !sNextChrProp==NULL_PTR .AND. sNextChrProp.nStartChar<=nStopChar
             sChrProp:=sNextChrProp
         ENDIF

         IF nStartChar>nStopChar 						// bail out if we are finished...
             EXIT
         ENDIF
     ENDDO
     sDrawText.sChrProp:=sSaveProp

     nTextExt	:=DWORD(nHeight) << 16
     nTextExt	+= nWidth
     RETURN nTextExt


Maybe that's the problem....

Karl


Am 20.07.2017 um 21:42 schrieb Willie Moore:
> Glen,
> 
> Can you point me to where you made your change and I will look at it.
> 
> Regards,
> Willie
> Grafx Development Team
> 
> "Glen Townsley"  wrote in message news:oklorj$8i2$1@gioia.aioe.org...
> 
> Stefan,
> 
> I have had the issue reported by a few users but I can now reproduce the
> issue since my system updated in the last couple of days. I traced the 
> issue
> to the DrawText() method which seems to incorrectly calculate the line
> breaks in the printed text within the rectangle nominated. I tested this by
> clipping the text (last parameter) and the text is printed in the correctly
> sized rectangle. It seems to be a horizontal issue, not a vertical issue
> within the rectangle. I "solved" the problem by applying a factor to the
> size of the horizontal dimension of the rectangle. In my case 0.9 or 0.95
> worked fine but I believe the issue is more pronounced the wider the
> rectangle. Hope this helps you.
> 
> Cheers
> 
> Glen Townsley
> 
> "Stefan Dietl"  wrote in message news:et6hdoF54r3U1@mid.individual.net...
> 
> After the creators update, texts in RP2.17 are displayed incorrectly.
> Probably a font problem? Lines and other objects are displayed correctly.
> Does anyone have the same problem (or a solution?)
> 
> Stefan

Back to comp.lang.clipper.visual-objects | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

RP2 and Creators Update Stefan Dietl <info@sdsoft.it> - 2017-07-18 15:40 +0200
  Re: RP2 and Creators Update D.J.W. van Kooten <vankooten@removethis.ic2.com> - 2017-07-18 21:19 +0200
  Re: RP2 and Creators Update "Glen Townsley" <glent@pronamics.com.au> - 2017-07-19 05:51 +1000
    Re: RP2 and Creators Update Stefan Dietl <info@sdsoft.it> - 2017-07-18 23:08 +0200
      Re: RP2 and Creators Update "Glen Townsley" <glent@pronamics.com.au> - 2017-07-19 08:31 +1000
        Re: RP2 and Creators Update Stefan Dietl <info@sdsoft.it> - 2017-07-19 06:54 +0200
          Re: RP2 and Creators Update "Glen Townsley" <coogee.2015@gmail.com> - 2017-07-19 15:42 +1000
          Re: RP2 and Creators Update D.J.W. van Kooten <vankooten@removethis.ic2.com> - 2017-07-19 09:35 +0200
          Re: RP2 and Creators Update "Wolfgang Riedmann" <wriedmann@gmail.com> - 2017-07-19 11:26 +0200
            Re: RP2 and Creators Update Stefan Dietl <info@sdsoft.it> - 2017-07-19 12:35 +0200
              Re: RP2 and Creators Update D.J.W. van Kooten <vankooten@removethis.ic2.com> - 2017-07-20 13:12 +0200
    Re: RP2 and Creators Update "Willie Moore" <williem@wmconsulting.com> - 2017-07-20 14:42 -0500
      Re: RP2 and Creators Update Karl Wochele <kw@ecos-system.invalid> - 2017-07-21 13:38 +0200
      Re: RP2 and Creators Update nicktekhne@googlemail.com - 2017-07-24 02:12 -0700
      Re: RP2 and Creators Update "Glen Townsley" <coogee.2015@gmail.com> - 2017-07-25 05:34 +1000
      Re: RP2 and Creators Update Stefan Dietl <info@sdsoft.it> - 2017-07-27 20:33 +0200
        Re: RP2 and Creators Update "Jamal" <noooospam@example.com> - 2017-07-27 14:52 -0400
          Re: RP2 and Creators Update D.J.W. van Kooten <vankooten@removethis.ic2.com> - 2017-07-27 23:26 +0200
            Re: RP2 and Creators Update "Wolfgang Riedmann" <wriedmann@gmail.com> - 2017-07-28 05:26 +0200
              Re: RP2 and Creators Update D.J.W. van Kooten <vankooten@removethis.ic2.com> - 2017-07-28 14:09 +0200
                Re: RP2 and Creators Update Stefan Dietl <info@sdsoft.it> - 2017-07-28 15:24 +0200
                Re: RP2 and Creators Update Martin <Martin@spam.spam> - 2017-09-27 13:04 +0100
                Re: RP2 and Creators Update D.J.W. van Kooten <vankooten@removethis.ic2.com> - 2017-10-02 00:39 +0200
                Re: RP2 and Creators Update Martin <Martin@spam.spam> - 2017-10-04 11:10 +0100
                Re: RP2 and Creators Update Martin <Martin@spam.spam> - 2017-10-04 11:12 +0100
                Re: RP2 and Creators Update Stefan Dietl <info@sdsoft.it> - 2017-10-02 16:18 +0200
                Re: RP2 and Creators Update D.J.W. van Kooten <vankooten@removethis.ic2.com> - 2017-10-02 22:29 +0200
                Re: RP2 and Creators Update Martin <Martin@spam.spam> - 2017-10-04 11:17 +0100
                Re: RP2 and Creators Update Martin <Martin@spam.spam> - 2017-10-06 09:02 +0100
                Re: RP2 and Creators Update sergio@lym.com.ar - 2017-10-09 16:48 -0700
                Re: RP2 and Creators Update Robert van der Hulst <rjvanderhulst@gmail.com> - 2017-07-30 03:10 -0700
                Re: RP2 and Creators Update D.J.W. van Kooten <vankooten@removethis.ic2.com> - 2017-08-01 11:39 +0200
                Re: RP2 and Creators Update "Wolfgang Riedmann" <wriedmann@gmail.com> - 2017-08-01 14:49 +0200
  Re: RP2 and Creators Update Martin <Martin@spam.spam> - 2017-08-09 09:45 +0100

csiph-web