151747b8eSHerbert Dürr /**************************************************************
251747b8eSHerbert Dürr *
351747b8eSHerbert Dürr * Licensed to the Apache Software Foundation (ASF) under one
451747b8eSHerbert Dürr * or more contributor license agreements. See the NOTICE file
551747b8eSHerbert Dürr * distributed with this work for additional information
651747b8eSHerbert Dürr * regarding copyright ownership. The ASF licenses this file
751747b8eSHerbert Dürr * to you under the Apache License, Version 2.0 (the
851747b8eSHerbert Dürr * "License"); you may not use this file except in compliance
951747b8eSHerbert Dürr * with the License. You may obtain a copy of the License at
1051747b8eSHerbert Dürr *
1151747b8eSHerbert Dürr * http://www.apache.org/licenses/LICENSE-2.0
1251747b8eSHerbert Dürr *
1351747b8eSHerbert Dürr * Unless required by applicable law or agreed to in writing,
1451747b8eSHerbert Dürr * software distributed under the License is distributed on an
1551747b8eSHerbert Dürr * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
1651747b8eSHerbert Dürr * KIND, either express or implied. See the License for the
1751747b8eSHerbert Dürr * specific language governing permissions and limitations
1851747b8eSHerbert Dürr * under the License.
1951747b8eSHerbert Dürr *
2051747b8eSHerbert Dürr *************************************************************/
2151747b8eSHerbert Dürr
2251747b8eSHerbert Dürr // MARKER(update_precomp.py): autogen include statement, do not remove
2351747b8eSHerbert Dürr #include "precompiled_vcl.hxx"
2451747b8eSHerbert Dürr
2551747b8eSHerbert Dürr #include <boost/assert.hpp>
2651747b8eSHerbert Dürr #include <vector>
27*e26449d3SHerbert Dürr #include <hash_map>
2851747b8eSHerbert Dürr #include <set>
2951747b8eSHerbert Dürr
30*e26449d3SHerbert Dürr #include "salgdi.h"
3151747b8eSHerbert Dürr #include "atsfonts.hxx"
32*e26449d3SHerbert Dürr
33*e26449d3SHerbert Dürr #include "vcl/svapp.hxx"
34*e26449d3SHerbert Dürr #include "vcl/impfont.hxx"
35*e26449d3SHerbert Dürr
36*e26449d3SHerbert Dürr #include "basegfx/polygon/b2dpolygon.hxx"
37*e26449d3SHerbert Dürr #include "basegfx/matrix/b2dhommatrix.hxx"
38*e26449d3SHerbert Dürr
39*e26449d3SHerbert Dürr typedef GlyphID ATSGlyphID;
40*e26449d3SHerbert Dürr
41*e26449d3SHerbert Dürr // =======================================================================
42*e26449d3SHerbert Dürr
43*e26449d3SHerbert Dürr // mac specific physically available font face
44*e26449d3SHerbert Dürr class AtsFontData
45*e26449d3SHerbert Dürr : public ImplMacFontData
46*e26449d3SHerbert Dürr {
47*e26449d3SHerbert Dürr public:
48*e26449d3SHerbert Dürr explicit AtsFontData( const ImplDevFontAttributes&, ATSUFontID );
49*e26449d3SHerbert Dürr virtual ~AtsFontData( void );
50*e26449d3SHerbert Dürr virtual ImplFontData* Clone( void ) const;
51*e26449d3SHerbert Dürr
52*e26449d3SHerbert Dürr virtual ImplMacTextStyle* CreateMacTextStyle( const ImplFontSelectData& ) const;
53*e26449d3SHerbert Dürr virtual ImplFontEntry* CreateFontInstance( /*const*/ ImplFontSelectData& ) const;
54*e26449d3SHerbert Dürr virtual int GetFontTable( const char pTagName[5], unsigned char* ) const;
55*e26449d3SHerbert Dürr };
56*e26449d3SHerbert Dürr
57*e26449d3SHerbert Dürr // =======================================================================
58*e26449d3SHerbert Dürr
59*e26449d3SHerbert Dürr class AtsFontList
60*e26449d3SHerbert Dürr : public SystemFontList
61*e26449d3SHerbert Dürr {
62*e26449d3SHerbert Dürr public:
63*e26449d3SHerbert Dürr explicit AtsFontList( void );
64*e26449d3SHerbert Dürr virtual ~AtsFontList( void );
65*e26449d3SHerbert Dürr
66*e26449d3SHerbert Dürr virtual void AnnounceFonts( ImplDevFontList& ) const;
67*e26449d3SHerbert Dürr virtual ImplMacFontData* GetFontDataFromId( sal_IntPtr nFontId ) const;
68*e26449d3SHerbert Dürr
69*e26449d3SHerbert Dürr private:
70*e26449d3SHerbert Dürr typedef std::hash_map<sal_IntPtr,AtsFontData*> AtsFontContainer;
71*e26449d3SHerbert Dürr AtsFontContainer maFontContainer;
72*e26449d3SHerbert Dürr
73*e26449d3SHerbert Dürr void InitGlyphFallbacks( void );
74*e26449d3SHerbert Dürr ATSUFontFallbacks maFontFallbacks;
75*e26449d3SHerbert Dürr };
76*e26449d3SHerbert Dürr
77*e26449d3SHerbert Dürr // =======================================================================
78*e26449d3SHerbert Dürr
AtsFontData(const ImplDevFontAttributes & rDFA,ATSUFontID nFontId)79*e26449d3SHerbert Dürr AtsFontData::AtsFontData( const ImplDevFontAttributes& rDFA, ATSUFontID nFontId )
80*e26449d3SHerbert Dürr : ImplMacFontData( rDFA, (sal_IntPtr)nFontId )
81*e26449d3SHerbert Dürr {}
8251747b8eSHerbert Dürr
8351747b8eSHerbert Dürr // -----------------------------------------------------------------------
8451747b8eSHerbert Dürr
~AtsFontData(void)85*e26449d3SHerbert Dürr AtsFontData::~AtsFontData( void )
86*e26449d3SHerbert Dürr {}
87*e26449d3SHerbert Dürr
88*e26449d3SHerbert Dürr // -----------------------------------------------------------------------
89*e26449d3SHerbert Dürr
Clone(void) const90*e26449d3SHerbert Dürr ImplFontData* AtsFontData::Clone( void ) const
91*e26449d3SHerbert Dürr {
92*e26449d3SHerbert Dürr AtsFontData* pClone = new AtsFontData(*this);
93*e26449d3SHerbert Dürr return pClone;
94*e26449d3SHerbert Dürr }
95*e26449d3SHerbert Dürr
96*e26449d3SHerbert Dürr // -----------------------------------------------------------------------
97*e26449d3SHerbert Dürr
CreateMacTextStyle(const ImplFontSelectData & rFSD) const98*e26449d3SHerbert Dürr ImplMacTextStyle* AtsFontData::CreateMacTextStyle( const ImplFontSelectData& rFSD ) const
99*e26449d3SHerbert Dürr {
100*e26449d3SHerbert Dürr return new AtsTextStyle( rFSD );
101*e26449d3SHerbert Dürr }
102*e26449d3SHerbert Dürr
103*e26449d3SHerbert Dürr // -----------------------------------------------------------------------
104*e26449d3SHerbert Dürr
CreateFontInstance(ImplFontSelectData & rFSD) const105*e26449d3SHerbert Dürr ImplFontEntry* AtsFontData::CreateFontInstance( /*const*/ ImplFontSelectData& rFSD ) const
106*e26449d3SHerbert Dürr {
107*e26449d3SHerbert Dürr return new ImplFontEntry( rFSD );
108*e26449d3SHerbert Dürr }
109*e26449d3SHerbert Dürr
110*e26449d3SHerbert Dürr // -----------------------------------------------------------------------
111*e26449d3SHerbert Dürr
GetFontTable(const char pTagName[5],unsigned char * pResultBuf) const112*e26449d3SHerbert Dürr int AtsFontData::GetFontTable( const char pTagName[5], unsigned char* pResultBuf ) const
113*e26449d3SHerbert Dürr {
114*e26449d3SHerbert Dürr DBG_ASSERT( aTagName[4]=='\0', "AtsFontData::GetFontTable with invalid tagname!\n" );
115*e26449d3SHerbert Dürr
116*e26449d3SHerbert Dürr const FourCharCode pTagCode = (pTagName[0]<<24) + (pTagName[1]<<16) + (pTagName[2]<<8) + (pTagName[3]<<0);
117*e26449d3SHerbert Dürr
118*e26449d3SHerbert Dürr // get the byte size of the raw table
119*e26449d3SHerbert Dürr ATSFontRef rATSFont = FMGetATSFontRefFromFont( (ATSUFontID)mnFontId );
120*e26449d3SHerbert Dürr ByteCount nBufSize = 0;
121*e26449d3SHerbert Dürr OSStatus eStatus = ATSFontGetTable( rATSFont, pTagCode, 0, 0, NULL, &nBufSize );
122*e26449d3SHerbert Dürr if( eStatus != noErr )
123*e26449d3SHerbert Dürr return 0;
124*e26449d3SHerbert Dürr
125*e26449d3SHerbert Dürr // get the raw table data if requested
126*e26449d3SHerbert Dürr if( pResultBuf && (nBufSize > 0))
127*e26449d3SHerbert Dürr {
128*e26449d3SHerbert Dürr ByteCount nRawLength = 0;
129*e26449d3SHerbert Dürr eStatus = ATSFontGetTable( rATSFont, pTagCode, 0, nBufSize, (void*)pResultBuf, &nRawLength );
130*e26449d3SHerbert Dürr if( eStatus != noErr )
131*e26449d3SHerbert Dürr return 0;
132*e26449d3SHerbert Dürr DBG_ASSERT( (nBufSize==nRawLength), "AtsFontData::GetFontTable ByteCount mismatch!\n");
133*e26449d3SHerbert Dürr }
134*e26449d3SHerbert Dürr
135*e26449d3SHerbert Dürr return nBufSize;
136*e26449d3SHerbert Dürr }
137*e26449d3SHerbert Dürr
138*e26449d3SHerbert Dürr // =======================================================================
139*e26449d3SHerbert Dürr
AtsTextStyle(const ImplFontSelectData & rFSD)140*e26449d3SHerbert Dürr AtsTextStyle::AtsTextStyle( const ImplFontSelectData& rFSD )
141*e26449d3SHerbert Dürr : ImplMacTextStyle( rFSD )
142*e26449d3SHerbert Dürr {
143*e26449d3SHerbert Dürr // create the style object for ATSUI font attributes
144*e26449d3SHerbert Dürr ATSUCreateStyle( &maATSUStyle );
145*e26449d3SHerbert Dürr const ImplFontSelectData* const pReqFont = &rFSD;
146*e26449d3SHerbert Dürr
147*e26449d3SHerbert Dürr mpFontData = (AtsFontData*)rFSD.mpFontData;
148*e26449d3SHerbert Dürr
149*e26449d3SHerbert Dürr // limit the ATS font size to avoid Fixed16.16 overflows
150*e26449d3SHerbert Dürr double fScaledFontHeight = pReqFont->mfExactHeight;
151*e26449d3SHerbert Dürr static const float fMaxFontHeight = 144.0;
152*e26449d3SHerbert Dürr if( fScaledFontHeight > fMaxFontHeight )
153*e26449d3SHerbert Dürr {
154*e26449d3SHerbert Dürr mfFontScale = fScaledFontHeight / fMaxFontHeight;
155*e26449d3SHerbert Dürr fScaledFontHeight = fMaxFontHeight;
156*e26449d3SHerbert Dürr }
157*e26449d3SHerbert Dürr
158*e26449d3SHerbert Dürr // convert font rotation to radian
159*e26449d3SHerbert Dürr mfFontRotation = pReqFont->mnOrientation * (M_PI / 1800.0);
160*e26449d3SHerbert Dürr
161*e26449d3SHerbert Dürr // determine if font stretching is needed
162*e26449d3SHerbert Dürr if( (pReqFont->mnWidth != 0) && (pReqFont->mnWidth != pReqFont->mnHeight) )
163*e26449d3SHerbert Dürr {
164*e26449d3SHerbert Dürr mfFontStretch = (float)pReqFont->mnWidth / pReqFont->mnHeight;
165*e26449d3SHerbert Dürr // set text style to stretching matrix
166*e26449d3SHerbert Dürr CGAffineTransform aMatrix = CGAffineTransformMakeScale( mfFontStretch, 1.0F );
167*e26449d3SHerbert Dürr const ATSUAttributeTag aMatrixTag = kATSUFontMatrixTag;
168*e26449d3SHerbert Dürr const ATSUAttributeValuePtr aAttr = &aMatrix;
169*e26449d3SHerbert Dürr const ByteCount aMatrixBytes = sizeof(aMatrix);
170*e26449d3SHerbert Dürr /*OSStatus eStatus =*/ ATSUSetAttributes( maATSUStyle, 1, &aMatrixTag, &aMatrixBytes, &aAttr );
171*e26449d3SHerbert Dürr }
172*e26449d3SHerbert Dürr }
173*e26449d3SHerbert Dürr
174*e26449d3SHerbert Dürr // -----------------------------------------------------------------------
175*e26449d3SHerbert Dürr
~AtsTextStyle(void)176*e26449d3SHerbert Dürr AtsTextStyle::~AtsTextStyle( void )
177*e26449d3SHerbert Dürr {
178*e26449d3SHerbert Dürr ATSUDisposeStyle( maATSUStyle );
179*e26449d3SHerbert Dürr }
180*e26449d3SHerbert Dürr
181*e26449d3SHerbert Dürr // -----------------------------------------------------------------------
182*e26449d3SHerbert Dürr
GetFontMetric(float fDPIY,ImplFontMetricData & rMetric) const183*e26449d3SHerbert Dürr void AtsTextStyle::GetFontMetric( float fDPIY, ImplFontMetricData& rMetric ) const
184*e26449d3SHerbert Dürr {
185*e26449d3SHerbert Dürr // get the font metrics (in point units)
186*e26449d3SHerbert Dürr // of the font that has eventually been size-limited
187*e26449d3SHerbert Dürr
188*e26449d3SHerbert Dürr // get the matching ATSU font handle
189*e26449d3SHerbert Dürr ATSUFontID fontId;
190*e26449d3SHerbert Dürr OSStatus err = ::ATSUGetAttribute( maATSUStyle, kATSUFontTag, sizeof(ATSUFontID), &fontId, 0 );
191*e26449d3SHerbert Dürr DBG_ASSERT( (err==noErr), "AquaSalGraphics::GetFontMetric() : could not get font id\n");
192*e26449d3SHerbert Dürr
193*e26449d3SHerbert Dürr ATSFontMetrics aMetrics;
194*e26449d3SHerbert Dürr ATSFontRef rFont = FMGetATSFontRefFromFont( fontId );
195*e26449d3SHerbert Dürr err = ATSFontGetHorizontalMetrics ( rFont, kATSOptionFlagsDefault, &aMetrics );
196*e26449d3SHerbert Dürr DBG_ASSERT( (err==noErr), "AquaSalGraphics::GetFontMetric() : could not get font metrics\n");
197*e26449d3SHerbert Dürr if( err != noErr )
198*e26449d3SHerbert Dürr return;
199*e26449d3SHerbert Dürr
200*e26449d3SHerbert Dürr // all ATS fonts are scalable fonts
201*e26449d3SHerbert Dürr rMetric.mbScalableFont = true;
202*e26449d3SHerbert Dürr // TODO: check if any kerning is possible
203*e26449d3SHerbert Dürr rMetric.mbKernableFont = true;
204*e26449d3SHerbert Dürr
205*e26449d3SHerbert Dürr // convert into VCL font metrics (in unscaled pixel units)
206*e26449d3SHerbert Dürr
207*e26449d3SHerbert Dürr Fixed ptSize;
208*e26449d3SHerbert Dürr err = ATSUGetAttribute( maATSUStyle, kATSUSizeTag, sizeof(Fixed), &ptSize, 0);
209*e26449d3SHerbert Dürr DBG_ASSERT( (err==noErr), "AquaSalGraphics::GetFontMetric() : could not get font size\n");
210*e26449d3SHerbert Dürr const double fPointSize = Fix2X( ptSize );
211*e26449d3SHerbert Dürr
212*e26449d3SHerbert Dürr // convert quartz units to pixel units
213*e26449d3SHerbert Dürr // please see the comment in AquaSalGraphics::SetFont() for details
214*e26449d3SHerbert Dürr const double fPixelSize = (mfFontScale * fDPIY * fPointSize);
215*e26449d3SHerbert Dürr rMetric.mnAscent = static_cast<long>(+aMetrics.ascent * fPixelSize + 0.5);
216*e26449d3SHerbert Dürr rMetric.mnDescent = static_cast<long>(-aMetrics.descent * fPixelSize + 0.5);
217*e26449d3SHerbert Dürr const long nExtDescent = static_cast<long>((-aMetrics.descent + aMetrics.leading) * fPixelSize + 0.5);
218*e26449d3SHerbert Dürr rMetric.mnExtLeading = nExtDescent - rMetric.mnDescent;
219*e26449d3SHerbert Dürr rMetric.mnIntLeading = 0;
220*e26449d3SHerbert Dürr // since ImplFontMetricData::mnWidth is only used for stretching/squeezing fonts
221*e26449d3SHerbert Dürr // setting this width to the pixel height of the fontsize is good enough
222*e26449d3SHerbert Dürr // it also makes the calculation of the stretch factor simple
223*e26449d3SHerbert Dürr rMetric.mnWidth = static_cast<long>(mfFontStretch * fPixelSize + 0.5);
224*e26449d3SHerbert Dürr }
225*e26449d3SHerbert Dürr
226*e26449d3SHerbert Dürr // -----------------------------------------------------------------------
227*e26449d3SHerbert Dürr
SetTextColor(const RGBAColor & rColor)228*e26449d3SHerbert Dürr void AtsTextStyle::SetTextColor( const RGBAColor& rColor )
229*e26449d3SHerbert Dürr {
230*e26449d3SHerbert Dürr RGBColor aAtsColor;
231*e26449d3SHerbert Dürr aAtsColor.red = (unsigned short)( rColor.GetRed() * 65535.0 );
232*e26449d3SHerbert Dürr aAtsColor.green = (unsigned short)( rColor.GetGreen() * 65535.0 );
233*e26449d3SHerbert Dürr aAtsColor.blue = (unsigned short)( rColor.GetColor() * 65535.0 );
234*e26449d3SHerbert Dürr
235*e26449d3SHerbert Dürr ATSUAttributeTag aTag = kATSUColorTag;
236*e26449d3SHerbert Dürr ByteCount aValueSize = sizeof( aAtsColor );
237*e26449d3SHerbert Dürr ATSUAttributeValuePtr aValue = &aAtsColor;
238*e26449d3SHerbert Dürr
239*e26449d3SHerbert Dürr /*OSStatus err =*/ ATSUSetAttributes( maATSUStyle, 1, &aTag, &aValueSize, &aValue );
240*e26449d3SHerbert Dürr }
241*e26449d3SHerbert Dürr
242*e26449d3SHerbert Dürr // -----------------------------------------------------------------------
243*e26449d3SHerbert Dürr
GetGlyphBoundRect(sal_GlyphId aGlyphId,Rectangle & rRect) const244*e26449d3SHerbert Dürr bool AtsTextStyle::GetGlyphBoundRect( sal_GlyphId aGlyphId, Rectangle& rRect ) const
245*e26449d3SHerbert Dürr {
246*e26449d3SHerbert Dürr ATSUStyle rATSUStyle = maATSUStyle; // TODO: handle glyph fallback
247*e26449d3SHerbert Dürr ATSGlyphID aGlyphId = aGlyphId;
248*e26449d3SHerbert Dürr ATSGlyphScreenMetrics aGlyphMetrics;
249*e26449d3SHerbert Dürr const bool bNonAntialiasedText = false;
250*e26449d3SHerbert Dürr OSStatus eStatus = ATSUGlyphGetScreenMetrics( rATSUStyle,
251*e26449d3SHerbert Dürr 1, &aGlyphId, 0, FALSE, !bNonAntialiasedText, &aGlyphMetrics );
252*e26449d3SHerbert Dürr if( eStatus != noErr )
253*e26449d3SHerbert Dürr return false;
254*e26449d3SHerbert Dürr
255*e26449d3SHerbert Dürr const long nMinX = (long)(+aGlyphMetrics.topLeft.x * mfFontScale - 0.5);
256*e26449d3SHerbert Dürr const long nMaxX = (long)(aGlyphMetrics.width * mfFontScale + 0.5) + nMinX;
257*e26449d3SHerbert Dürr const long nMinY = (long)(-aGlyphMetrics.topLeft.y * mfFontScale - 0.5);
258*e26449d3SHerbert Dürr const long nMaxY = (long)(aGlyphMetrics.height * mfFontScale + 0.5) + nMinY;
259*e26449d3SHerbert Dürr rRect = Rectangle( nMinX, nMinY, nMaxX, nMaxY );
260*e26449d3SHerbert Dürr return true;
261*e26449d3SHerbert Dürr }
262*e26449d3SHerbert Dürr
263*e26449d3SHerbert Dürr // -----------------------------------------------------------------------
264*e26449d3SHerbert Dürr
265*e26449d3SHerbert Dürr // callbacks from ATSUGlyphGetCubicPaths() fore GetGlyphOutline()
266*e26449d3SHerbert Dürr struct GgoData { basegfx::B2DPolygon maPolygon; basegfx::B2DPolyPolygon* mpPolyPoly; };
267*e26449d3SHerbert Dürr
GgoLineToProc(const Float32Point * pPoint,void * pData)268*e26449d3SHerbert Dürr static OSStatus GgoLineToProc( const Float32Point* pPoint, void* pData )
269*e26449d3SHerbert Dürr {
270*e26449d3SHerbert Dürr basegfx::B2DPolygon& rPolygon = static_cast<GgoData*>(pData)->maPolygon;
271*e26449d3SHerbert Dürr const basegfx::B2DPoint aB2DPoint( pPoint->x, pPoint->y );
272*e26449d3SHerbert Dürr rPolygon.append( aB2DPoint );
273*e26449d3SHerbert Dürr return noErr;
274*e26449d3SHerbert Dürr }
275*e26449d3SHerbert Dürr
GgoCurveToProc(const Float32Point * pCP1,const Float32Point * pCP2,const Float32Point * pPoint,void * pData)276*e26449d3SHerbert Dürr static OSStatus GgoCurveToProc( const Float32Point* pCP1, const Float32Point* pCP2,
277*e26449d3SHerbert Dürr const Float32Point* pPoint, void* pData )
278*e26449d3SHerbert Dürr {
279*e26449d3SHerbert Dürr basegfx::B2DPolygon& rPolygon = static_cast<GgoData*>(pData)->maPolygon;
280*e26449d3SHerbert Dürr const sal_uInt32 nPointCount = rPolygon.count();
281*e26449d3SHerbert Dürr const basegfx::B2DPoint aB2DControlPoint1( pCP1->x, pCP1->y );
282*e26449d3SHerbert Dürr rPolygon.setNextControlPoint( nPointCount-1, aB2DControlPoint1 );
283*e26449d3SHerbert Dürr const basegfx::B2DPoint aB2DEndPoint( pPoint->x, pPoint->y );
284*e26449d3SHerbert Dürr rPolygon.append( aB2DEndPoint );
285*e26449d3SHerbert Dürr const basegfx::B2DPoint aB2DControlPoint2( pCP2->x, pCP2->y );
286*e26449d3SHerbert Dürr rPolygon.setPrevControlPoint( nPointCount, aB2DControlPoint2 );
287*e26449d3SHerbert Dürr return noErr;
288*e26449d3SHerbert Dürr }
289*e26449d3SHerbert Dürr
GgoClosePathProc(void * pData)290*e26449d3SHerbert Dürr static OSStatus GgoClosePathProc( void* pData )
291*e26449d3SHerbert Dürr {
292*e26449d3SHerbert Dürr GgoData* pGgoData = static_cast<GgoData*>(pData);
293*e26449d3SHerbert Dürr basegfx::B2DPolygon& rPolygon = pGgoData->maPolygon;
294*e26449d3SHerbert Dürr if( rPolygon.count() > 0 )
295*e26449d3SHerbert Dürr pGgoData->mpPolyPoly->append( rPolygon );
296*e26449d3SHerbert Dürr rPolygon.clear();
297*e26449d3SHerbert Dürr return noErr;
298*e26449d3SHerbert Dürr }
299*e26449d3SHerbert Dürr
GgoMoveToProc(const Float32Point * pPoint,void * pData)300*e26449d3SHerbert Dürr static OSStatus GgoMoveToProc( const Float32Point* pPoint, void* pData )
301*e26449d3SHerbert Dürr {
302*e26449d3SHerbert Dürr GgoClosePathProc( pData );
303*e26449d3SHerbert Dürr OSStatus eStatus = GgoLineToProc( pPoint, pData );
304*e26449d3SHerbert Dürr return eStatus;
305*e26449d3SHerbert Dürr }
306*e26449d3SHerbert Dürr
GetGlyphOutline(sal_GlyphId aGlyphId,basegfx::B2DPolyPolygon & rResult) const307*e26449d3SHerbert Dürr bool AtsTextStyle::GetGlyphOutline( sal_GlyphId aGlyphId, basegfx::B2DPolyPolygon& rResult ) const
308*e26449d3SHerbert Dürr {
309*e26449d3SHerbert Dürr GgoData aGgoData;
310*e26449d3SHerbert Dürr aGgoData.mpPolyPoly = &rResult;
311*e26449d3SHerbert Dürr rResult.clear();
312*e26449d3SHerbert Dürr
313*e26449d3SHerbert Dürr OSStatus eGgoStatus = noErr;
314*e26449d3SHerbert Dürr OSStatus eStatus = ATSUGlyphGetCubicPaths( maATSUStyle, aGlyphId,
315*e26449d3SHerbert Dürr GgoMoveToProc, GgoLineToProc, GgoCurveToProc, GgoClosePathProc,
316*e26449d3SHerbert Dürr &aGgoData, &eGgoStatus );
317*e26449d3SHerbert Dürr if( (eStatus != noErr) ) // TODO: why is (eGgoStatus!=noErr) when curves are involved?
318*e26449d3SHerbert Dürr return false;
319*e26449d3SHerbert Dürr
320*e26449d3SHerbert Dürr GgoClosePathProc( &aGgoData );
321*e26449d3SHerbert Dürr
322*e26449d3SHerbert Dürr // apply the font scale
323*e26449d3SHerbert Dürr if( mfFontScale != 1.0 ) {
324*e26449d3SHerbert Dürr basegfx::B2DHomMatrix aScale;
325*e26449d3SHerbert Dürr aScale.scale( +mfFontScale, +mfFontScale );
326*e26449d3SHerbert Dürr rResult.transform( aScale );
327*e26449d3SHerbert Dürr }
328*e26449d3SHerbert Dürr
329*e26449d3SHerbert Dürr return true;
330*e26449d3SHerbert Dürr }
331*e26449d3SHerbert Dürr
332*e26449d3SHerbert Dürr // =======================================================================
333*e26449d3SHerbert Dürr
GetDevFontAttributes(ATSUFontID nFontID,ImplDevFontAttributes & rDFA)33451747b8eSHerbert Dürr static bool GetDevFontAttributes( ATSUFontID nFontID, ImplDevFontAttributes& rDFA )
33551747b8eSHerbert Dürr {
33651747b8eSHerbert Dürr // all ATSU fonts are device fonts that can be directly rotated
33751747b8eSHerbert Dürr rDFA.mbOrientation = true;
33851747b8eSHerbert Dürr rDFA.mbDevice = true;
33951747b8eSHerbert Dürr rDFA.mnQuality = 0;
34051747b8eSHerbert Dürr
34151747b8eSHerbert Dürr // reset the attributes
34251747b8eSHerbert Dürr rDFA.meFamily = FAMILY_DONTKNOW;
34351747b8eSHerbert Dürr rDFA.mePitch = PITCH_VARIABLE;
34451747b8eSHerbert Dürr rDFA.meWidthType = WIDTH_NORMAL;
34551747b8eSHerbert Dürr rDFA.meWeight = WEIGHT_NORMAL;
34651747b8eSHerbert Dürr rDFA.meItalic = ITALIC_NONE;
34751747b8eSHerbert Dürr rDFA.mbSymbolFlag = false;
34851747b8eSHerbert Dürr
34951747b8eSHerbert Dürr // ignore bitmap fonts
35051747b8eSHerbert Dürr ATSFontRef rATSFontRef = FMGetATSFontRefFromFont( nFontID );
35151747b8eSHerbert Dürr ByteCount nHeadLen = 0;
35251747b8eSHerbert Dürr OSStatus rc = ATSFontGetTable( rATSFontRef, 0x68656164/*head*/, 0, 0, NULL, &nHeadLen );
35351747b8eSHerbert Dürr if( (rc != noErr) || (nHeadLen <= 0) )
35451747b8eSHerbert Dürr return false;
35551747b8eSHerbert Dürr
35651747b8eSHerbert Dürr // all scalable fonts on this platform are subsettable
35751747b8eSHerbert Dürr rDFA.mbSubsettable = true;
35851747b8eSHerbert Dürr rDFA.mbEmbeddable = false;
359*e26449d3SHerbert Dürr // TODO: these members are needed only for our X11 platform targets
360*e26449d3SHerbert Dürr rDFA.meAntiAlias = ANTIALIAS_DONTKNOW;
361*e26449d3SHerbert Dürr rDFA.meEmbeddedBitmap = EMBEDDEDBITMAP_DONTKNOW;
36251747b8eSHerbert Dürr
36351747b8eSHerbert Dürr // prepare iterating over all name strings of the font
36451747b8eSHerbert Dürr ItemCount nFontNameCount = 0;
36551747b8eSHerbert Dürr rc = ATSUCountFontNames( nFontID, &nFontNameCount );
36651747b8eSHerbert Dürr if( rc != noErr )
36751747b8eSHerbert Dürr return false;
36851747b8eSHerbert Dürr int nBestNameValue = 0;
36951747b8eSHerbert Dürr int nBestStyleValue = 0;
37051747b8eSHerbert Dürr FontLanguageCode eBestLangCode = 0;
37151747b8eSHerbert Dürr const FontLanguageCode eUILangCode = Application::GetSettings().GetUILanguage();
37251747b8eSHerbert Dürr typedef std::vector<char> NameBuffer;
37351747b8eSHerbert Dürr NameBuffer aNameBuffer( 256 );
37451747b8eSHerbert Dürr
37551747b8eSHerbert Dürr // iterate over all available name strings of the font
37651747b8eSHerbert Dürr for( ItemCount nNameIndex = 0; nNameIndex < nFontNameCount; ++nNameIndex )
37751747b8eSHerbert Dürr {
37851747b8eSHerbert Dürr ByteCount nNameLength = 0;
37951747b8eSHerbert Dürr
38051747b8eSHerbert Dürr FontNameCode eFontNameCode;
38151747b8eSHerbert Dürr FontPlatformCode eFontNamePlatform;
38251747b8eSHerbert Dürr FontScriptCode eFontNameScript;
38351747b8eSHerbert Dürr FontLanguageCode eFontNameLanguage;
38451747b8eSHerbert Dürr rc = ATSUGetIndFontName( nFontID, nNameIndex, 0, NULL,
38551747b8eSHerbert Dürr &nNameLength, &eFontNameCode, &eFontNamePlatform, &eFontNameScript, &eFontNameLanguage );
38651747b8eSHerbert Dürr if( rc != noErr )
38751747b8eSHerbert Dürr continue;
38851747b8eSHerbert Dürr
38951747b8eSHerbert Dürr // ignore non-interesting name entries
39051747b8eSHerbert Dürr if( (eFontNameCode != kFontFamilyName)
39151747b8eSHerbert Dürr && (eFontNameCode != kFontStyleName)
39251747b8eSHerbert Dürr && (eFontNameCode != kFontPostscriptName) )
39351747b8eSHerbert Dürr continue;
39451747b8eSHerbert Dürr
39551747b8eSHerbert Dürr // heuristic to find the most common font name
39651747b8eSHerbert Dürr // prefering default language names or even better the names matching to the UI language
39751747b8eSHerbert Dürr int nNameValue = (eFontNameLanguage==eUILangCode) ? 0 : ((eFontNameLanguage==0) ? -10 : -20);
39851747b8eSHerbert Dürr rtl_TextEncoding eEncoding = RTL_TEXTENCODING_UNICODE;
39951747b8eSHerbert Dürr const int nPlatformEncoding = ((int)eFontNamePlatform << 8) + (int)eFontNameScript;
40051747b8eSHerbert Dürr switch( nPlatformEncoding )
40151747b8eSHerbert Dürr {
40251747b8eSHerbert Dürr case 0x000: nNameValue += 23; break; // Unicode 1.0
40351747b8eSHerbert Dürr case 0x001: nNameValue += 24; break; // Unicode 1.1
40451747b8eSHerbert Dürr case 0x002: nNameValue += 25; break; // iso10646_1993
40551747b8eSHerbert Dürr case 0x003: nNameValue += 26; break; // UCS-2
40651747b8eSHerbert Dürr case 0x301: nNameValue += 27; break; // Win UCS-2
40751747b8eSHerbert Dürr case 0x004: // UCS-4
40851747b8eSHerbert Dürr case 0x30A: nNameValue += 0; // Win-UCS-4
40951747b8eSHerbert Dürr eEncoding = RTL_TEXTENCODING_UCS4;
41051747b8eSHerbert Dürr break;
41151747b8eSHerbert Dürr case 0x100: nNameValue += 21; // Mac Roman
41251747b8eSHerbert Dürr eEncoding = RTL_TEXTENCODING_APPLE_ROMAN;
41351747b8eSHerbert Dürr break;
41451747b8eSHerbert Dürr case 0x300: nNameValue = 0; // Win Symbol encoded name!
41551747b8eSHerbert Dürr rDFA.mbSymbolFlag = true; // (often seen for symbol fonts)
41651747b8eSHerbert Dürr break;
41751747b8eSHerbert Dürr default: nNameValue = 0; // ignore other encodings
41851747b8eSHerbert Dürr break;
41951747b8eSHerbert Dürr }
42051747b8eSHerbert Dürr
42151747b8eSHerbert Dürr // ignore name entries with no useful encoding
42251747b8eSHerbert Dürr if( nNameValue <= 0 )
42351747b8eSHerbert Dürr continue;
42451747b8eSHerbert Dürr if( nNameLength >= aNameBuffer.size() )
42551747b8eSHerbert Dürr continue;
42651747b8eSHerbert Dürr
42751747b8eSHerbert Dürr // get the encoded name
42851747b8eSHerbert Dürr aNameBuffer.reserve( nNameLength+1 ); // extra byte helps for debugging
42951747b8eSHerbert Dürr rc = ATSUGetIndFontName( nFontID, nNameIndex, nNameLength, &aNameBuffer[0],
43051747b8eSHerbert Dürr &nNameLength, &eFontNameCode, &eFontNamePlatform, &eFontNameScript, &eFontNameLanguage );
43151747b8eSHerbert Dürr if( rc != noErr )
43251747b8eSHerbert Dürr continue;
43351747b8eSHerbert Dürr
43451747b8eSHerbert Dürr // convert to unicode name
43551747b8eSHerbert Dürr UniString aUtf16Name;
43651747b8eSHerbert Dürr if( eEncoding == RTL_TEXTENCODING_UNICODE ) // we are just interested in UTF16 encoded names
43751747b8eSHerbert Dürr aUtf16Name = UniString( (const sal_Unicode*)&aNameBuffer[0], nNameLength/2 );
43851747b8eSHerbert Dürr else if( eEncoding == RTL_TEXTENCODING_UCS4 )
43951747b8eSHerbert Dürr aUtf16Name = UniString(); // TODO
44051747b8eSHerbert Dürr else // assume the non-unicode encoded names are byte encoded
44151747b8eSHerbert Dürr aUtf16Name = UniString( &aNameBuffer[0], nNameLength, eEncoding );
44251747b8eSHerbert Dürr
44351747b8eSHerbert Dürr // ignore empty strings
44451747b8eSHerbert Dürr if( aUtf16Name.Len() <= 0 )
44551747b8eSHerbert Dürr continue;
44651747b8eSHerbert Dürr
44751747b8eSHerbert Dürr // handle the name depending on its namecode
44851747b8eSHerbert Dürr switch( eFontNameCode )
44951747b8eSHerbert Dürr {
45051747b8eSHerbert Dürr case kFontFamilyName:
45151747b8eSHerbert Dürr // ignore font names starting with '.'
45251747b8eSHerbert Dürr if( aUtf16Name.GetChar(0) == '.' )
45351747b8eSHerbert Dürr nNameValue = 0;
45451747b8eSHerbert Dürr else if( rDFA.maName.Len() )
45551747b8eSHerbert Dürr {
45651747b8eSHerbert Dürr // even if a family name is not the one we are looking for
45751747b8eSHerbert Dürr // it is still useful as a font name alternative
45851747b8eSHerbert Dürr if( rDFA.maMapNames.Len() )
45951747b8eSHerbert Dürr rDFA.maMapNames += ';';
46051747b8eSHerbert Dürr rDFA.maMapNames += (nBestNameValue < nNameValue) ? rDFA.maName : aUtf16Name;
46151747b8eSHerbert Dürr }
46251747b8eSHerbert Dürr if( nBestNameValue < nNameValue )
46351747b8eSHerbert Dürr {
46451747b8eSHerbert Dürr // get the best family name
46551747b8eSHerbert Dürr nBestNameValue = nNameValue;
46651747b8eSHerbert Dürr eBestLangCode = eFontNameLanguage;
46751747b8eSHerbert Dürr rDFA.maName = aUtf16Name;
46851747b8eSHerbert Dürr }
46951747b8eSHerbert Dürr break;
47051747b8eSHerbert Dürr case kFontStyleName:
47151747b8eSHerbert Dürr // get a style name matching to the family name
47251747b8eSHerbert Dürr if( nBestStyleValue < nNameValue )
47351747b8eSHerbert Dürr {
47451747b8eSHerbert Dürr nBestStyleValue = nNameValue;
47551747b8eSHerbert Dürr rDFA.maStyleName = aUtf16Name;
47651747b8eSHerbert Dürr }
47751747b8eSHerbert Dürr break;
47851747b8eSHerbert Dürr case kFontPostscriptName:
47951747b8eSHerbert Dürr // use the postscript name to get some useful info
48051747b8eSHerbert Dürr UpdateAttributesFromPSName( aUtf16Name, rDFA );
48151747b8eSHerbert Dürr break;
48251747b8eSHerbert Dürr default:
48351747b8eSHerbert Dürr // TODO: use other name entries too?
48451747b8eSHerbert Dürr break;
48551747b8eSHerbert Dürr }
48651747b8eSHerbert Dürr }
48751747b8eSHerbert Dürr
48851747b8eSHerbert Dürr bool bRet = (rDFA.maName.Len() > 0);
48951747b8eSHerbert Dürr return bRet;
49051747b8eSHerbert Dürr }
49151747b8eSHerbert Dürr
49251747b8eSHerbert Dürr // =======================================================================
49351747b8eSHerbert Dürr
GetAtsFontList(void)494*e26449d3SHerbert Dürr SystemFontList* GetAtsFontList( void )
495*e26449d3SHerbert Dürr {
496*e26449d3SHerbert Dürr return new AtsFontList();
497*e26449d3SHerbert Dürr }
498*e26449d3SHerbert Dürr
499*e26449d3SHerbert Dürr // =======================================================================
500*e26449d3SHerbert Dürr
AtsFontList()501*e26449d3SHerbert Dürr AtsFontList::AtsFontList()
50251747b8eSHerbert Dürr {
50351747b8eSHerbert Dürr // count available system fonts
50451747b8eSHerbert Dürr ItemCount nATSUICompatibleFontsAvailable = 0;
50551747b8eSHerbert Dürr if( ATSUFontCount(&nATSUICompatibleFontsAvailable) != noErr )
50651747b8eSHerbert Dürr return;
50751747b8eSHerbert Dürr if( nATSUICompatibleFontsAvailable <= 0 )
50851747b8eSHerbert Dürr return;
50951747b8eSHerbert Dürr
51051747b8eSHerbert Dürr // enumerate available system fonts
51151747b8eSHerbert Dürr typedef std::vector<ATSUFontID> AtsFontIDVector;
51251747b8eSHerbert Dürr AtsFontIDVector aFontIDVector( nATSUICompatibleFontsAvailable );
51351747b8eSHerbert Dürr ItemCount nFontItemsCount = 0;
51451747b8eSHerbert Dürr if( ATSUGetFontIDs( &aFontIDVector[0], aFontIDVector.capacity(), &nFontItemsCount ) != noErr )
51551747b8eSHerbert Dürr return;
51651747b8eSHerbert Dürr
51751747b8eSHerbert Dürr BOOST_ASSERT(nATSUICompatibleFontsAvailable == nFontItemsCount && "Strange I would expect them to be equal");
51851747b8eSHerbert Dürr
51951747b8eSHerbert Dürr // prepare use of the available fonts
52051747b8eSHerbert Dürr AtsFontIDVector::const_iterator it = aFontIDVector.begin();
52151747b8eSHerbert Dürr for(; it != aFontIDVector.end(); ++it )
52251747b8eSHerbert Dürr {
52351747b8eSHerbert Dürr const ATSUFontID nFontID = *it;
52451747b8eSHerbert Dürr ImplDevFontAttributes aDevFontAttr;
52551747b8eSHerbert Dürr if( !GetDevFontAttributes( nFontID, aDevFontAttr ) )
52651747b8eSHerbert Dürr continue;
527*e26449d3SHerbert Dürr AtsFontData* pFontData = new AtsFontData( aDevFontAttr, nFontID );
52851747b8eSHerbert Dürr maFontContainer[ nFontID ] = pFontData;
52951747b8eSHerbert Dürr }
53051747b8eSHerbert Dürr
53151747b8eSHerbert Dürr InitGlyphFallbacks();
53251747b8eSHerbert Dürr }
53351747b8eSHerbert Dürr
53451747b8eSHerbert Dürr // -----------------------------------------------------------------------
53551747b8eSHerbert Dürr
~AtsFontList()536*e26449d3SHerbert Dürr AtsFontList::~AtsFontList()
53751747b8eSHerbert Dürr {
538*e26449d3SHerbert Dürr AtsFontContainer::const_iterator it = maFontContainer.begin();
53951747b8eSHerbert Dürr for(; it != maFontContainer.end(); ++it )
54051747b8eSHerbert Dürr delete (*it).second;
54151747b8eSHerbert Dürr maFontContainer.clear();
54251747b8eSHerbert Dürr
54351747b8eSHerbert Dürr ATSUDisposeFontFallbacks( maFontFallbacks );
54451747b8eSHerbert Dürr }
54551747b8eSHerbert Dürr
54651747b8eSHerbert Dürr // -----------------------------------------------------------------------
54751747b8eSHerbert Dürr
AnnounceFonts(ImplDevFontList & rFontList) const548*e26449d3SHerbert Dürr void AtsFontList::AnnounceFonts( ImplDevFontList& rFontList ) const
54951747b8eSHerbert Dürr {
550*e26449d3SHerbert Dürr AtsFontContainer::const_iterator it = maFontContainer.begin();
55151747b8eSHerbert Dürr for(; it != maFontContainer.end(); ++it )
55251747b8eSHerbert Dürr rFontList.Add( (*it).second->Clone() );
55351747b8eSHerbert Dürr }
55451747b8eSHerbert Dürr
55551747b8eSHerbert Dürr // -----------------------------------------------------------------------
55651747b8eSHerbert Dürr
GetFontDataFromId(sal_IntPtr nFontId) const557*e26449d3SHerbert Dürr ImplMacFontData* AtsFontList::GetFontDataFromId( sal_IntPtr nFontId ) const
558*e26449d3SHerbert Dürr {
559*e26449d3SHerbert Dürr AtsFontContainer::const_iterator it = maFontContainer.find( nFontId );
560*e26449d3SHerbert Dürr if( it == maFontContainer.end() )
561*e26449d3SHerbert Dürr return NULL;
562*e26449d3SHerbert Dürr return (*it).second;
563*e26449d3SHerbert Dürr }
564*e26449d3SHerbert Dürr
565*e26449d3SHerbert Dürr // -----------------------------------------------------------------------
566*e26449d3SHerbert Dürr
56751747b8eSHerbert Dürr // not all fonts are suitable for glyph fallback => sort them
56851747b8eSHerbert Dürr struct GfbCompare{ bool operator()(const ImplMacFontData*, const ImplMacFontData*); };
56951747b8eSHerbert Dürr
operator ()(const ImplMacFontData * pA,const ImplMacFontData * pB)57051747b8eSHerbert Dürr inline bool GfbCompare::operator()( const ImplMacFontData* pA, const ImplMacFontData* pB )
57151747b8eSHerbert Dürr {
57251747b8eSHerbert Dürr // use symbol fonts only as last resort
57351747b8eSHerbert Dürr bool bPreferA = !pA->IsSymbolFont();
57451747b8eSHerbert Dürr bool bPreferB = !pB->IsSymbolFont();
57551747b8eSHerbert Dürr if( bPreferA != bPreferB )
57651747b8eSHerbert Dürr return bPreferA;
57751747b8eSHerbert Dürr // prefer scalable fonts
57851747b8eSHerbert Dürr bPreferA = pA->IsScalable();
57951747b8eSHerbert Dürr bPreferB = pB->IsScalable();
58051747b8eSHerbert Dürr if( bPreferA != bPreferB )
58151747b8eSHerbert Dürr return bPreferA;
58251747b8eSHerbert Dürr // prefer non-slanted fonts
58351747b8eSHerbert Dürr bPreferA = (pA->GetSlant() == ITALIC_NONE);
58451747b8eSHerbert Dürr bPreferB = (pB->GetSlant() == ITALIC_NONE);
58551747b8eSHerbert Dürr if( bPreferA != bPreferB )
58651747b8eSHerbert Dürr return bPreferA;
58751747b8eSHerbert Dürr // prefer normal weight fonts
58851747b8eSHerbert Dürr bPreferA = (pA->GetWeight() == WEIGHT_NORMAL);
58951747b8eSHerbert Dürr bPreferB = (pB->GetWeight() == WEIGHT_NORMAL);
59051747b8eSHerbert Dürr if( bPreferA != bPreferB )
59151747b8eSHerbert Dürr return bPreferA;
59251747b8eSHerbert Dürr // prefer normal width fonts
59351747b8eSHerbert Dürr bPreferA = (pA->GetWidthType() == WIDTH_NORMAL);
59451747b8eSHerbert Dürr bPreferB = (pB->GetWidthType() == WIDTH_NORMAL);
59551747b8eSHerbert Dürr if( bPreferA != bPreferB )
59651747b8eSHerbert Dürr return bPreferA;
59751747b8eSHerbert Dürr return false;
59851747b8eSHerbert Dürr }
59951747b8eSHerbert Dürr
600*e26449d3SHerbert Dürr // -----------------------------------------------------------------------
601*e26449d3SHerbert Dürr
InitGlyphFallbacks()602*e26449d3SHerbert Dürr void AtsFontList::InitGlyphFallbacks()
60351747b8eSHerbert Dürr {
60451747b8eSHerbert Dürr // sort fonts for "glyph fallback"
60551747b8eSHerbert Dürr typedef std::multiset<const ImplMacFontData*,GfbCompare> FallbackSet;
60651747b8eSHerbert Dürr FallbackSet aFallbackSet;
607*e26449d3SHerbert Dürr AtsFontContainer::const_iterator it = maFontContainer.begin();
60851747b8eSHerbert Dürr for(; it != maFontContainer.end(); ++it )
60951747b8eSHerbert Dürr {
61051747b8eSHerbert Dürr const ImplMacFontData* pIFD = (*it).second;
61151747b8eSHerbert Dürr // TODO: subsettable/embeddable glyph fallback only for PDF export?
61251747b8eSHerbert Dürr if( pIFD->IsSubsettable() || pIFD->IsEmbeddable() )
61351747b8eSHerbert Dürr aFallbackSet.insert( pIFD );
61451747b8eSHerbert Dürr }
61551747b8eSHerbert Dürr
61651747b8eSHerbert Dürr // tell ATSU about font preferences for "glyph fallback"
61751747b8eSHerbert Dürr typedef std::vector<ATSUFontID> AtsFontIDVector;
61851747b8eSHerbert Dürr AtsFontIDVector aFallbackVector;
61951747b8eSHerbert Dürr aFallbackVector.reserve( maFontContainer.size() );
62051747b8eSHerbert Dürr FallbackSet::const_iterator itFData = aFallbackSet.begin();
62151747b8eSHerbert Dürr for(; itFData != aFallbackSet.end(); ++itFData )
62251747b8eSHerbert Dürr {
62351747b8eSHerbert Dürr const ImplMacFontData* pFontData = (*itFData);
62451747b8eSHerbert Dürr ATSUFontID nFontID = (ATSUFontID)pFontData->GetFontId();
62551747b8eSHerbert Dürr aFallbackVector.push_back( nFontID );
62651747b8eSHerbert Dürr }
62751747b8eSHerbert Dürr
62851747b8eSHerbert Dürr ATSUCreateFontFallbacks( &maFontFallbacks );
62951747b8eSHerbert Dürr ATSUSetObjFontFallbacks( maFontFallbacks,
63051747b8eSHerbert Dürr aFallbackVector.size(), &aFallbackVector[0], kATSUSequentialFallbacksPreferred );
63151747b8eSHerbert Dürr }
63251747b8eSHerbert Dürr
633*e26449d3SHerbert Dürr // =======================================================================
63451747b8eSHerbert Dürr
635