summaryrefslogtreecommitdiff
path: root/cppcanvas
diff options
context:
space:
mode:
authorOliver Bolte <obo@openoffice.org>2005-05-03 13:11:39 +0000
committerOliver Bolte <obo@openoffice.org>2005-05-03 13:11:39 +0000
commit8c23ea798e062743a4a913c57e6dd2ce316b7fb5 (patch)
treee7047f20523046706d33aab9f84227584bc1f8ac /cppcanvas
parent51ccb70432e62fb4092f2614e09da1e0ddb0f787 (diff)
INTEGRATION: CWS presfixes05 (1.7.2); FILE MERGED
2005/04/26 22:48:07 thb 1.7.2.1: #i47795# Explicitely closing glyph polygons (freeType returns them open sometimes)
Diffstat (limited to 'cppcanvas')
-rw-r--r--cppcanvas/source/mtfrenderer/textaction.cxx49
1 files changed, 46 insertions, 3 deletions
diff --git a/cppcanvas/source/mtfrenderer/textaction.cxx b/cppcanvas/source/mtfrenderer/textaction.cxx
index 1dd7e7f76135..947b1e8621f9 100644
--- a/cppcanvas/source/mtfrenderer/textaction.cxx
+++ b/cppcanvas/source/mtfrenderer/textaction.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: textaction.cxx,v $
*
- * $Revision: 1.7 $
+ * $Revision: 1.8 $
*
- * last change: $Author: obo $ $Date: 2005-04-18 10:00:58 $
+ * last change: $Author: obo $ $Date: 2005-05-03 14:11:39 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -2057,7 +2057,50 @@ namespace cppcanvas
// append result to collecting polypoly
for( USHORT i=0; i<aVCLPolyPolygon.Count(); ++i )
- aResultingVCLPolyPolygon.Insert( aVCLPolyPolygon.GetObject( i ) );
+ {
+ // #i47795# Ensure closed polygons (since
+ // FreeType returns the glyph outlines
+ // open)
+ const ::Polygon& rPoly( aVCLPolyPolygon.GetObject( i ) );
+ const USHORT nCount( rPoly.GetSize() );
+ if( nCount<3 ||
+ rPoly[0] == rPoly[nCount-1] )
+ {
+ // polygon either degenerate, or
+ // already closed.
+ aResultingVCLPolyPolygon.Insert( rPoly );
+ }
+ else
+ {
+ ::Polygon aPoly(nCount+1);
+
+ // close polygon explicitely
+ if( rPoly.HasFlags() )
+ {
+ for( USHORT j=0; j<nCount; ++j )
+ {
+ aPoly[j] = rPoly[j];
+ aPoly.SetFlags(j, rPoly.GetFlags(j));
+ }
+
+ // duplicate first point
+ aPoly[nCount] = rPoly[0];
+ aPoly.SetFlags(nCount, POLY_NORMAL);
+ }
+ else
+ {
+ for( USHORT j=0; j<nCount; ++j )
+ {
+ aPoly[j] = rPoly[j];
+ }
+
+ // duplicate first point
+ aPoly[nCount] = rPoly[0];
+ }
+
+ aResultingVCLPolyPolygon.Insert( aPoly );
+ }
+ }
// TODO(F3): Depending on the semantics of
// GetTextOutlines(), this here is wrong!