[Libreoffice] how to handle this bug (if this is one?)

Pierre-André Jacquod pjacquod at alumni.ethz.ch
Fri Aug 26 14:19:34 PDT 2011


hello,
in vcl/win/source/gdi/winlayout.cxx, around line 695 there is:

  long SimpleWinLayout::FillDXArray( long* pDXArray ) const
  {
+    if( !mnWidth )
+    {
+        long mnWidth = mnBaseAdv;
+        for( int i = 0; i < mnGlyphCount; ++i )
+            mnWidth += mpGlyphAdvances[ i ];
+    }

+    if( pDXArray != NULL )
      {
+        for( int i = 0; i < mnCharCount; ++i )
+             pDXArray[ i ] = mpCharWidths[ i ];
      }

+    return mnWidth;
  }

the statement within th IF does not make any sense for my poor 
understanding. As I read the code, the first IF could also be totally 
removed, since as soon as exiting the first IF, all value are lost.

It seems to me that this is more or less what happened with the early 
code before the change of commit 2f382d6c2579a2 in 2003. But I do not 
sucess to match both logic.
Has someone more / better hints?
Thanks
Pierre-André

long SimpleWinLayout::FillDXArray( long* pDXArray ) const
  {
-    if( mnWidth && !pDXArray )
-        return mnWidth;
-
-    long nWidth = 0;

-    for( int i = 0; i < mnGlyphCount; ++i )
      {
-        int j = !mpChars2Glyphs ? i : mpChars2Glyphs[i];
-        nWidth += mpGlyphAdvances[j];
-        if( pDXArray )
-            pDXArray[i] = nWidth;
      }

-    return nWidth;
  }



More information about the LibreOffice mailing list