IP and Fields (and another Field problem)


Subject: IP and Fields (and another Field problem)
From: Jesper Skov (jskov@redhat.com)
Date: Mon May 29 2000 - 05:34:54 CDT


Martin Sevior pointed out a problem with the findPointCoords function
when dealing with Fields:

Martin> In addition inserting Fields leads to the following assertion:
Martin>
Martin> **** (23) FP_RUN_NOT != containsOffset(iOffset) at fp_Run.cpp:1022 ****
Martin> **** (23) Continue ? (y/n) [y] : y
Martin>
Martin> and the cursor is positioned before the field instead of after
Martin> the field.

I cannot reproduce the assertion, but the position problem I can -
both with the old and new findPointCoords implementations. I believe
the below is a suitable fix.

Somewhat related; using sub/super script on fields cause their font to
reduce in sice, but there are no means for the code to adjust the
vertical position of the text. Is there any reason not to add
fp_TextRun::m_fPosition functionality to fp_FieldRun?

Jesper

        2000-05-29 Jesper Skov <jskov@redhat.com>
        * fp_Run.cpp (fp_FieldRun::findPointCoords): Return point position
        past field when necessary.

Index: fp_Run.cpp
===================================================================
RCS file: /cvsroot/abi/src/text/fmt/xp/fp_Run.cpp,v
retrieving revision 1.95
diff -u -5 -r1.95 fp_Run.cpp
--- fp_Run.cpp 2000/05/18 06:10:05 1.95
+++ fp_Run.cpp 2000/05/29 10:24:38
@@ -1003,10 +1003,20 @@
         UT_sint32 yoff;
 
         UT_ASSERT(m_pLine);
         
         m_pLine->getOffsets(this, xoff, yoff);
+
+ // Assuming there is only one offset in this Run, the point
+ // can be either before or after this offset. Return X
+ // position accordingly.
+ UT_ASSERT(1 == m_iLen);
+ if (iOffset > m_iOffsetFirst)
+ {
+ xoff += m_iWidth;
+ }
+
         x = xoff;
         y = yoff;
         height = m_iHeight;
 }
 



This archive was generated by hypermail 2b25 : Mon May 29 2000 - 05:35:03 CDT