[Libreoffice-commits] core.git: vcl/inc vcl/quartz vcl/source vcl/unx

Khaled Hosny khaledhosny at eglug.org
Sun Dec 11 00:22:08 UTC 2016


 vcl/inc/sallayout.hxx                    |    5 +++++
 vcl/quartz/salgdi.cxx                    |    4 ++--
 vcl/source/gdi/sallayout.cxx             |    4 ++--
 vcl/source/outdev/text.cxx               |    2 +-
 vcl/unx/generic/gdi/cairotextrender.cxx  |    4 ++--
 vcl/unx/generic/print/genpspgraphics.cxx |    4 ++--
 6 files changed, 14 insertions(+), 9 deletions(-)

New commits:
commit 0fb0a564bf9cb0f721e812ac4bfa70e951827bdd
Author: Khaled Hosny <khaledhosny at eglug.org>
Date:   Thu Dec 8 05:38:08 2016 +0200

    Don’t encode font fallback level in the glyph id
    
    Change-Id: I747d969c3c1dc42b1a3b5d12d06fed3af9a64675
    Reviewed-on: https://gerrit.libreoffice.org/31818
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Khaled Hosny <khaledhosny at eglug.org>

diff --git a/vcl/inc/sallayout.hxx b/vcl/inc/sallayout.hxx
index 9e7f8ab..ee41051 100644
--- a/vcl/inc/sallayout.hxx
+++ b/vcl/inc/sallayout.hxx
@@ -279,6 +279,8 @@ struct GlyphItem
     sal_GlyphId maGlyphId;
     Point   maLinearPos;    // absolute position of non rotated string
 
+    int     mnFallbackLevel;
+
 public:
             GlyphItem()
             :   mnFlags(0)
@@ -287,6 +289,7 @@ public:
             ,   mnNewWidth(0)
             ,   mnXOffset(0)
             ,   maGlyphId(0)
