svx/source/customshapes/EnhancedCustomShapeFontWork.cxx |   40 ++++++++++++++++
 1 file changed, 40 insertions(+)

New commits:
commit ecd615ab32fcacf8f8116672ebe631d1db72cb4e
Author:     Armin Le Grand (Allotropia) <armin.le.gr...@me.com>
AuthorDate: Thu Nov 18 18:06:39 2021 +0100
Commit:     Thorsten Behrens <thorsten.behr...@allotropia.de>
CommitDate: Thu Dec 9 15:48:27 2021 +0100

    VCL implement GetGlyphOutline fallback
    
    Change-Id: Ia0b32f7fb9f39d8bea18afd12df3cc95ba8077ff
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126463
    Tested-by: Jenkins
    Tested-by: Armin Le Grand <armin.le.gr...@me.com>
    Reviewed-by: Thorsten Behrens <thorsten.behr...@allotropia.de>

diff --git a/svx/source/customshapes/EnhancedCustomShapeFontWork.cxx 
b/svx/source/customshapes/EnhancedCustomShapeFontWork.cxx
index e5756f8ef37d..1284b11e4c65 100644
--- a/svx/source/customshapes/EnhancedCustomShapeFontWork.cxx
+++ b/svx/source/customshapes/EnhancedCustomShapeFontWork.cxx
@@ -374,6 +374,46 @@ static void GetTextAreaOutline(
                 FWCharacterData aCharacterData;
                 if ( pVirDev->GetTextOutlines( aCharacterData.vOutlines, 
rText, 0, 0, -1, nWidth, aDXArry ) )
                 {
+                    rParagraph.vCharacters.push_back( aCharacterData );
+                }
+                else
+                {
+                    // GetTextOutlines failed what usually means that it is
+                    // not implemented. To make FontWork not fail (it is
+                    // dependent of graphic content to get a Range) create
+                    // a rectangle substitution for now
+                    pVirDev->GetTextArray( rText, &aDXArry);
+                    aCharacterData.vOutlines.clear();
+
+                    if(aDXArry.size())
+                    {
+                        for(size_t a(0); a < aDXArry.size(); a++)
+                        {
+                            const basegfx::B2DPolygon aPolygon(
+                                basegfx::utils::createPolygonFromRect(
+                                basegfx::B2DRange(
+                                    0 == a ? 0 : aDXArry[a - 1],
+                                    0,
+                                    aDXArry[a],
+                                    aFont.GetFontHeight()
+                                )));
+                            
aCharacterData.vOutlines.push_back(tools::PolyPolygon(tools::Polygon(aPolygon)));
+                        }
+                    }
+                    else
+                    {
+                        const basegfx::B2DPolygon aPolygon(
+                            basegfx::utils::createPolygonFromRect(
+                            basegfx::B2DRange(
+                                0,
+                                0,
+                                aDXArry.empty() ? 10 : aDXArry.back(),
+                                aFont.GetFontHeight()
+                            )));
+                        
aCharacterData.vOutlines.push_back(tools::PolyPolygon(tools::Polygon(aPolygon)));
+                    }
+
+
                     rParagraph.vCharacters.push_back( aCharacterData );
                 }
             }

Reply via email to