+            ,   mnFallbackLevel(0)
             { }
 
             GlyphItem( int nCharPos, sal_GlyphId aGlyphId, const Point& rLinearPos,
@@ -298,6 +301,7 @@ public:
             ,   mnXOffset(0)
             ,   maGlyphId(aGlyphId)
             ,   maLinearPos(rLinearPos)
+            ,   mnFallbackLevel(0)
             { }
 
             GlyphItem( int nCharPos, sal_GlyphId aGlyphId, const Point& rLinearPos,
@@ -309,6 +313,7 @@ public:
             ,   mnXOffset(nXOffset)
             ,   maGlyphId(aGlyphId)
             ,   maLinearPos(rLinearPos)
+            ,   mnFallbackLevel(0)
             { }
 
     enum {
diff --git a/vcl/quartz/salgdi.cxx b/vcl/quartz/salgdi.cxx
index c8f9c75..0df8955 100644
--- a/vcl/quartz/salgdi.cxx
+++ b/vcl/quartz/salgdi.cxx
@@ -384,7 +384,7 @@ bool AquaSalGraphics::AddTempDevFont( PhysicalFontCollection*,
 
 bool AquaSalGraphics::GetGlyphOutline(const GlyphItem& rGlyph, basegfx::B2DPolyPolygon& rPolyPoly)
 {
-    const int nFallbackLevel = rGlyph.maGlyphId >> GF_FONTSHIFT;
+    const int nFallbackLevel = rGlyph.mnFallbackLevel;
     if (nFallbackLevel < MAX_FALLBACK && mpTextStyle[nFallbackLevel])
     {
         const bool bRC = mpTextStyle[nFallbackLevel]->GetGlyphOutline(rGlyph, rPolyPoly);
@@ -395,7 +395,7 @@ bool AquaSalGraphics::GetGlyphOutline(const GlyphItem& rGlyph, basegfx::B2DPolyP
 
 bool AquaSalGraphics::GetGlyphBoundRect(const GlyphItem& rGlyph, Rectangle& rRect )
 {
-    const int nFallbackLevel = rGlyph.maGlyphId >> GF_FONTSHIFT;
+    const int nFallbackLevel = rGlyph.mnFallbackLevel;
     if (nFallbackLevel < MAX_FALLBACK && mpTextStyle[nFallbackLevel])
     {
         const bool bRC = mpTextStyle[nFallbackLevel]->GetGlyphBoundRect(rGlyph, rRect);
diff --git a/vcl/source/gdi/sallayout.cxx b/vcl/source/gdi/sallayout.cxx
index 9c4c48f..bdbb28d 100644
--- a/vcl/source/gdi/sallayout.cxx
+++ b/vcl/source/gdi/sallayout.cxx
@@ -1610,8 +1610,8 @@ int MultiSalLayout::GetNextGlyphs(int nLen, const GlyphItem** pGlyphs,
             nStart |= nFontTag;
             for( int i = 0; i < nRetVal; ++i )
             {
-                // FIXME: This is ugly!
-                const_cast<GlyphItem*>(pGlyphs[i])->maGlyphId |= nFontTag;
+                // FIXME: This cast is ugly!
+                const_cast<GlyphItem*>(pGlyphs[i])->mnFallbackLevel = nLevel;
                 if( pFallbackFonts )
                 {
                     pFallbackFonts[ i ] =  mpFallbackFonts[ nLevel ];
diff --git a/vcl/source/outdev/text.cxx b/vcl/source/outdev/text.cxx
index 93deefe..2d66822 100644
--- a/vcl/source/outdev/text.cxx
+++ b/vcl/source/outdev/text.cxx
@@ -2397,7 +2397,7 @@ SystemTextLayoutData OutputDevice::GetSysTextLayoutData(const Point& rStartPt, c
         aSystemGlyph.index = static_cast<unsigned long> (pGlyph->maGlyphId & GF_IDXMASK);
         aSystemGlyph.x = aPos.X();
         aSystemGlyph.y = aPos.Y();
-        int nLevel = (pGlyph->maGlyphId & GF_FONTMASK) >> GF_FONTSHIFT;
+        int nLevel = pGlyph->mnFallbackLevel;
         aSystemGlyph.fallbacklevel = nLevel < MAX_FALLBACK ? nLevel : 0;
         aSysLayoutData.rGlyphData.push_back(aSystemGlyph);
     }
diff --git a/vcl/unx/generic/gdi/cairotextrender.cxx b/vcl/unx/generic/gdi/cairotextrender.cxx
index a188ad3..ec025b8 100644
--- a/vcl/unx/generic/gdi/cairotextrender.cxx
+++ b/vcl/unx/generic/gdi/cairotextrender.cxx
@@ -427,7 +427,7 @@ void CairoTextRender::GetFontMetric( ImplFontMetricDataRef& rxFontMetric, int nF
 
 bool CairoTextRender::GetGlyphBoundRect(const GlyphItem& rGlyph, Rectangle& rRect)
 {
-    const int nLevel = rGlyph.maGlyphId >> GF_FONTSHIFT;
+    const int nLevel = rGlyph.mnFallbackLevel;
     if( nLevel >= MAX_FALLBACK )
         return false;
 
@@ -457,7 +457,7 @@ bool CairoTextRender::GetGlyphBoundRect(const GlyphItem& rGlyph, Rectangle& rRec
 bool CairoTextRender::GetGlyphOutline(const GlyphItem& rGlyph,
     basegfx::B2DPolyPolygon& rPolyPoly )
 {
-    const int nLevel = rGlyph.maGlyphId >> GF_FONTSHIFT;
+    const int nLevel = rGlyph.mnFallbackLevel;
     if( nLevel >= MAX_FALLBACK )
         return false;
 
diff --git a/vcl/unx/generic/print/genpspgraphics.cxx b/vcl/unx/generic/print/genpspgraphics.cxx
index 97fadbd..a9ff215 100644
--- a/vcl/unx/generic/print/genpspgraphics.cxx
+++ b/vcl/unx/generic/print/genpspgraphics.cxx
@@ -760,7 +760,7 @@ void GenPspGraphics::GetFontMetric(ImplFontMetricDataRef& rxFontMetric, int nFal
 
 bool GenPspGraphics::GetGlyphBoundRect(const GlyphItem& rGlyph, Rectangle& rRect)
 {
-    const int nLevel = rGlyph.maGlyphId >> GF_FONTSHIFT;
+    const int nLevel = rGlyph.mnFallbackLevel;
     if( nLevel >= MAX_FALLBACK )
         return false;
 
@@ -776,7 +776,7 @@ bool GenPspGraphics::GetGlyphBoundRect(const GlyphItem& rGlyph, Rectangle& rRect
 bool GenPspGraphics::GetGlyphOutline(const GlyphItem& rGlyph,
     basegfx::B2DPolyPolygon& rB2DPolyPoly )
 {
-    const int nLevel = rGlyph.maGlyphId >> GF_FONTSHIFT;
+    const int nLevel = rGlyph.mnFallbackLevel;
     if( nLevel >= MAX_FALLBACK )
         return false;
 


More information about the Libreoffice-commits mailing list