[Libreoffice-commits] core.git: config_host.mk.in configure.ac include/sal include/vcl vcl/aqua vcl/inc vcl/Library_vcl.mk

Tor Lillqvist tml at collabora.com
Wed Dec 4 04:35:19 PST 2013


 config_host.mk.in                                    |    1 
 configure.ac                                         |   21 
 include/sal/log-areas.dox                            |    1 
 include/vcl/sysdata.hxx                              |    8 
 vcl/Library_vcl.mk                                   |   15 
 vcl/aqua/source/a11y/aqua11ytextattributeswrapper.mm |    2 
 vcl/aqua/source/gdi/atsui/salatslayout.cxx           | 1230 -------------------
 vcl/aqua/source/gdi/atsui/salatsuifontutils.cxx      |  486 -------
 vcl/aqua/source/gdi/atsui/salgdi.cxx                 | 1073 ----------------
 vcl/aqua/source/gdi/salgdicommon.cxx                 |    2 
 vcl/aqua/source/gdi/salgdiutils.cxx                  |    2 
 vcl/aqua/source/gdi/salnativewidgets.cxx             |    2 
 vcl/aqua/source/gdi/salprn.cxx                       |    2 
 vcl/aqua/source/gdi/salvd.cxx                        |    2 
 vcl/aqua/source/window/salframe.cxx                  |    2 
 vcl/aqua/source/window/salframeview.mm               |    2 
 vcl/inc/aqua/atsui/salatsuifontutils.hxx             |   56 
 vcl/inc/aqua/atsui/salgdi.h                          |  363 -----
 vcl/inc/aqua/salgdi.h                                |   17 
 vcl/inc/aqua/salvd.h                                 |    2 
 vcl/inc/quartz/salbmp.h                              |    2 
 21 files changed, 10 insertions(+), 3281 deletions(-)

New commits:
commit 83e835156bc32bb904552465354b5b477a66d503
Author: Tor Lillqvist <tml at collabora.com>
Date:   Wed Dec 4 12:06:07 2013 +0200

    Bin ATSUI code
    
    TDF has been shipping a CoreText-using LO since 4.1 and the sky hasn't
    fallen. Getting rid of the ATSUI code will make other needed
    refactoring easier.
    
    Change-Id: I494096c3988ea26fa2b336621857d32b64b040f0

diff --git a/config_host.mk.in b/config_host.mk.in
index e517785..ba194a4 100644
--- a/config_host.mk.in
+++ b/config_host.mk.in
@@ -105,7 +105,6 @@ export EBOOK_CFLAGS=$(gb_SPACE)@EBOOK_CFLAGS@
 export EBOOK_LIBS=$(gb_SPACE)@EBOOK_LIBS@
 export ENABLE_AVAHI=@ENABLE_AVAHI@
 export ENABLE_CAIRO_CANVAS=@ENABLE_CAIRO_CANVAS@
-export ENABLE_CORETEXT=@ENABLE_CORETEXT@
 export ENABLE_CRASHDUMP=@ENABLE_CRASHDUMP@
 export ENABLE_CUPS=@ENABLE_CUPS@
 export ENABLE_DBGUTIL=@ENABLE_DBGUTIL@
diff --git a/configure.ac b/configure.ac
index 3b9abe9..138fd8c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1272,12 +1272,6 @@ AC_ARG_ENABLE(firebird-sdbc,
         [Disable the build of the Firebird-SDBC driver if it doesn't compile for you.]),
 ,enable_firebird_sdbc=yes)
 
-AC_ARG_ENABLE(coretext,
-    AS_HELP_STRING([--disable-coretext],
-        [Don't use CoreText on Mac (but the obsolete ATSU instead).
-         In a 64-bit LibreOffice CoreText is by necessity always used.]),
-)
-
 AC_ARG_ENABLE(winegcc,
     AS_HELP_STRING([--enable-winegcc],
         [Enable use of winegcc during the build, in order to create msi* tools
@@ -11348,21 +11342,6 @@ else
 fi
 AC_SUBST(WITH_HELPPACK_INTEGRATION)
 
-dnl ===================================================================
-dnl Test whether to use CoreText framework
-dnl ===================================================================
-ENABLE_CORETEXT=
-if test "$_os" = "Darwin"; then
-    AC_MSG_CHECKING([whether to use CoreText framework])
-    if test "$enable_coretext" != no -o "$BITNESS_OVERRIDE" = 64; then
-        AC_MSG_RESULT([yes])
-        ENABLE_CORETEXT=TRUE
-    else
-        AC_MSG_RESULT([no])
-    fi
-fi
-AC_SUBST(ENABLE_CORETEXT)
-
 ###############################################################################
 # Extensions checking
 ###############################################################################
diff --git a/include/sal/log-areas.dox b/include/sal/log-areas.dox
index 9845f56..3463a05 100644
--- a/include/sal/log-areas.dox
+++ b/include/sal/log-areas.dox
@@ -332,7 +332,6 @@ certain functionality.
 @li @c vcl
 @li @c vcl.a11y
 @li @c vcl.app
- at li @c vcl.atsui - ATSUI (obsolete) -using code for Mac OS X
 @li @c vcl.control
 @li @c vcl.coretext - CoreText-using code for Mac OS X and iOS
 @li @c vcl.emf - EMF/EMF+ processing
diff --git a/include/vcl/sysdata.hxx b/include/vcl/sysdata.hxx
index 78d756b..58f3830 100644
--- a/include/vcl/sysdata.hxx
+++ b/include/vcl/sysdata.hxx
@@ -27,9 +27,7 @@
 // predeclare the native classes to avoid header/include problems
 typedef struct CGContext *CGContextRef;
 typedef struct CGLayer   *CGLayerRef;
-#ifdef ENABLE_CORETEXT
 typedef const struct __CTFont * CTFontRef;
-#endif
 #ifdef __OBJC__
 @class NSView;
 #else
@@ -214,9 +212,6 @@ struct SystemFontData
 #if defined( WNT )
     HFONT           hFont;          // native font object
 #elif defined( MACOSX )
-#ifndef ENABLE_CORETEXT
-    void*           aATSUFontID;    // native font object
-#endif
 #elif defined( UNX )
     void*           nFontId;        // native font id
     int             nFontFlags;     // native font flags
@@ -231,9 +226,6 @@ struct SystemFontData
 #if defined( WNT )
         , hFont( 0 )
 #elif defined( MACOSX )
-#ifndef ENABLE_CORETEXT
-        , aATSUFontID( NULL )
-#endif
 #elif defined( UNX )
         , nFontId( NULL )
         , nFontFlags( 0 )
diff --git a/vcl/Library_vcl.mk b/vcl/Library_vcl.mk
index 38cf55a..fbeeaf0 100644
--- a/vcl/Library_vcl.mk
+++ b/vcl/Library_vcl.mk
@@ -357,12 +357,6 @@ $(eval $(call gb_Library_add_defs,vcl,\
 	-DMACOSX_BUNDLE_IDENTIFIER=\"$(MACOSX_BUNDLE_IDENTIFIER)\" \
 ))
 
-ifeq ($(ENABLE_CORETEXT),TRUE)
-
-$(eval $(call gb_Library_add_defs,vcl,\
-    -DENABLE_CORETEXT \
-))
-
 $(eval $(call gb_Library_add_exception_objects,vcl,\
     $(vcl_coretext_code) \
 ))
@@ -371,15 +365,6 @@ $(eval $(call gb_Library_use_system_darwin_frameworks,vcl,\
 	ApplicationServices \
 ))
 
-else # ATSUI
-
-$(eval $(call gb_Library_add_exception_objects,vcl,\
-    vcl/aqua/source/gdi/atsui/salatslayout \
-    vcl/aqua/source/gdi/atsui/salatsuifontutils \
-    vcl/aqua/source/gdi/atsui/salgdi \
-))
-endif
-
 $(eval $(call gb_Library_add_objcxxobjects,vcl,\
     vcl/aqua/source/a11y/aqua11yactionwrapper \
     vcl/aqua/source/a11y/aqua11ycomponentwrapper \
diff --git a/vcl/aqua/source/a11y/aqua11ytextattributeswrapper.mm b/vcl/aqua/source/a11y/aqua11ytextattributeswrapper.mm
index 090df5e..0eb8673 100644
--- a/vcl/aqua/source/a11y/aqua11ytextattributeswrapper.mm
+++ b/vcl/aqua/source/a11y/aqua11ytextattributeswrapper.mm
@@ -20,7 +20,7 @@
 
 #include "aqua/salinst.h"
 #include "quartz/utils.h"
-#include "aqua/salgdi.h"
+#include "coretext/salgdi2.h"
 
 #include "aqua11ytextattributeswrapper.h"
 
diff --git a/vcl/aqua/source/gdi/atsui/salatslayout.cxx b/vcl/aqua/source/gdi/atsui/salatslayout.cxx
deleted file mode 100644
index 59826e9..0000000
--- a/vcl/aqua/source/gdi/atsui/salatslayout.cxx
+++ /dev/null
@@ -1,1230 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- *   Licensed to the Apache Software Foundation (ASF) under one or more
- *   contributor license agreements. See the NOTICE file distributed
- *   with this work for additional information regarding copyright
- *   ownership. The ASF licenses this file to you under the Apache
- *   License, Version 2.0 (the "License"); you may not use this file
- *   except in compliance with the License. You may obtain a copy of
- *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#include "sal/config.h"
-
-#include "tools/debug.hxx"
-
-#include "aqua/saldata.hxx"
-#include "aqua/atsui/salgdi.h"
-#include "aqua/atsui/salatsuifontutils.hxx"
-
-#include "sallayout.hxx"
-#include "salgdi.hxx"
-
-#include <math.h>
-
-// ATSUI is deprecated in 10.6 (or already 10.5?)
-#if HAVE_GCC_PRAGMA_DIAGNOSTIC_MODIFY
-#pragma GCC diagnostic warning "-Wdeprecated-declarations"
-#endif
-
-// =======================================================================
-
-class ATSLayout : public SalLayout
-{
-public:
-                    ATSLayout( ATSUStyle&, float fFontScale );
-    virtual         ~ATSLayout();
-
-    virtual bool    LayoutText( ImplLayoutArgs& );
-    virtual void    AdjustLayout( ImplLayoutArgs& );
-    virtual void    DrawText( SalGraphics& ) const;
-
-    virtual int     GetNextGlyphs( int nLen, sal_GlyphId* pGlyphs, Point& rPos, int&,
-                        sal_Int32* pGlyphAdvances, int* pCharIndexes,
-                        const PhysicalFontFace** pFallbackFonts = NULL) const;
-
-    virtual long    GetTextWidth() const;
-    virtual long    FillDXArray( sal_Int32* pDXArray ) const;
-    virtual sal_Int32 GetTextBreak(long nMaxWidth, long nCharExtra, int nFactor) const SAL_OVERRIDE;
-    virtual void    GetCaretPositions( int nArraySize, sal_Int32* pCaretXArray ) const;
-    virtual bool    GetBoundRect( SalGraphics&, Rectangle& ) const;
-
-    virtual void    InitFont() const;
-    virtual void    MoveGlyph( int nStart, long nNewXPos );
-    virtual void    DropGlyph( int nStart );
-    virtual void    Simplify( bool bIsBase );
-
-private:
-    ATSUStyle&          mrATSUStyle;
-    ATSUTextLayout      maATSULayout;
-    int                 mnCharCount;        // ==mnEndCharPos-mnMinCharPos
-    // to prevent ATS overflowing the Fixed16.16 values
-    // ATS font requests get size limited by downscaling huge fonts
-    // in these cases the font scale becomes something bigger than 1.0
-    float               mfFontScale;
-
-private:
-    bool    InitGIA( ImplLayoutArgs* pArgs = NULL ) const;
-    bool    GetIdealX() const;
-    bool    GetDeltaY() const;
-    void    InvalidateMeasurements();
-
-    int Fixed2Vcl( Fixed ) const;       // convert ATSU-Fixed units to VCL units
-    int AtsuPix2Vcl( int ) const;       // convert ATSU-Pixel units to VCL units
-    Fixed   Vcl2Fixed( int ) const;     // convert VCL units to ATSU-Fixed units
-
-    // cached details about the resulting layout
-    // mutable members since these details are all lazy initialized
-    mutable int         mnGlyphCount;           // glyph count
-    mutable Fixed       mnCachedWidth;          // cached value of resulting typographical width
-    int                 mnTrailingSpaceWidth;   // in Pixels
-
-    mutable ATSGlyphRef*    mpGlyphIds;         // ATSU glyph ids
-    mutable Fixed*          mpCharWidths;       // map relative charpos to charwidth
-    mutable int*            mpChars2Glyphs;     // map relative charpos to absolute glyphpos
-    mutable int*            mpGlyphs2Chars;     // map absolute glyphpos to absolute charpos
-    mutable bool*           mpGlyphRTLFlags;    // BiDi status for glyphs: true if RTL
-    mutable Fixed*          mpGlyphAdvances;    // contains glyph widths for the justified layout
-    mutable Fixed*          mpGlyphOrigAdvs;    // contains glyph widths for the unjustified layout
-    mutable Fixed*          mpDeltaY;           // vertical offset from the baseline
-
-    struct SubPortion { int mnMinCharPos, mnEndCharPos; Fixed mnXOffset; };
-    typedef std::vector<SubPortion> SubPortionVector;
-    mutable SubPortionVector    maSubPortions;      // Writer&ATSUI layouts can differ quite a bit...
-
-    // storing details about fonts used in glyph-fallback for this layout
-    mutable class FallbackInfo* mpFallbackInfo;
-
-    // x-offset relative to layout origin
-    // currently only used in RTL-layouts
-    mutable Fixed           mnBaseAdv;
-};
-
-class FallbackInfo
-{
-public:
-        FallbackInfo() : mnMaxLevel(0) {}
-    int AddFallback( ATSUFontID );
-    const PhysicalFontFace* GetFallbackFontData( int nLevel ) const;
-
-private:
-    const ImplMacFontData* maFontData[ MAX_FALLBACK ];
-    ATSUFontID             maATSUFontId[ MAX_FALLBACK ];
-    int                    mnMaxLevel;
-};
-
-// =======================================================================
-
-ATSLayout::ATSLayout( ATSUStyle& rATSUStyle, float fFontScale )
-:   mrATSUStyle( rATSUStyle ),
-    maATSULayout( NULL ),
-    mnCharCount( 0 ),
-    mfFontScale( fFontScale ),
-    mnGlyphCount( -1 ),
-    mnCachedWidth( 0 ),
-    mnTrailingSpaceWidth( 0 ),
-    mpGlyphIds( NULL ),
-    mpCharWidths( NULL ),
-    mpChars2Glyphs( NULL ),
-    mpGlyphs2Chars( NULL ),
-    mpGlyphRTLFlags( NULL ),
-    mpGlyphAdvances( NULL ),
-    mpGlyphOrigAdvs( NULL ),
-    mpDeltaY( NULL ),
-    mpFallbackInfo( NULL ),
-    mnBaseAdv( 0 )
-{
-    SAL_INFO("vcl.atsui.layout", "ATSLayout(): FontScale=" << mfFontScale << " " << this);
-}
-
-// -----------------------------------------------------------------------
-
-ATSLayout::~ATSLayout()
-{
-    SAL_INFO("vcl.atsui.layout", "~ATSLayout(" << this << ")" <<
-             (maATSULayout == NULL ? " LayoutText() (or AdjustLayout()) never got called!" : "") <<
-             (mnGlyphCount < 0 ? " InitGIA() never got called!" : "" ) );
-
-    if( mpDeltaY )
-        ATSUDirectReleaseLayoutDataArrayPtr( NULL,
-            kATSUDirectDataBaselineDeltaFixedArray, (void**)&mpDeltaY );
-
-    if( maATSULayout )
-        ATSUDisposeTextLayout( maATSULayout );
-
-    delete[] mpGlyphRTLFlags;
-    delete[] mpGlyphs2Chars;
-    delete[] mpChars2Glyphs;
-    if( mpCharWidths != mpGlyphAdvances )
-        delete[] mpCharWidths;
-    delete[] mpGlyphIds;
-    delete[] mpGlyphOrigAdvs;
-    delete[] mpGlyphAdvances;
-
-    delete mpFallbackInfo;
-}
-
-// -----------------------------------------------------------------------
-
-inline int ATSLayout::Fixed2Vcl( Fixed nFixed ) const
-{
-    float fFloat = mfFontScale * FixedToFloat( nFixed );
-    return static_cast<int>(fFloat + 0.5);
-}
-
-// -----------------------------------------------------------------------
-
-inline int ATSLayout::AtsuPix2Vcl( int nAtsuPixel) const
-{
-    float fVclPixel = mfFontScale * nAtsuPixel;
-    fVclPixel += (fVclPixel>=0) ? +0.5 : -0.5;  // prepare rounding to int
-    int nVclPixel = static_cast<int>( fVclPixel);
-    return nVclPixel;
-}
-
-// -----------------------------------------------------------------------
-
-inline Fixed ATSLayout::Vcl2Fixed( int nPixel ) const
-{
-    return FloatToFixed( nPixel / mfFontScale );
-}
-
-// -----------------------------------------------------------------------
-/**
- * ATSLayout::LayoutText : Manage text layouting
- *
- * @param rArgs: contains array of char to be layouted, starting and ending position of the text to layout
- *
- * Typographic layout of text by using the style maATSUStyle
- *
- * @return : true if everything is ok
-**/
-bool ATSLayout::LayoutText( ImplLayoutArgs& rArgs )
-{
-    SAL_INFO("vcl.atsui.layout", "LayoutText(" << this << "): " <<
-             rArgs.mnLength << ":" << rArgs.mnMinCharPos << "--" << rArgs.mnEndCharPos);
-
-    if( maATSULayout )
-        ATSUDisposeTextLayout( maATSULayout );
-
-    maATSULayout = NULL;
-
-    // Layout text
-    // set up our locals, verify parameters...
-    DBG_ASSERT( (rArgs.mpStr!=NULL), "ATSLayout::LayoutText() with rArgs.mpStr==NULL !!!");
-    DBG_ASSERT( (mrATSUStyle!=NULL), "ATSLayout::LayoutText() with ATSUStyle==NULL !!!");
-
-    SalLayout::AdjustLayout( rArgs );
-    mnCharCount = mnEndCharPos - mnMinCharPos;
-
-    // Workaround a bug in ATSUI with empty string
-    if( mnCharCount<=0 )
-        return false;
-
-#if (OSL_DEBUG_LEVEL > 3)
-    Fixed fFontSize = 0;
-    ByteCount nDummy;
-    ATSUGetAttribute( mrATSUStyle, kATSUSizeTag, sizeof(fFontSize), &fFontSize, &nDummy);
-    OUString aUniName( &rArgs.mpStr[rArgs.mnMinCharPos], mnCharCount );
-    OString aCName(OUStringToOString(aUniName, RTL_TEXTENCODING_UTF8));
-    fprintf( stderr, "ATSLayout( \"%s\" %d..%d of %d) with h=%4.1f\n",
-        aCName.getStr(),rArgs.mnMinCharPos,rArgs.mnEndCharPos,rArgs.mnLength,Fix2X(fFontSize) );
-#endif
-
-    // create the ATSUI layout
-    UniCharCount nRunLengths[1] = { static_cast<UniCharCount>(mnCharCount) };
-    const int nRunCount = sizeof(nRunLengths)/sizeof(*nRunLengths);
-    OSStatus eStatus = ATSUCreateTextLayoutWithTextPtr( rArgs.mpStr,
-        rArgs.mnMinCharPos, mnCharCount, rArgs.mnLength,
-        nRunCount, &nRunLengths[0], &mrATSUStyle,
-        &maATSULayout);
-
-    DBG_ASSERT( (eStatus==noErr), "ATSUCreateTextLayoutWithTextPtr failed\n");
-    if( eStatus != noErr )
-        return false;
-
-    // prepare setting of layout controls
-    static const int nMaxTagCount = 1;
-    ATSUAttributeTag aTagAttrs[ nMaxTagCount ];
-    ByteCount aTagSizes[ nMaxTagCount ];
-    ATSUAttributeValuePtr aTagValues[ nMaxTagCount ];
-
-    // prepare control of "glyph fallback"
-    const SalData* pSalData = GetSalData();
-    ATSUFontFallbacks aFontFallbacks = pSalData->mpFontList->maFontFallbacks;
-    aTagAttrs[0]  = kATSULineFontFallbacksTag;
-    aTagSizes[0]  = sizeof( ATSUFontFallbacks );
-    aTagValues[0] = &aFontFallbacks;
-
-    // set paragraph layout controls
-    ATSUSetLayoutControls( maATSULayout, 1, aTagAttrs, aTagSizes, aTagValues );
-
-    // enable "glyph fallback"
-    ATSUSetTransientFontMatching( maATSULayout, true );
-
-    // control run-specific layout controls
-    if( (rArgs.mnFlags & SAL_LAYOUT_BIDI_STRONG) != 0 )
-    {
-        // control BiDi defaults
-        BOOL nLineDirTag = kATSULeftToRightBaseDirection;
-        if( (rArgs.mnFlags & SAL_LAYOUT_BIDI_RTL) != 0 )
-            nLineDirTag = kATSURightToLeftBaseDirection;
-        aTagAttrs[0] = kATSULineDirectionTag;
-        aTagSizes[0] = sizeof( nLineDirTag );
-        aTagValues[0] = &nLineDirTag;
-        // set run-specific layout controls
-        ATSUSetLayoutControls( maATSULayout, 1, aTagAttrs, aTagSizes, aTagValues );
-    }
-
-    return true;
-}
-
-// -----------------------------------------------------------------------
-/**
- * ATSLayout::AdjustLayout : Adjust layout style
- *
- * @param rArgs: contains attributes relevant to do a text specific layout
- *
- * Adjust text layout by moving glyphs to match the requested logical widths
- *
- * @return : none
-**/
-void ATSLayout::AdjustLayout( ImplLayoutArgs& rArgs )
-{
-    SAL_INFO("vcl.atsui.layout", "AdjustLayout(" << this << ",rArgs=" << rArgs << ")" );
-    int nOrigWidth = GetTextWidth();
-    int nPixelWidth = rArgs.mnLayoutWidth;
-    if( !nPixelWidth && rArgs.mpDXArray ) {
-        // for now we are only interested in the layout width
-        // TODO: use all mpDXArray elements for layouting
-        nPixelWidth = rArgs.mpDXArray[ mnCharCount - 1 ];
-
-        // workaround for ATSUI not using trailing spaces for justification
-        int i = mnCharCount;
-        while( (--i >= 0) && IsSpacingGlyph( rArgs.mpStr[mnMinCharPos+i]|GF_ISCHAR ) ) {}
-        if( i < 0 ) // nothing to do if the text is all spaces
-            return;
-        // #i91685# trailing letters are left aligned (right aligned for RTL)
-        mnTrailingSpaceWidth = rArgs.mpDXArray[ mnCharCount-1 ];
-        if( i > 0 )
-            mnTrailingSpaceWidth -= rArgs.mpDXArray[ i-1 ];
-        InitGIA(); // ensure valid mpCharWidths[], TODO: use GetIdealX() instead?
-        mnTrailingSpaceWidth -= Fixed2Vcl( mpCharWidths[i] );
-        // ignore trailing space for calculating the available width
-        nOrigWidth -= mnTrailingSpaceWidth;
-        nPixelWidth -= mnTrailingSpaceWidth;
-        // in RTL-layouts trailing spaces are leftmost
-        // TODO: use BiDi-algorithm to thoroughly check this assumption
-        if( rArgs.mnFlags & SAL_LAYOUT_BIDI_RTL)
-            mnBaseAdv = mnTrailingSpaceWidth;
-    }
-    // return early if there is nothing to do
-    if( !nPixelWidth )
-        return;
-
-    // HACK: justification requests which change the width by just one pixel were probably
-    // #i86038# introduced by lossy conversions between integer based coordinate system
-    // => ignoring such requests has many more benefits than eventual drawbacks
-    if( (nOrigWidth >= nPixelWidth-1) && (nOrigWidth <= nPixelWidth+1) )
-        return;
-
-    // changing the layout will make all previous measurements invalid
-    InvalidateMeasurements();
-
-    ATSUAttributeTag nTags[3];
-    ATSUAttributeValuePtr nVals[3];
-    ByteCount nBytes[3];
-
-    Fixed nFixedWidth = Vcl2Fixed( nPixelWidth );
-    mnCachedWidth = nFixedWidth;
-    Fract nFractFactor = kATSUFullJustification;
-    ATSLineLayoutOptions nLineLayoutOptions = kATSLineHasNoHangers | kATSLineHasNoOpticalAlignment | kATSLineBreakToNearestCharacter;
-
-    nTags[0] = kATSULineWidthTag;
-    nVals[0] = &nFixedWidth;
-    nBytes[0] = sizeof(Fixed);
-    nTags[1] = kATSULineLayoutOptionsTag;
-    nVals[1] = &nLineLayoutOptions;
-    nBytes[1] = sizeof(ATSLineLayoutOptions);
-    nTags[2] = kATSULineJustificationFactorTag;
-    nVals[2] = &nFractFactor;
-    nBytes[2] = sizeof(Fract);
-
-    OSStatus eStatus = ATSUSetLayoutControls( maATSULayout, 3, nTags, nBytes, nVals );
-    if( eStatus != noErr )
-        return;
-
-    // update the measurements of the justified layout to match the justification request
-    if( rArgs.mpDXArray )
-        InitGIA( &rArgs );
-}
-
-// -----------------------------------------------------------------------
-/**
- * ATSLayout::DrawText : Draw text to screen
- *
- * @param rGraphics: device to draw to
- *
- * Draw the layouted text to the CGContext
- *
- * @return : none
-**/
-void ATSLayout::DrawText( SalGraphics& rGraphics ) const
-{
-    SAL_INFO( "vcl.atsui.layout", "DrawText(" << this << ") mnCharCount=" << mnCharCount << ", mnGlyphCount=" << mnGlyphCount );
-
-    AquaSalGraphics& rAquaGraphics = static_cast<AquaSalGraphics&>(rGraphics);
-
-    // short circuit if there is nothing to do
-    if( (mnCharCount <= 0)
-    ||  !rAquaGraphics.CheckContext() )
-        return;
-
-    // the view is vertically flipped => flipped glyphs
-    // so apply a temporary transformation that it flips back
-    // also compensate if the font was size limited
-    CGContextSaveGState( rAquaGraphics.mrContext );
-    CGContextScaleCTM( rAquaGraphics.mrContext, +mfFontScale, -mfFontScale );
-    CGContextSetShouldAntialias( rAquaGraphics.mrContext, !rAquaGraphics.mbNonAntialiasedText );
-
-    // prepare ATSUI drawing attributes
-    static const ItemCount nMaxControls = 8;
-    ATSUAttributeTag theTags[ nMaxControls ];
-    ByteCount theSizes[ nMaxControls];
-    ATSUAttributeValuePtr theValues[ nMaxControls ];
-    ItemCount numcontrols = 0;
-
-    // Tell ATSUI to use CoreGraphics
-    theTags[numcontrols] = kATSUCGContextTag;
-    theSizes[numcontrols] = sizeof( CGContextRef );
-    theValues[numcontrols++] = &rAquaGraphics.mrContext;
-
-    // Rotate if necessary
-    if( rAquaGraphics.mnATSUIRotation != 0 )
-    {
-        Fixed theAngle = rAquaGraphics.mnATSUIRotation;
-        theTags[numcontrols] = kATSULineRotationTag;
-        theSizes[numcontrols] = sizeof( Fixed );
-        theValues[numcontrols++] = &theAngle;
-    }
-
-    DBG_ASSERT( (numcontrols <= nMaxControls), "ATSLayout::DrawText() numcontrols overflow" );
-    OSStatus theErr = ATSUSetLayoutControls (maATSULayout, numcontrols, theTags, theSizes, theValues);
-    (void) theErr;
-    DBG_ASSERT( (theErr==noErr), "ATSLayout::DrawText ATSUSetLayoutControls failed!\n" );
-
-    // Draw the text
-    const Point aPos = GetDrawPosition( Point(mnBaseAdv,0) );
-    const Fixed nFixedX = Vcl2Fixed( +aPos.X() );
-    const Fixed nFixedY = Vcl2Fixed( -aPos.Y() ); // adjusted for y-mirroring
-    if( maSubPortions.empty() )
-        ATSUDrawText( maATSULayout, mnMinCharPos, mnCharCount, nFixedX, nFixedY );
-    else
-    {
-        // draw the sub-portions and apply individual adjustments
-        SubPortionVector::const_iterator it = maSubPortions.begin();
-        for(; it != maSubPortions.end(); ++it )
-        {
-            const SubPortion& rSubPortion = *it;
-            // calculate sub-portion offset for rotated text
-            Fixed nXOfsFixed = rSubPortion.mnXOffset, nYOfsFixed = 0;
-            if( rAquaGraphics.mnATSUIRotation != 0 )
-            {
-                const double fRadians = rAquaGraphics.mnATSUIRotation * (M_PI/0xB40000);
-                nXOfsFixed = static_cast<Fixed>(static_cast<double>(+rSubPortion.mnXOffset) * cos( fRadians ));
-                nYOfsFixed = static_cast<Fixed>(static_cast<double>(+rSubPortion.mnXOffset) * sin( fRadians ));
-            }
-
-            // draw sub-portions
-            ATSUDrawText( maATSULayout,
-                rSubPortion.mnMinCharPos, rSubPortion.mnEndCharPos - rSubPortion.mnMinCharPos,
-                nFixedX + nXOfsFixed, nFixedY + nYOfsFixed );
-        }
-    }
-
-#if 1
-    // I am not sure at all if this code actually is needed; putting
-    // it in #if 0 didn't seem to cause any immediately visible bad
-    // effect. Aybody know? But I guess, better safe than sorry, so
-    // let's keep it in for now. This ATSUI-using code is destined for
-    // the bin anyway...
-
-    // request an update of the changed window area
-    if( rAquaGraphics.IsWindowGraphics() )
-    {
-        Rect drawRect; // rectangle of the changed area
-        theErr = ATSUMeasureTextImage( maATSULayout,
-            mnMinCharPos, mnCharCount, nFixedX, nFixedY, &drawRect );
-        if( theErr == noErr )
-        {
-            // FIXME: transformation from baseline to top left
-            // with the simple approach below we invalidate too much
-
-            // Indeed, this simply triples the rectangle's height,
-            // enlarging it on top and bottom with its old height!? Is
-            // that really necessary? (Sure, it can't harm, but it
-            // seems silly. But OTOH, see comment above.)
-
-            short d = drawRect.bottom - drawRect.top;
-            drawRect.top -= d;
-            drawRect.bottom += d;
-            CGRect aRect = CGRectMake( drawRect.left, drawRect.top,
-                                       drawRect.right - drawRect.left,
-                                       drawRect.bottom - drawRect.top );
-            aRect = CGContextConvertRectToDeviceSpace( rAquaGraphics.mrContext, aRect );
-            rAquaGraphics.RefreshRect( aRect );
-        }
-    }
-#endif
-    // restore the original graphic context transformations
-    CGContextRestoreGState( rAquaGraphics.mrContext );
-}
-
-// -----------------------------------------------------------------------
-/**
- * ATSLayout::GetNextGlyphs : Get info about next glyphs in the layout
- *
- * @param nLen: max number of char
- * @param pGlyphs: returned array of glyph ids
- * @param rPos: returned x starting position
- * @param nStart: index of the first requested glyph
- * @param pGlyphAdvances: returned array of glyphs advances
- * @param pCharIndexes: returned array of char indexes
- *
- * Returns infos about the next glyphs in the text layout
- *
- * @return : number of glyph details that were provided
-**/
-int ATSLayout::GetNextGlyphs( int nLen, sal_GlyphId* pGlyphIDs, Point& rPos, int& nStart,
-    sal_Int32* pGlyphAdvances, int* pCharIndexes,
-    const PhysicalFontFace** pFallbackFonts ) const
-{
-    if( nStart < 0 )                // first glyph requested?
-        nStart = 0;
-
-    // get glyph measurements
-    InitGIA();
-    // some measurements are only needed for multi-glyph results
-    if( nLen > 1 )
-    {
-        GetIdealX();
-        GetDeltaY();
-    }
-
-    if( nStart >= mnGlyphCount )    // no glyph left?
-        return 0;
-
-    // calculate glyph position relative to layout base
-    // TODO: avoid for nStart!=0 case by reusing rPos
-    Fixed nXOffset = mnBaseAdv;
-    for( int i = 0; i < nStart; ++i )
-        nXOffset += mpGlyphAdvances[ i ];
-    // if sub-portion offsets are involved there is an additional x-offset
-    if( !maSubPortions.empty() )
-    {
-        // prepare to find the sub-portion
-        int nCharPos = nStart + mnMinCharPos;
-        if( mpGlyphs2Chars )
-            nCharPos = mpGlyphs2Chars[nStart];
-
-        // find the matching subportion
-        // TODO: is a non-linear search worth it?
-        SubPortionVector::const_iterator it = maSubPortions.begin();
-        for(; it != maSubPortions.end(); ++it) {
-            const SubPortion& r = *it;
-            if( nCharPos < r.mnMinCharPos )
-                continue;
-            if( nCharPos >= r.mnEndCharPos )
-                continue;
-            // apply the sub-portion xoffset
-            nXOffset += r.mnXOffset;
-            break;
-        }
-    }
-
-    Fixed nYOffset = 0;
-    if( mpDeltaY )
-        nYOffset = mpDeltaY[ nStart ];
-
-    // calculate absolute position in pixel units
-    const Point aRelativePos( Fix2Long(static_cast<Fixed>(nXOffset*mfFontScale)), Fix2Long(static_cast<Fixed>(nYOffset*mfFontScale)) );
-    rPos = GetDrawPosition( aRelativePos );
-
-    // update return values
-    int nCount = 0;
-    while( nCount < nLen )
-    {
-        ++nCount;
-        sal_GlyphId nGlyphId = mpGlyphIds[nStart];
-
-           // check if glyph fallback is needed for this glyph
-        // TODO: use ATSUDirectGetLayoutDataArrayPtrFromTextLayout(kATSUDirectDataStyleIndex) API instead?
-        const int nCharPos = mpGlyphs2Chars ? mpGlyphs2Chars[nStart] : nStart + mnMinCharPos;
-        ATSUFontID nFallbackFontID = kATSUInvalidFontID;
-        UniCharArrayOffset nChangedOffset = 0;
-        UniCharCount nChangedLength = 0;
-        OSStatus eStatus = ATSUMatchFontsToText( maATSULayout, nCharPos, kATSUToTextEnd,
-                      &nFallbackFontID, &nChangedOffset, &nChangedLength );
-        if( (eStatus == kATSUFontsMatched) && ((int)nChangedOffset == nCharPos) )
-        {
-            // fallback is needed
-            if( !mpFallbackInfo )
-                mpFallbackInfo = new FallbackInfo;
-            // register fallback font
-            const int nLevel = mpFallbackInfo->AddFallback( nFallbackFontID );
-               // update sal_GlyphId with fallback level
-            nGlyphId |= (nLevel << GF_FONTSHIFT);
-
-            if( pFallbackFonts )
-                *(pFallbackFonts++) = mpFallbackInfo->GetFallbackFontData( nLevel );
-        }
-
-        // update resulting glyphid array
-        *(pGlyphIDs++) = nGlyphId;
-
-        // update returned glyph advance array
-        if( pGlyphAdvances )
-            *(pGlyphAdvances++) = Fixed2Vcl( mpGlyphAdvances[nStart] );
-
-        // update returned index-into-string array
-        if( pCharIndexes )
-        {
-            int nCharPos;
-            if( mpGlyphs2Chars )
-                nCharPos = mpGlyphs2Chars[nStart];
-            else
-                nCharPos = nStart + mnMinCharPos;
-            *(pCharIndexes++) = nCharPos;
-        }
-
-        // stop at last glyph
-        if( ++nStart >= mnGlyphCount )
-            break;
-
-        // stop when next the x-position is unexpected
-        if( !maSubPortions.empty() )
-            break;   // TODO: finish the complete sub-portion
-        if( !pGlyphAdvances && mpGlyphOrigAdvs )
-            if( mpGlyphAdvances[nStart-1] != mpGlyphOrigAdvs[nStart-1] )
-                break;
-
-        // stop when the next y-position is unexpected
-        if( mpDeltaY )
-            if( mpDeltaY[nStart-1] != mpDeltaY[nStart] )
-                break;
-    }
-
-    return nCount;
-}
-
-// -----------------------------------------------------------------------
-/**
- * ATSLayout::GetTextWidth : Get typographic width of layouted text
- *
- * Get typographic bounds of the text
- *
- * @return : text width
-**/
-long ATSLayout::GetTextWidth() const
-{
-    SAL_INFO("vcl.atsui.layout", "GetTextWidth(" << this << "): CharCount=" << mnCharCount <<
-             (maATSULayout == NULL ? " null layout!?" : ""));
-
-    if( mnCharCount <= 0 )
-        return 0;
-
-    DBG_ASSERT( (maATSULayout!=NULL), "ATSLayout::GetTextWidth() with maATSULayout==NULL !\n");
-    if( !maATSULayout )
-        return 0;
-
-    if( !mnCachedWidth )
-    {
-        // prepare precise measurements on pixel based or reference-device
-        const UInt16 eTypeOfBounds = kATSUseFractionalOrigins;
-
-        // determine number of needed measurement trapezoids
-        ItemCount nMaxBounds = 0;
-        OSStatus err = ATSUGetGlyphBounds( maATSULayout, 0, 0, mnMinCharPos, mnCharCount,
-            eTypeOfBounds, 0, NULL, &nMaxBounds );
-        if( (err != noErr) ||  (nMaxBounds <= 0) ) {
-            SAL_INFO("vcl.atsui.layout", "GetTextWidth(): " <<
-                     (err != noErr ? "ATSUGetGlyphBounds() failed" : "nMaxBounds <= 0") <<
-                     ", returning 0");
-            return 0;
-        }
-
-        // get the trapezoids
-        typedef std::vector<ATSTrapezoid> TrapezoidVector;
-        TrapezoidVector aTrapezoidVector( nMaxBounds );
-        ItemCount nBoundsCount = 0;
-        err = ATSUGetGlyphBounds( maATSULayout, 0, 0, mnMinCharPos, mnCharCount,
-            eTypeOfBounds, nMaxBounds, &aTrapezoidVector[0], &nBoundsCount );
-        if( err != noErr ) {
-            SAL_INFO("vcl.atsui.layout", "GetTextWidth(): ATSUGetGlyphBounds() failed case 2, returning 0");
-            return 0;
-        }
-
-        DBG_ASSERT( (nBoundsCount <= nMaxBounds), "ATSLayout::GetTextWidth() : too many trapezoids !\n");
-
-        // find the bound extremas
-        Fixed nLeftBound = 0;
-        Fixed nRightBound = 0;
-        for( ItemCount i = 0; i < nBoundsCount; ++i )
-        {
-            const ATSTrapezoid& rTrap = aTrapezoidVector[i];
-            if( (i == 0) || (nLeftBound < rTrap.lowerLeft.x) )
-                nLeftBound = rTrap.lowerLeft.x;
-            if( (i == 0) || (nRightBound > rTrap.lowerRight.x) )
-                nRightBound = rTrap.lowerRight.x;
-        }
-
-        // measure the bound extremas
-        mnCachedWidth = nRightBound - nLeftBound;
-        // adjust for eliminated trailing space widths
-    }
-
-    int nScaledWidth = Fixed2Vcl( mnCachedWidth );
-    nScaledWidth += mnTrailingSpaceWidth;
-
-    SAL_INFO("vcl.atsui.layout", "GetTextWidth() returning nScaledWidth=" << nScaledWidth);
-    return nScaledWidth;
-}
-
-// -----------------------------------------------------------------------
-/**
- * ATSLayout::FillDXArray : Get Char widths
- *
- * @param pDXArray: array to be filled with x-advances
- *
- * Fill the pDXArray with horizontal deltas : CharWidths
- *
- * @return : typographical width of the complete text layout
-**/
-long ATSLayout::FillDXArray( sal_Int32* pDXArray ) const
-{
-    // short circuit requests which don't need full details
-    if( !pDXArray )
-        return GetTextWidth();
-
-    // check assumptions
-    DBG_ASSERT( !mnTrailingSpaceWidth, "ATSLayout::FillDXArray() with nTSW!=0" );
-
-    // initialize details about the resulting layout
-    InitGIA();
-
-    // distribute the widths among the string elements
-    int nPixWidth = 0;
-    mnCachedWidth = 0;
-    for( int i = 0; i < mnCharCount; ++i )
-    {
-        // convert and adjust for accumulated rounding errors
-        mnCachedWidth += mpCharWidths[i];
-        const int nOldPixWidth = nPixWidth;
-        nPixWidth = Fixed2Vcl( mnCachedWidth );
-        pDXArray[i] = nPixWidth - nOldPixWidth;
-    }
-
-    return nPixWidth;
-}
-
-// -----------------------------------------------------------------------
-/**
- * ATSLayout::GetTextBreak : Find line break depending on width
- *
- * @param nMaxWidth : maximal logical text width in subpixel units
- * @param nCharExtra: expanded/condensed spacing in subpixel units
- * @param nFactor:    number of subpixel units per pixel
- *
- * Measure the layouted text to find the typographical line break
- * the result is needed by the language specific line breaking
- *
- * @return : string index corresponding to the suggested line break
-**/
-sal_Int32 ATSLayout::GetTextBreak( long nMaxWidth, long nCharExtra, int nFactor ) const
-{
-    SAL_INFO("vcl.atsui.layout", "GetTextBreak(" << this << ",nMaxWidth=" << nMaxWidth << ",nCharExtra=" << nCharExtra << ",nFactor=" << nFactor << ")" );
-
-    if( !maATSULayout ) {
-        SAL_INFO( "vcl.atsui.layout", "GetTextBreak(): no maATSULayout, returning -1" );
-        return -1;
-    }
-
-    // the semantics of the legacy use case (nCharExtra!=0) cannot be mapped to ATSUBreakLine()
-    if( nCharExtra != 0 )
-    {
-        // prepare the measurement by layouting and measuring the un-expanded/un-condensed text
-        if( !InitGIA() )
-            return -1;
-
-        // TODO: use a better way than by testing each the char position
-        ATSUTextMeasurement nATSUSumWidth = 0;
-        const ATSUTextMeasurement nATSUMaxWidth = Vcl2Fixed( nMaxWidth / nFactor );
-        const ATSUTextMeasurement nATSUExtraWidth = Vcl2Fixed( nCharExtra ) / nFactor;
-        for( int i = 0; i < mnCharCount; ++i )
-        {
-            nATSUSumWidth += mpCharWidths[i];
-            if( nATSUSumWidth >= nATSUMaxWidth )
-                return (mnMinCharPos + i);
-            nATSUSumWidth += nATSUExtraWidth;
-            if( nATSUSumWidth >= nATSUMaxWidth )
-                if( i+1 < mnCharCount )
-                    return (mnMinCharPos + i);
-        }
-
-        return -1;
-    }
-
-    // get a quick overview on what could fit
-    const long nPixelWidth = (nMaxWidth - (nCharExtra * mnCharCount)) / nFactor;
-    if( nPixelWidth <= 0 ) {
-        SAL_INFO("vcl.atsui.layout", "GetTextBreak(): nPixelWidth=" << nPixelWidth << ", returning mnMinCharPos=" << mnMinCharPos);
-        return mnMinCharPos;
-    }
-
-    // check assumptions
-    DBG_ASSERT( !mnTrailingSpaceWidth, "ATSLayout::GetTextBreak() with nTSW!=0" );
-
-    // initial measurement of text break position
-    UniCharArrayOffset nBreakPos = mnMinCharPos;
-    const ATSUTextMeasurement nATSUMaxWidth = Vcl2Fixed( nPixelWidth );
-    if( nATSUMaxWidth <= 0xFFFF ) {
-        // #i108584# avoid ATSU rejecting the parameter
-        //           or do ATSUMaxWidth=0x10000;
-        SAL_INFO("vcl.atsui.layout", "GetTextBreak(): nATSUMaxWidth=" << std::hex << nATSUMaxWidth << std::dec <<
-                 ", returning mnMinCharPos=" << mnMinCharPos);
-        return mnMinCharPos;
-    }
-
-    OSStatus eStatus = ATSUBreakLine( maATSULayout, mnMinCharPos,
-        nATSUMaxWidth, false, &nBreakPos );
-    if( (eStatus != noErr) && (eStatus != kATSULineBreakInWord) )
-        return -1;
-
-    // the result from ATSUBreakLine() doesn't match the semantics expected by its
-    // application layer callers from SW+SVX+I18N. Adjust the results to the expectations:
-
-    // ATSU reports that everything fits even when trailing spaces would break the line
-    // #i89789# OOo's application layers expect -1 if everything fits
-    if( nBreakPos >= static_cast<UniCharArrayOffset>(mnEndCharPos) )
-        return -1;
-
-    // GetTextBreak()'s callers expect it to return the "stupid visual line break".
-    // Returning anything else result.s in subtle problems in the application layers.
-    static const bool bInWord = true; // TODO: add as argument to GetTextBreak() method
-    if( !bInWord )
-        return nBreakPos;
-
-    // emulate stupid visual line breaking by line breaking for the remaining width
-    ATSUTextMeasurement nLeft, nRight, nDummy;
-    eStatus = ATSUGetUnjustifiedBounds( maATSULayout, mnMinCharPos, nBreakPos-mnMinCharPos,
-        &nLeft, &nRight, &nDummy, &nDummy );
-    if( eStatus != noErr ) {
-        SAL_INFO("vcl.atsui.layout", "GetTextBreak(): ATSUGetUnjustifiedBounds() failed, returning nBreakPos=" << nBreakPos);
-        return nBreakPos;
-    }
-
-    const ATSUTextMeasurement nATSURemWidth = nATSUMaxWidth - (nRight - nLeft);
-    if( nATSURemWidth <= 0xFFFF ) {
-        // #i108584# avoid ATSU rejecting the parameter
-        SAL_INFO("vcl.atsui.layout", "GetTextBreak(): nATSURemWidth=" << std::hex << nATSURemWidth << std::dec <<
-                 ", returning nBreakPos=" << nBreakPos);
-        return nBreakPos;
-    }
-
-    UniCharArrayOffset nBreakPosInWord = nBreakPos;
-    eStatus = ATSUBreakLine( maATSULayout, nBreakPos, nATSURemWidth, false, &nBreakPosInWord );
-
-    SAL_INFO("vcl.atsui.layout", "GetTextBreak() returning nBreakPosInWord=" << nBreakPosInWord);
-    return nBreakPosInWord;
-}
-
-// -----------------------------------------------------------------------
-/**
- * ATSLayout::GetCaretPositions : Find positions of carets
- *
- * @param nMaxIndex position to which we want to find the carets
- *
- * Fill the array of positions of carets (for cursors and selections)
- *
- * @return : none
-**/
-void ATSLayout::GetCaretPositions( int nMaxIndex, sal_Int32* pCaretXArray ) const
-{
-    DBG_ASSERT( ((nMaxIndex>0)&&!(nMaxIndex&1)),
-        "ATSLayout::GetCaretPositions() : invalid number of caret pairs requested");
-
-    // initialize the caret positions
-    for( int i = 0; i < nMaxIndex; ++i )
-        pCaretXArray[ i ] = -1;
-
-    for( int n = 0; n <= mnCharCount; ++n )
-    {
-        // measure the characters cursor position
-        typedef unsigned char Boolean;
-        const Boolean bIsLeading = true;
-        ATSUCaret aCaret0, aCaret1;
-        Boolean bIsSplit;
-        OSStatus eStatus = ATSUOffsetToCursorPosition( maATSULayout,
-            mnMinCharPos + n, bIsLeading, kATSUByCharacter,
-            &aCaret0, &aCaret1, &bIsSplit );
-        if( eStatus != noErr )
-            continue;
-        const Fixed nFixedPos = mnBaseAdv + aCaret0.fX;
-        // convert the measurement to pixel units
-        const int nPixelPos = Fixed2Vcl( nFixedPos );
-        // update previous trailing position
-        if( n > 0 )
-            pCaretXArray[2*n-1] = nPixelPos;
-        // update current leading position
-        if( 2*n >= nMaxIndex )
-            break;
-        pCaretXArray[2*n+0] = nPixelPos;
-    }
-}
-
-// -----------------------------------------------------------------------
-/**
- * ATSLayout::GetBoundRect : Get rectangle dim containing the layouted text
- *
- * @param rVCLRect: rectangle of text image (layout) measures
- *
- * Get ink bounds of the text
- *
- * @return : measurement valid
-**/
-bool ATSLayout::GetBoundRect( SalGraphics& rGraphics, Rectangle& rVCLRect ) const
-{
-    AquaSalGraphics& rAquaGraphics = static_cast<AquaSalGraphics&>(rGraphics);
-
-    const Point aPos = GetDrawPosition( Point(mnBaseAdv, 0) );
-    const Fixed nFixedX = Vcl2Fixed( +aPos.X() );
-    const Fixed nFixedY = Vcl2Fixed( +aPos.Y() );
-
-    // prepare ATSUI drawing attributes
-    static const ItemCount nMaxControls = 8;
-    ATSUAttributeTag theTags[ nMaxControls ];
-    ByteCount theSizes[ nMaxControls];
-    ATSUAttributeValuePtr theValues[ nMaxControls ];
-    ItemCount numcontrols = 0;
-
-    // Tell ATSUI to use CoreGraphics
-    theTags[numcontrols] = kATSUCGContextTag;
-    theSizes[numcontrols] = sizeof( CGContextRef );
-    theValues[numcontrols++] = &rAquaGraphics.mrContext;
-
-    // Rotate if necessary
-    if( rAquaGraphics.mnATSUIRotation != 0 )
-    {
-        Fixed theAngle = rAquaGraphics.mnATSUIRotation;
-        theTags[numcontrols] = kATSULineRotationTag;
-        theSizes[numcontrols] = sizeof( Fixed );
-        theValues[numcontrols++] = &theAngle;
-    }
-
-    DBG_ASSERT( (numcontrols <= nMaxControls), "ATSLayout::GetBoundRect() numcontrols overflow" );
-    OSStatus theErr = ATSUSetLayoutControls (maATSULayout, numcontrols, theTags, theSizes, theValues);
-    (void) theErr;
-    DBG_ASSERT( (theErr==noErr), "ATSLayout::GetBoundRect ATSUSetLayoutControls failed!\n" );
-
-    Rect aMacRect;
-    OSStatus eStatus = ATSUMeasureTextImage( maATSULayout,
-        mnMinCharPos, mnCharCount, nFixedX, nFixedY, &aMacRect );
-    if( eStatus != noErr )
-        return false;
-
-    // ATSU top-bottom are vertically flipped from a VCL aspect
-    rVCLRect.Left()   = AtsuPix2Vcl( aMacRect.left );
-    rVCLRect.Top()    = AtsuPix2Vcl( aMacRect.top );
-    rVCLRect.Right()  = AtsuPix2Vcl( aMacRect.right );
-    rVCLRect.Bottom() = AtsuPix2Vcl( aMacRect.bottom );
-    return true;
-}
-
-// -----------------------------------------------------------------------
-/**
- * ATSLayout::InitGIA() : get many information about layouted text
- *
- * Fills arrays of information about the gylph layout previously done
- *  in ASTLayout::LayoutText() : glyph advance (width), glyph delta Y (from baseline),
- *  mapping between glyph index and character index, chars widths
- *
- * @return : true if everything could be computed, otherwise false
-**/
-bool ATSLayout::InitGIA( ImplLayoutArgs* pArgs ) const
-{
-    SAL_INFO("vcl.atsui.layout", "InitGIA(" << this << "): GlyphCount=" << mnGlyphCount << ",CharCount=" << mnCharCount);
-
-    // no need to run InitGIA more than once on the same ATSLayout object
-    if( mnGlyphCount >= 0 )
-        return true;
-    mnGlyphCount = 0;
-
-    // Workaround a bug in ATSUI with empty string
-    if( mnCharCount <=  0 )
-        return false;
-
-    // initialize character details
-    mpCharWidths    = new Fixed[ mnCharCount ];
-    mpChars2Glyphs  = new int[ mnCharCount ];
-    for( int n = 0; n < mnCharCount; ++n )
-    {
-        mpCharWidths[ n ] = 0;
-        mpChars2Glyphs[ n ] = -1;
-    }
-
-    // get details about the glyph layout
-    ItemCount iLayoutDataCount;
-    const ATSLayoutRecord* pALR;
-    OSStatus eStatus = ATSUDirectGetLayoutDataArrayPtrFromTextLayout(
-        maATSULayout, mnMinCharPos, kATSUDirectDataLayoutRecordATSLayoutRecordCurrent,
-        (void**)&pALR, &iLayoutDataCount );
-    DBG_ASSERT( (eStatus==noErr), "ATSLayout::InitGIA() : no ATSLayoutRecords!\n");
-    if( (eStatus != noErr)
-    || (iLayoutDataCount <= 1) )
-        return false;
-
-    // initialize glyph details
-    mpGlyphIds      = new ATSGlyphRef[ iLayoutDataCount ];
-    mpGlyphAdvances = new Fixed[ iLayoutDataCount ];
-    mpGlyphs2Chars  = new int[ iLayoutDataCount ];
-
-    // measure details of the glyph layout
-    Fixed nLeftPos = 0;
-    for( ItemCount i = 0; i < iLayoutDataCount; ++i )
-    {
-        const ATSLayoutRecord& rALR = pALR[i];
-
-        // distribute the widths as fairly as possible among the chars
-        const int nRelativeIdx = (rALR.originalOffset / 2);
-        if( i+1 < iLayoutDataCount )
-            mpCharWidths[ nRelativeIdx ] += pALR[i+1].realPos - rALR.realPos;
-
-        // new glyph is available => finish measurement of old glyph
-        if( mnGlyphCount > 0 )
-            mpGlyphAdvances[ mnGlyphCount-1 ] = rALR.realPos - nLeftPos;
-
-        // ignore marker or deleted glyphs
-        enum { MARKED_OUTGLYPH=0xFFFE, DROPPED_OUTGLYPH=0xFFFF};
-        if( rALR.glyphID >= MARKED_OUTGLYPH )
-            continue;
-
-        DBG_ASSERT( !(rALR.flags & kATSGlyphInfoTerminatorGlyph),
-            "ATSLayout::InitGIA(): terminator glyph not marked as deleted!" );
-
-        // store details of the visible glyphs
-        nLeftPos = rALR.realPos;
-        mpGlyphIds[ mnGlyphCount ] = rALR.glyphID;
-
-        // map visible glyphs to their counterparts in the UTF16-character array
-        mpGlyphs2Chars[ mnGlyphCount ] = nRelativeIdx + mnMinCharPos;
-        mpChars2Glyphs[ nRelativeIdx ] = mnGlyphCount;
-
-        ++mnGlyphCount;
-    }
-
-    // measure complete width
-    mnCachedWidth = mnBaseAdv;
-    mnCachedWidth += pALR[iLayoutDataCount-1].realPos - pALR[0].realPos;
-
-#if (OSL_DEBUG_LEVEL > 1)
-    Fixed nWidthSum = mnBaseAdv;
-    for( int n = 0; n < mnCharCount; ++n )
-        nWidthSum += mpCharWidths[ n ];
-    DBG_ASSERT( (nWidthSum==mnCachedWidth),
-        "ATSLayout::InitGIA(): measured widths do not match!\n" );
-#endif
-
-    // #i91183# we need to split up the portion into sub-portions
-    // if the ATSU-layout differs too much from the requested layout
-    if( pArgs && pArgs->mpDXArray )
-    {
-        // TODO: non-strong-LTR case cases should be handled too
-        if( (pArgs->mnFlags & TEXT_LAYOUT_BIDI_STRONG)
-        && !(pArgs->mnFlags & TEXT_LAYOUT_BIDI_RTL) )
-        {
-            Fixed nSumCharWidths = 0;
-            SubPortion aSubPortion = { mnMinCharPos, 0, 0 };
-            for( int i = 0; i < mnCharCount; ++i )
-            {
-                // calculate related logical position
-                nSumCharWidths += mpCharWidths[i];
-
-                // start new sub-portion if needed
-                const Fixed nNextXPos = Vcl2Fixed(pArgs->mpDXArray[i]);
-                const Fixed nNextXOffset = nNextXPos - nSumCharWidths;
-                const Fixed nFixedDiff = aSubPortion.mnXOffset - nNextXOffset;
-                if( (nFixedDiff < -0xC000) || (nFixedDiff > +0xC000) ) {
-                    // get to the end of the current sub-portion
-                    // prevent splitting up at diacritics etc.
-                    int j = i;
-                    while( (++j < mnCharCount) && !mpCharWidths[j] )
-                        ;
-                    aSubPortion.mnEndCharPos = mnMinCharPos + j;
-                    // emit current sub-portion
-                    maSubPortions.push_back( aSubPortion );
-                    // prepare next sub-portion
-                    aSubPortion.mnMinCharPos = aSubPortion.mnEndCharPos;
-                    aSubPortion.mnXOffset = nNextXOffset;
-                }
-            }
-
-            // emit the remaining sub-portion
-            if( !maSubPortions.empty() )
-            {
-                aSubPortion.mnEndCharPos = mnEndCharPos;
-                if( aSubPortion.mnEndCharPos != aSubPortion.mnMinCharPos )
-                    maSubPortions.push_back( aSubPortion );
-            }
-        }
-
-        // override layouted charwidths with requested charwidths
-        for( int n = 0; n < mnCharCount; ++n )
-            mpCharWidths[ n ] = pArgs->mpDXArray[ n ];
-    }
-
-    // release the ATSU layout records
-    ATSUDirectReleaseLayoutDataArrayPtr(NULL,
-        kATSUDirectDataLayoutRecordATSLayoutRecordCurrent, (void**)&pALR );
-
-    return true;
-}
-
-// -----------------------------------------------------------------------
-
-bool ATSLayout::GetIdealX() const
-{
-    // compute the ideal advance widths only once
-    if( mpGlyphOrigAdvs != NULL )
-        return true;
-
-    DBG_ASSERT( (mpGlyphIds!=NULL), "GetIdealX() called with mpGlyphIds==NULL !" );
-    DBG_ASSERT( (mrATSUStyle!=NULL), "GetIdealX called with mrATSUStyle==NULL !" );
-
-    // TODO: cache ideal metrics per glyph?
-    std::vector<ATSGlyphIdealMetrics> aIdealMetrics;
-    aIdealMetrics.resize( mnGlyphCount );
-    OSStatus theErr = ATSUGlyphGetIdealMetrics( mrATSUStyle,
-        mnGlyphCount, &mpGlyphIds[0], sizeof(*mpGlyphIds), &aIdealMetrics[0] );
-    DBG_ASSERT( (theErr==noErr), "ATSUGlyphGetIdealMetrics failed!");
-    if( theErr != noErr )
-        return false;
-
-    mpGlyphOrigAdvs = new Fixed[ mnGlyphCount ];
-    for( int i = 0;i < mnGlyphCount;++i )
-        mpGlyphOrigAdvs[i] = FloatToFixed( aIdealMetrics[i].advance.x );
-
-    return true;
-}
-
-// -----------------------------------------------------------------------
-
-bool ATSLayout::GetDeltaY() const
-{
-    // don't bother to get the same delta-y-array more than once
-    if( mpDeltaY != NULL )
-        return true;
-
-    if( !maATSULayout )
-        return false;
-
-    // get and keep the y-deltas in the mpDeltaY member variable
-    // => release it in the destructor
-    ItemCount nDeltaCount = 0;
-    OSStatus theErr = ATSUDirectGetLayoutDataArrayPtrFromTextLayout(
-        maATSULayout, mnMinCharPos, kATSUDirectDataBaselineDeltaFixedArray,
-        (void**)&mpDeltaY, &nDeltaCount );
-
-    DBG_ASSERT( (theErr==noErr ), "mpDeltaY - ATSUDirectGetLayoutDataArrayPtrFromTextLayout failed!\n");
-    if( theErr != noErr )
-        return false;
-
-    if( mpDeltaY == NULL )
-        return true;
-
-    if( nDeltaCount != (ItemCount)mnGlyphCount )
-    {
-        DBG_WARNING( "ATSLayout::GetDeltaY() : wrong deltaY count!" );
-        ATSUDirectReleaseLayoutDataArrayPtr( NULL,
-            kATSUDirectDataBaselineDeltaFixedArray, (void**)&mpDeltaY );
-        mpDeltaY = NULL;
-        return false;
-    }
-
-    return true;
-}
-
-// -----------------------------------------------------------------------
-
-#define DELETEAZ( X ) { delete[] X; X = NULL; }
-
-void ATSLayout::InvalidateMeasurements()
-{
-    mnGlyphCount = -1;
-    DELETEAZ( mpGlyphIds );
-    DELETEAZ( mpCharWidths );
-    DELETEAZ( mpChars2Glyphs );
-    DELETEAZ( mpGlyphs2Chars );
-    DELETEAZ( mpGlyphRTLFlags );
-    DELETEAZ( mpGlyphAdvances );
-    DELETEAZ( mpGlyphOrigAdvs );
-    DELETEAZ( mpDeltaY );
-}
-
-// =======================================================================
-
-// glyph fallback is supported directly by Aqua
-// so methods used only by MultiSalLayout can be dummy implementated
-void ATSLayout::InitFont() const {}
-void ATSLayout::MoveGlyph( int /*nStart*/, long /*nNewXPos*/ ) {}
-void ATSLayout::DropGlyph( int /*nStart*/ ) {}
-void ATSLayout::Simplify( bool /*bIsBase*/ ) {}
-
-// =======================================================================
-
-int FallbackInfo::AddFallback( ATSUFontID nFontId )
-{
-    // check if the fallback font is already known
-    for( int nLevel = 0; nLevel < mnMaxLevel; ++nLevel )
-        if( maATSUFontId[ nLevel ] == nFontId )
-            return (nLevel + 1);
-
-    // append new fallback font if possible
-    if( mnMaxLevel >= MAX_FALLBACK-1 )
-        return 0;
-    // keep ATSU font id of fallback font
-    maATSUFontId[ mnMaxLevel ] = nFontId;
-    // find and cache the corresponding PhysicalFontFace pointer
-    const SystemFontList* pSFL = GetSalData()->mpFontList;
-    const ImplMacFontData* pFontData = pSFL->GetFontDataFromId( nFontId );
-    maFontData[ mnMaxLevel ] = pFontData;
-    // increase fallback level by one
-    return (++mnMaxLevel);
-}
-
-// -----------------------------------------------------------------------
-
-const PhysicalFontFace* FallbackInfo::GetFallbackFontData( int nFallbackLevel ) const
-{
-    const ImplMacFontData* pFallbackFont = maFontData[ nFallbackLevel-1 ];
-    return pFallbackFont;
-}
-
-// =======================================================================
-
-SalLayout* AquaSalGraphics::GetTextLayout( ImplLayoutArgs&, int /*nFallbackLevel*/ )
-{
-    ATSLayout* pATSLayout = new ATSLayout( maATSUStyle, mfFontScale );
-    return pATSLayout;
-}
-
-// =======================================================================
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/aqua/source/gdi/atsui/salatsuifontutils.cxx b/vcl/aqua/source/gdi/atsui/salatsuifontutils.cxx
deleted file mode 100644
index 6be3a39..0000000
--- a/vcl/aqua/source/gdi/atsui/salatsuifontutils.cxx
+++ /dev/null
@@ -1,486 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- *   Licensed to the Apache Software Foundation (ASF) under one or more
- *   contributor license agreements. See the NOTICE file distributed
- *   with this work for additional information regarding copyright
- *   ownership. The ASF licenses this file to you under the Apache
- *   License, Version 2.0 (the "License"); you may not use this file
- *   except in compliance with the License. You may obtain a copy of
- *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#include "sal/config.h"
-
-#include <boost/assert.hpp>
-#include <vector>
-#include <set>
-
-#include "vcl/svapp.hxx"
-
-#include "aqua/atsui/salgdi.h"
-#include "aqua/saldata.hxx"
-#include "aqua/atsui/salatsuifontutils.hxx"
-
-// ATSUI is deprecated in 10.6 (or already 10.5?)
-#if HAVE_GCC_PRAGMA_DIAGNOSTIC_MODIFY
-#pragma GCC diagnostic warning "-Wdeprecated-declarations"
-#endif
-
-// we have to get the font attributes from the name table
-// since neither head's macStyle nor OS/2's panose are easily available
-// during font enumeration. macStyle bits would be not sufficient anyway
-// and SFNT fonts on Mac usually do not contain an OS/2 table.
-static void UpdateAttributesFromPSName( const OUString& rPSName, ImplDevFontAttributes& rDFA )
-{
-    OString aPSName( OUStringToOString( rPSName, RTL_TEXTENCODING_UTF8 ).toAsciiLowerCase() );
-
-    // TODO: use a multi-string ignore-case matcher once it becomes available
-    if( (aPSName.indexOf("regular") != -1)
-    ||  (aPSName.indexOf("normal") != -1)
-    ||  (aPSName.indexOf("roman") != -1)
-    ||  (aPSName.indexOf("medium") != -1)
-    ||  (aPSName.indexOf("plain") != -1)
-    ||  (aPSName.indexOf("standard") != -1)
-    ||  (aPSName.indexOf("std") != -1) )
-    {
-        rDFA.SetWidthType(WIDTH_NORMAL);
-        rDFA.SetWeight(WEIGHT_NORMAL);
-        rDFA.SetItalic(ITALIC_NONE);
-    }
-
-    // heuristics for font weight
-    if (aPSName.indexOf("extrablack") != -1)
-        rDFA.SetWeight(WEIGHT_BLACK);
-    else if (aPSName.indexOf("black") != -1)
-        rDFA.SetWeight(WEIGHT_BLACK);
-    //else if (aPSName.indexOf("book") != -1)
-    //    rDFA.SetWeight(WEIGHT_SEMIBOLD);
-    else if( (aPSName.indexOf("semibold") != -1)
-    ||  (aPSName.indexOf("smbd") != -1))
-        rDFA.SetWeight(WEIGHT_SEMIBOLD);
-    else if (aPSName.indexOf("ultrabold") != -1)
-        rDFA.SetWeight(WEIGHT_ULTRABOLD);
-    else if (aPSName.indexOf("extrabold") != -1)
-        rDFA.SetWeight(WEIGHT_BLACK);
-    else if( (aPSName.indexOf("bold") != -1)
-    ||  (aPSName.indexOf("-bd") != -1))
-        rDFA.SetWeight(WEIGHT_BOLD);
-    else if (aPSName.indexOf("extralight") != -1)
-        rDFA.SetWeight(WEIGHT_ULTRALIGHT);
-    else if (aPSName.indexOf("ultralight") != -1)
-        rDFA.SetWeight(WEIGHT_ULTRALIGHT);
-    else if (aPSName.indexOf("light") != -1)
-        rDFA.SetWeight(WEIGHT_LIGHT);
-    else if (aPSName.indexOf("thin") != -1)
-        rDFA.SetWeight(WEIGHT_THIN);
-    else if (aPSName.indexOf("-w3") != -1)
-        rDFA.SetWeight(WEIGHT_LIGHT);
-    else if (aPSName.indexOf("-w4") != -1)
-        rDFA.SetWeight(WEIGHT_SEMILIGHT);
-    else if (aPSName.indexOf("-w5") != -1)
-        rDFA.SetWeight(WEIGHT_NORMAL);
-    else if (aPSName.indexOf("-w6") != -1)
-        rDFA.SetWeight(WEIGHT_SEMIBOLD);
-    else if (aPSName.indexOf("-w7") != -1)
-        rDFA.SetWeight(WEIGHT_BOLD);
-    else if (aPSName.indexOf("-w8") != -1)
-        rDFA.SetWeight(WEIGHT_ULTRABOLD);
-    else if (aPSName.indexOf("-w9") != -1)
-        rDFA.SetWeight(WEIGHT_BLACK);
-
-    // heuristics for font slant
-    if( (aPSName.indexOf("italic") != -1)
-    ||  (aPSName.indexOf(" ital") != -1)
-    ||  (aPSName.indexOf("cursive") != -1)
-    ||  (aPSName.indexOf("-it") != -1)
-    ||  (aPSName.indexOf("lightit") != -1)
-    ||  (aPSName.indexOf("mediumit") != -1)
-    ||  (aPSName.indexOf("boldit") != -1)
-    ||  (aPSName.indexOf("cnit") != -1)
-    ||  (aPSName.indexOf("bdcn") != -1)
-    ||  (aPSName.indexOf("bdit") != -1)
-    ||  (aPSName.indexOf("condit") != -1)
-    ||  (aPSName.indexOf("bookit") != -1)
-    ||  (aPSName.indexOf("blackit") != -1) )
-        rDFA.SetItalic(ITALIC_NORMAL);
-    if( (aPSName.indexOf("oblique") != -1)
-    ||  (aPSName.indexOf("inclined") != -1)
-    ||  (aPSName.indexOf("slanted") != -1) )
-        rDFA.SetItalic(ITALIC_OBLIQUE);
-
-    // heuristics for font width
-    if( (aPSName.indexOf("condensed") != -1)
-    ||  (aPSName.indexOf("-cond") != -1)
-    ||  (aPSName.indexOf("boldcond") != -1)
-    ||  (aPSName.indexOf("boldcn") != -1)
-    ||  (aPSName.indexOf("cnit") != -1) )
-        rDFA.SetWidthType(WIDTH_CONDENSED);
-    else if (aPSName.indexOf("narrow") != -1)
-        rDFA.SetWidthType(WIDTH_SEMI_CONDENSED);
-    else if (aPSName.indexOf("expanded") != -1)
-        rDFA.SetWidthType(WIDTH_EXPANDED);
-    else if (aPSName.indexOf("wide") != -1)
-        rDFA.SetWidthType(WIDTH_EXPANDED);
-
-    // heuristics for font pitch
-    if( (aPSName.indexOf("mono") != -1)
-    ||  (aPSName.indexOf("courier") != -1)
-    ||  (aPSName.indexOf("monaco") != -1)
-    ||  (aPSName.indexOf("typewriter") != -1) )
-        rDFA.SetPitch(PITCH_FIXED);
-
-    // heuristics for font family type
-    if( (aPSName.indexOf("script") != -1)
-    ||  (aPSName.indexOf("chancery") != -1)
-    ||  (aPSName.indexOf("zapfino") != -1))
-        rDFA.SetFamilyType(FAMILY_SCRIPT);
-    else if( (aPSName.indexOf("comic") != -1)
-    ||  (aPSName.indexOf("outline") != -1)
-    ||  (aPSName.indexOf("pinpoint") != -1) )
-        rDFA.SetFamilyType(FAMILY_DECORATIVE);
-    else if( (aPSName.indexOf("sans") != -1)
-    ||  (aPSName.indexOf("arial") != -1) )
-        rDFA.SetFamilyType(FAMILY_SWISS);
-    else if( (aPSName.indexOf("roman") != -1)
-    ||  (aPSName.indexOf("times") != -1) )
-        rDFA.SetFamilyType(FAMILY_ROMAN);
-
-    // heuristics for codepoint semantic
-    if( (aPSName.indexOf("symbol") != -1)
-    ||  (aPSName.indexOf("dings") != -1)
-    ||  (aPSName.indexOf("dingbats") != -1)
-    ||  (aPSName.indexOf("ornaments") != -1)
-    ||  (aPSName.indexOf("embellishments") != -1) )
-        rDFA.SetSymbolFlag(true);
-
-   // #i100020# special heuristic for names with single-char styles
-   // NOTE: we are checking name that hasn't been lower-cased
-   if( rPSName.getLength() > 3 )
-   {
-        int i = rPSName.getLength();
-        sal_Unicode c = rPSName[--i];
-        if( c == 'C' ) { // "capitals"
-            rDFA.SetFamilyType(FAMILY_DECORATIVE);
-            c = rPSName[--i];
-        }
-        if( c == 'O' ) { // CFF-based OpenType
-            c = rPSName[--i];
-        }
-        if( c == 'I' ) { // "italic"
-            rDFA.SetItalic(ITALIC_NORMAL);
-            c = rPSName[--i];
-        }
-        if( c == 'B' )   // "bold"
-            rDFA.SetWeight(WEIGHT_BOLD);
-        if( c == 'C' )   // "capitals"
-            rDFA.SetFamilyType(FAMILY_DECORATIVE);
-        // TODO: check that all single-char styles have been resolved?
-    }
-}
-
-// -----------------------------------------------------------------------
-
-#if MACOSX_SDK_VERSION >= 1070
-extern "C" {
-extern ATSFontRef FMGetATSFontRefFromFont(FMFont iFont);
-}
-#endif
-
-static bool GetDevFontAttributes( ATSUFontID nFontID, ImplDevFontAttributes& rDFA )
-{
-    // all ATSU fonts are device fonts that can be directly rotated
-    rDFA.mbOrientation = true;
-    rDFA.mbDevice      = true;
-    rDFA.mnQuality     = 0;
-
-    // reset the attributes
-    rDFA.SetFamilyType(FAMILY_DONTKNOW);
-    rDFA.SetPitch(PITCH_VARIABLE);
-    rDFA.SetWidthType(WIDTH_NORMAL);
-    rDFA.SetWeight(WEIGHT_NORMAL);
-    rDFA.SetItalic(ITALIC_NONE);
-    rDFA.SetSymbolFlag(false);
-
-    // ignore bitmap fonts
-    ATSFontRef rATSFontRef = FMGetATSFontRefFromFont( nFontID );
-    ByteCount nHeadLen = 0;
-    OSStatus rc = ATSFontGetTable( rATSFontRef, 0x68656164/*head*/, 0, 0, NULL, &nHeadLen );
-    if( (rc != noErr) || (nHeadLen <= 0) )
-        return false;
-
-    // all scalable fonts on this platform are subsettable
-    rDFA.mbSubsettable  = true;
-    rDFA.mbEmbeddable   = false;
-
-    // prepare iterating over all name strings of the font
-    ItemCount nFontNameCount = 0;
-    rc = ATSUCountFontNames( nFontID, &nFontNameCount );
-    if( rc != noErr )
-        return false;
-    int nBestNameValue = 0;
-    int nBestStyleValue = 0;
-    FontLanguageCode eBestLangCode = 0;
-    const FontLanguageCode eUILangCode = Application::GetSettings().GetUILanguageTag().getLanguageType();
-    typedef std::vector<char> NameBuffer;
-    NameBuffer aNameBuffer( 256 );
-
-    // iterate over all available name strings of the font
-    for( ItemCount nNameIndex = 0; nNameIndex < nFontNameCount; ++nNameIndex )
-    {
-        ByteCount nNameLength = 0;
-
-        FontNameCode     eFontNameCode;
-        FontPlatformCode eFontNamePlatform;
-        FontScriptCode   eFontNameScript;
-        FontLanguageCode eFontNameLanguage;
-        rc = ATSUGetIndFontName( nFontID, nNameIndex, 0, NULL,
-            &nNameLength, &eFontNameCode, &eFontNamePlatform, &eFontNameScript, &eFontNameLanguage );
-        if( rc != noErr )
-            continue;
-
-        // ignore non-interesting name entries
-        if( (eFontNameCode != kFontFamilyName)
-        &&  (eFontNameCode != kFontStyleName)
-        &&  (eFontNameCode != kFontPostscriptName) )
-            continue;
-
-        // heuristic to find the most common font name
-        // prefering default language names or even better the names matching to the UI language
-        int nNameValue = (eFontNameLanguage==eUILangCode) ? 0 : ((eFontNameLanguage==0) ? -10 : -20);
-        rtl_TextEncoding eEncoding = RTL_TEXTENCODING_UNICODE;
-        const int nPlatformEncoding = ((int)eFontNamePlatform << 8) + (int)eFontNameScript;
-        switch( nPlatformEncoding )
-        {
-            case 0x000: nNameValue += 23; break;    // Unicode 1.0
-            case 0x001: nNameValue += 24; break;    // Unicode 1.1
-            case 0x002: nNameValue += 25; break;    // iso10646_1993
-            case 0x003: nNameValue += 26; break;    // UCS-2
-            case 0x301: nNameValue += 27; break;    // Win UCS-2
-            case 0x004:                             // UCS-4
-            case 0x30A: nNameValue += 0;            // Win-UCS-4
-                        eEncoding = RTL_TEXTENCODING_UCS4;
-                        break;
-            case 0x100: nNameValue += 21;           // Mac Roman
-                        eEncoding = RTL_TEXTENCODING_APPLE_ROMAN;
-                        break;
-            case 0x300: nNameValue =  0;            // Win Symbol encoded name!
-                rDFA.SetSymbolFlag(true);   // (often seen for symbol fonts)
-                        break;
-            default:    nNameValue = 0;             // ignore other encodings
-            break;
-        }
-
-        // ignore name entries with no useful encoding
-        if( nNameValue <= 0 )
-            continue;
-        if( nNameLength >= aNameBuffer.size() )
-            continue;
-
-        // get the encoded name
-        aNameBuffer.reserve( nNameLength+1 ); // extra byte helps for debugging
-        rc = ATSUGetIndFontName( nFontID, nNameIndex, nNameLength, &aNameBuffer[0],
-           &nNameLength, &eFontNameCode, &eFontNamePlatform, &eFontNameScript, &eFontNameLanguage );
-        if( rc != noErr )
-            continue;
-
-        // convert to unicode name
-        OUString aUtf16Name;
-        if( eEncoding == RTL_TEXTENCODING_UNICODE ) // we are just interested in UTF16 encoded names
-            aUtf16Name = OUString( (const sal_Unicode*)&aNameBuffer[0], nNameLength/2 );
-        else if( eEncoding == RTL_TEXTENCODING_UCS4 )
-            aUtf16Name = OUString(); // TODO
-        else // assume the non-unicode encoded names are byte encoded
-            aUtf16Name = OUString( &aNameBuffer[0], nNameLength, eEncoding );
-
-        // ignore empty strings
-        if( aUtf16Name.isEmpty() )
-            continue;
-
-        // handle the name depending on its namecode
-        switch( eFontNameCode )
-        {
-            case kFontFamilyName:
-                // ignore font names starting with '.'
-                if( aUtf16Name[0] == '.' )
-                    nNameValue = 0;
-                else if( !rDFA.GetFamilyName().isEmpty() )
-                {
-                    // even if a family name is not the one we are looking for
-                    // it is still useful as a font name alternative
-                    if( rDFA.maMapNames.getLength() )
-                        rDFA.maMapNames += ";";
-                    rDFA.maMapNames += (nBestNameValue < nNameValue) ? rDFA.GetFamilyName() : aUtf16Name;
-                }
-                if( nBestNameValue < nNameValue )
-                {
-                    // get the best family name
-                    nBestNameValue = nNameValue;
-                    eBestLangCode = eFontNameLanguage;
-                    rDFA.SetFamilyName(aUtf16Name);
-                }
-                break;
-            case kFontStyleName:
-                // get a style name matching to the family name
-                if( nBestStyleValue < nNameValue )
-                {
-                    nBestStyleValue = nNameValue;
-                    rDFA.SetStyleName(aUtf16Name);
-                }
-                break;
-            case kFontPostscriptName:
-                // use the postscript name to get some useful info
-                UpdateAttributesFromPSName( aUtf16Name, rDFA );
-                break;
-            default:
-                // TODO: use other name entries too?
-                break;
-        }
-    }
-
-    bool bRet = (rDFA.GetFamilyName().getLength() > 0);
-    return bRet;
-}
-
-// =======================================================================
-
-SystemFontList::SystemFontList()
-{
-    // count available system fonts
-    ItemCount nATSUICompatibleFontsAvailable = 0;
-    if( ATSUFontCount(&nATSUICompatibleFontsAvailable) != noErr )
-        return;
-    if( nATSUICompatibleFontsAvailable <= 0 )
-       return;
-
-    // enumerate available system fonts
-    typedef std::vector<ATSUFontID> AtsFontIDVector;
-    AtsFontIDVector aFontIDVector( nATSUICompatibleFontsAvailable );
-    ItemCount nFontItemsCount = 0;
-    if( ATSUGetFontIDs( &aFontIDVector[0], aFontIDVector.capacity(), &nFontItemsCount ) != noErr )
-       return;
-
-    BOOST_ASSERT(nATSUICompatibleFontsAvailable == nFontItemsCount && "Strange I would expect them to be equal");
-
-    // prepare use of the available fonts
-    AtsFontIDVector::const_iterator it = aFontIDVector.begin();
-    for(; it != aFontIDVector.end(); ++it )
-    {
-    const ATSUFontID nFontID = *it;
-        ImplDevFontAttributes aDevFontAttr;
-        if( !GetDevFontAttributes( nFontID, aDevFontAttr ) )
-            continue;
-        ImplMacFontData* pFontData = new ImplMacFontData(  aDevFontAttr, nFontID );
-        maFontContainer[ nFontID ] = pFontData;
-    }
-
-    InitGlyphFallbacks();
-}
-
-// -----------------------------------------------------------------------
-
-SystemFontList::~SystemFontList()
-{
-    MacFontContainer::const_iterator it = maFontContainer.begin();
-    for(; it != maFontContainer.end(); ++it )
-        delete (*it).second;
-    maFontContainer.clear();
-
-    ATSUDisposeFontFallbacks( maFontFallbacks );
-}
-
-// -----------------------------------------------------------------------
-
-void SystemFontList::AnnounceFonts( ImplDevFontList& rFontList ) const
-{
-    MacFontContainer::const_iterator it = maFontContainer.begin();
-    for(; it != maFontContainer.end(); ++it )
-        rFontList.Add( (*it).second->Clone() );
-}
-
-// -----------------------------------------------------------------------
-
-// not all fonts are suitable for glyph fallback => sort them
-struct GfbCompare{ bool operator()(const ImplMacFontData*, const ImplMacFontData*); };
-
-inline bool GfbCompare::operator()( const ImplMacFontData* pA, const ImplMacFontData* pB )
-{
-    // use symbol fonts only as last resort
-    bool bPreferA = !pA->IsSymbolFont();
-    bool bPreferB = !pB->IsSymbolFont();
-    if( bPreferA != bPreferB )
-        return bPreferA;
-    // prefer scalable fonts
-    bPreferA = pA->IsScalable();
-    bPreferB = pB->IsScalable();
-    if( bPreferA != bPreferB )
-        return bPreferA;
-    // prefer non-slanted fonts
-    bPreferA = (pA->GetSlant() == ITALIC_NONE);
-    bPreferB = (pB->GetSlant() == ITALIC_NONE);
-    if( bPreferA != bPreferB )
-        return bPreferA;
-    // prefer normal weight fonts
-    bPreferA = (pA->GetWeight() == WEIGHT_NORMAL);
-    bPreferB = (pB->GetWeight() == WEIGHT_NORMAL);
-    if( bPreferA != bPreferB )
-        return bPreferA;
-    // prefer normal width fonts
-    bPreferA = (pA->GetWidthType() == WIDTH_NORMAL);
-    bPreferB = (pB->GetWidthType() == WIDTH_NORMAL);
-    if( bPreferA != bPreferB )
-        return bPreferA;
-    return false;
-}
-
-void SystemFontList::InitGlyphFallbacks()
-{
-    // sort fonts for "glyph fallback"
-    typedef std::multiset<const ImplMacFontData*,GfbCompare> FallbackSet;
-    FallbackSet aFallbackSet;
-    MacFontContainer::const_iterator it = maFontContainer.begin();
-    for(; it != maFontContainer.end(); ++it )
-    {
-    const ImplMacFontData* pIFD = (*it).second;
-    // TODO: subsettable/embeddable glyph fallback only for PDF export?
-        if( pIFD->IsSubsettable() || pIFD->IsEmbeddable() )
-        aFallbackSet.insert( pIFD );
-    }
-
-    // tell ATSU about font preferences for "glyph fallback"
-    typedef std::vector<ATSUFontID> AtsFontIDVector;
-    AtsFontIDVector aFallbackVector;
-    aFallbackVector.reserve( maFontContainer.size() );
-    FallbackSet::const_iterator itFData = aFallbackSet.begin();
-    for(; itFData != aFallbackSet.end(); ++itFData )
-    {
-        const ImplMacFontData* pFontData = (*itFData);
-        ATSUFontID nFontID = (ATSUFontID)pFontData->GetFontId();
-        aFallbackVector.push_back( nFontID );
-    }
-
-    ATSUCreateFontFallbacks( &maFontFallbacks );
-    ATSUSetObjFontFallbacks( maFontFallbacks,
-        aFallbackVector.size(), &aFallbackVector[0], kATSUSequentialFallbacksPreferred );
-}
-
-// -----------------------------------------------------------------------
-
-ImplMacFontData* SystemFontList::GetFontDataFromId( ATSUFontID nFontId ) const
-{
-    MacFontContainer::const_iterator it = maFontContainer.find( nFontId );
-    if( it == maFontContainer.end() )
-    return NULL;
-    return (*it).second;
-}
-
-// -----------------------------------------------------------------------
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/aqua/source/gdi/atsui/salgdi.cxx b/vcl/aqua/source/gdi/atsui/salgdi.cxx
deleted file mode 100644
index cbe3d49..0000000
--- a/vcl/aqua/source/gdi/atsui/salgdi.cxx
+++ /dev/null
@@ -1,1073 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- *   Licensed to the Apache Software Foundation (ASF) under one or more
- *   contributor license agreements. See the NOTICE file distributed
- *   with this work for additional information regarding copyright
- *   ownership. The ASF licenses this file to you under the Apache
- *   License, Version 2.0 (the "License"); you may not use this file
- *   except in compliance with the License. You may obtain a copy of
- *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#include <config_folders.h>
-
-#include "sal/config.h"
-
-#include "osl/file.hxx"
-#include "osl/process.h"
-
-#include "osl/mutex.hxx"
-
-#include "rtl/bootstrap.h"
-#include "rtl/strbuf.hxx"
-
-#include "basegfx/range/b2drectangle.hxx"
-#include "basegfx/polygon/b2dpolygon.hxx"
-#include "basegfx/polygon/b2dpolygontools.hxx"
-#include "basegfx/matrix/b2dhommatrix.hxx"
-#include "basegfx/matrix/b2dhommatrixtools.hxx"
-
-#include "vcl/sysdata.hxx"
-#include "vcl/svapp.hxx"
-
-#include "aqua/atsui/salgdi.h"
-#include "aqua/salframe.h"
-#include "aqua/atsui/salatsuifontutils.hxx"
-
-#include "fontsubset.hxx"
-#include "impfont.hxx"
-#include "sallayout.hxx"
-#include "sft.hxx"
-
-
-using namespace vcl;
-
-//typedef unsigned char Boolean; // copied from MacTypes.h, should be properly included
-typedef std::vector<unsigned char> ByteVector;
-
-
-// ATSUI is deprecated in 10.6 (or already 10.5?)
-#if HAVE_GCC_PRAGMA_DIAGNOSTIC_MODIFY
-#pragma GCC diagnostic warning "-Wdeprecated-declarations"
-#endif
-
-// =======================================================================
-
-ImplMacFontData::ImplMacFontData( const ImplDevFontAttributes& rDFA, ATSUFontID nFontId )
-:   PhysicalFontFace( rDFA, 0 )
-,   mnFontId( nFontId )
-,   mpCharMap( NULL )
-,   mbOs2Read( false )
-,   mbHasOs2Table( false )
-,   mbCmapEncodingRead( false )
-,   mbFontCapabilitiesRead( false )
-{}
-
-// -----------------------------------------------------------------------
-
-ImplMacFontData::~ImplMacFontData()
-{
-    if( mpCharMap )
-        mpCharMap->DeReference();
-}
-
-// -----------------------------------------------------------------------
-
-sal_IntPtr ImplMacFontData::GetFontId() const
-{
-    return (sal_IntPtr)mnFontId;
-}
-
-// -----------------------------------------------------------------------
-
-PhysicalFontFace* ImplMacFontData::Clone() const
-{
-    ImplMacFontData* pClone = new ImplMacFontData(*this);
-    if( mpCharMap )
-        mpCharMap->AddReference();
-    return pClone;
-}
-
-// -----------------------------------------------------------------------
-
-ImplFontEntry* ImplMacFontData::CreateFontInstance(FontSelectPattern& rFSD) const
-{
-    return new ImplFontEntry(rFSD);
-}
-
-// -----------------------------------------------------------------------
-
-inline FourCharCode GetTag(const char aTagName[5])
-{
-    return (aTagName[0]<<24)+(aTagName[1]<<16)+(aTagName[2]<<8)+(aTagName[3]);
-}
-
-static unsigned GetUShort( const unsigned char* p ){return((p[0]<<8)+p[1]);}
-
-#if MACOSX_SDK_VERSION >= 1070
-extern "C" {
-extern ATSFontRef FMGetATSFontRefFromFont(FMFont iFont);
-}
-#endif
-
-const ImplFontCharMap* ImplMacFontData::GetImplFontCharMap() const
-{
-    // return the cached charmap
-    if( mpCharMap )
-        return mpCharMap;
-
-    // set the default charmap
-    mpCharMap = ImplFontCharMap::GetDefaultMap();
-    mpCharMap->AddReference();
-
-    // get the CMAP byte size
-    ATSFontRef rFont = FMGetATSFontRefFromFont( mnFontId );
-    ByteCount nBufSize = 0;
-    OSStatus eStatus = ATSFontGetTable( rFont, GetTag("cmap"), 0, 0, NULL, &nBufSize );
-    DBG_ASSERT( (eStatus==noErr), "ImplMacFontData::GetImplFontCharMap : ATSFontGetTable1 failed!\n");
-    if( eStatus != noErr )
-        return mpCharMap;
-
-    // allocate a buffer for the CMAP raw data
-    ByteVector aBuffer( nBufSize );
-
-    // get the CMAP raw data
-    ByteCount nRawLength = 0;
-    eStatus = ATSFontGetTable( rFont, GetTag("cmap"), 0, nBufSize, (void*)&aBuffer[0], &nRawLength );
-    DBG_ASSERT( (eStatus==noErr), "ImplMacFontData::GetImplFontCharMap : ATSFontGetTable2 failed!\n");
-    if( eStatus != noErr )
-        return mpCharMap;
-    DBG_ASSERT( (nBufSize==nRawLength), "ImplMacFontData::GetImplFontCharMap : ByteCount mismatch!\n");
-
-    // parse the CMAP
-    CmapResult aCmapResult;
-    if( ParseCMAP( &aBuffer[0], nRawLength, aCmapResult ) )
-    {
-        // create the matching charmap
-        mpCharMap->DeReference();
-        mpCharMap = new ImplFontCharMap( aCmapResult );
-        mpCharMap->AddReference();
-    }
-
-    return mpCharMap;
-}
-
-bool ImplMacFontData::GetImplFontCapabilities(vcl::FontCapabilities &rFontCapabilities) const
-{
-    // read this only once per font
-    if( mbFontCapabilitiesRead )
-    {
-        rFontCapabilities = maFontCapabilities;
-        return !rFontCapabilities.maUnicodeRange.empty() || !rFontCapabilities.maCodePageRange.empty();
-    }
-    mbFontCapabilitiesRead = true;
-
-    // prepare to get the GSUB table raw data
-    ATSFontRef rFont = FMGetATSFontRefFromFont( mnFontId );
-    ByteCount nBufSize = 0;
-    OSStatus eStatus;
-    eStatus = ATSFontGetTable( rFont, GetTag("GSUB"), 0, 0, NULL, &nBufSize );
-    if( eStatus == noErr )
-    {
-        // allocate a buffer for the GSUB raw data
-        ByteVector aBuffer( nBufSize );
-        // get the GSUB raw data
-        ByteCount nRawLength = 0;
-        eStatus = ATSFontGetTable( rFont, GetTag("GSUB"), 0, nBufSize, (void*)&aBuffer[0], &nRawLength );
-        if( eStatus == noErr )
-        {
-            const unsigned char* pGSUBTable = &aBuffer[0];
-            vcl::getTTScripts(maFontCapabilities.maGSUBScriptTags, pGSUBTable, nRawLength);
-        }
-    }
-    eStatus = ATSFontGetTable( rFont, GetTag("OS/2"), 0, 0, NULL, &nBufSize );
-    if( eStatus == noErr )
-    {
-        // allocate a buffer for the GSUB raw data
-        ByteVector aBuffer( nBufSize );
-        // get the OS/2 raw data
-        ByteCount nRawLength = 0;
-        eStatus = ATSFontGetTable( rFont, GetTag("OS/2"), 0, nBufSize, (void*)&aBuffer[0], &nRawLength );
-        if( eStatus == noErr )
-        {
-            const unsigned char* pOS2Table = &aBuffer[0];
-            vcl::getTTCoverage(
-                maFontCapabilities.maUnicodeRange,
-                maFontCapabilities.maCodePageRange,
-                pOS2Table, nRawLength);
-        }
-    }
-    rFontCapabilities = maFontCapabilities;
-    return !rFontCapabilities.maUnicodeRange.empty() || !rFontCapabilities.maCodePageRange.empty();
-}
-
-// -----------------------------------------------------------------------
-
-void ImplMacFontData::ReadOs2Table( void ) const
-{
-    // read this only once per font
-    if( mbOs2Read )
-        return;
-    mbOs2Read = true;
-
-    // prepare to get the OS/2 table raw data
-    ATSFontRef rFont = FMGetATSFontRefFromFont( mnFontId );
-    ByteCount nBufSize = 0;
-    OSStatus eStatus = ATSFontGetTable( rFont, GetTag("OS/2"), 0, 0, NULL, &nBufSize );
-    DBG_ASSERT( (eStatus==noErr), "ImplMacFontData::ReadOs2Table : ATSFontGetTable1 failed!\n");
-    if( eStatus != noErr )
-        return;
-
-    // allocate a buffer for the OS/2 raw data
-    ByteVector aBuffer( nBufSize );
-
-    // get the OS/2 raw data
-    ByteCount nRawLength = 0;
-    eStatus = ATSFontGetTable( rFont, GetTag("OS/2"), 0, nBufSize, (void*)&aBuffer[0], &nRawLength );
-    DBG_ASSERT( (eStatus==noErr), "ImplMacFontData::ReadOs2Table : ATSFontGetTable2 failed!\n");
-    if( eStatus != noErr )
-        return;
-    DBG_ASSERT( (nBufSize==nRawLength), "ImplMacFontData::ReadOs2Table : ByteCount mismatch!\n");
-    mbHasOs2Table = true;
-
-    // parse the OS/2 raw data
-    // TODO: also analyze panose info, etc.
-}
-
-void ImplMacFontData::ReadMacCmapEncoding( void ) const
-{
-    // read this only once per font
-    if( mbCmapEncodingRead )
-        return;
-    mbCmapEncodingRead = true;
-
-    ATSFontRef rFont = FMGetATSFontRefFromFont( mnFontId );
-    ByteCount nBufSize = 0;
-    OSStatus eStatus = ATSFontGetTable( rFont, GetTag("cmap"), 0, 0, NULL, &nBufSize );
-    DBG_ASSERT( (eStatus==noErr), "ImplMacFontData::ReadMacCmapEncoding : ATSFontGetTable1 failed!\n");
-    if( eStatus != noErr )
-        return;
-
-    ByteVector aBuffer( nBufSize );
-
-    ByteCount nRawLength = 0;
-    eStatus = ATSFontGetTable( rFont, GetTag("cmap"), 0, nBufSize, (void*)&aBuffer[0], &nRawLength );
-    DBG_ASSERT( (eStatus==noErr), "ImplMacFontData::ReadMacCmapEncoding : ATSFontGetTable2 failed!\n");
-    if( eStatus != noErr )
-        return;
-    DBG_ASSERT( (nBufSize==nRawLength), "ImplMacFontData::ReadMacCmapEncoding : ByteCount mismatch!\n");
-
-    const unsigned char* pCmap = &aBuffer[0];
-
-    if (nRawLength < 24 )
-        return;
-    if( GetUShort( pCmap ) != 0x0000 )
-        return;
-}
-
-// =======================================================================
-
-AquaSalGraphics::AquaSalGraphics()
-    : mpFrame( NULL )
-    , mxLayer( NULL )
-    , mrContext( NULL )
-    , mpXorEmulation( NULL )
-    , mnXorMode( 0 )
-    , mnWidth( 0 )
-    , mnHeight( 0 )
-    , mnBitmapDepth( 0 )
-    , mnRealDPIX( 0 )
-    , mnRealDPIY( 0 )
-    , mfFakeDPIScale( 1.0 )
-    , mxClipPath( NULL )
-    , maLineColor( COL_WHITE )
-    , maFillColor( COL_BLACK )
-    , mpMacFontData( NULL )
-    , mnATSUIRotation( 0 )
-    , mfFontScale( 1.0 )
-    , mfFontStretch( 1.0 )
-    , mbNonAntialiasedText( false )
-    , mbPrinter( false )
-    , mbVirDev( false )
-    , mbWindow( false )
-{
-    // create the style object for font attributes
-    ATSUCreateStyle( &maATSUStyle );
-}
-
-// -----------------------------------------------------------------------
-
-AquaSalGraphics::~AquaSalGraphics()
-{
-    CGPathRelease( mxClipPath );
-    ATSUDisposeStyle( maATSUStyle );
-
-    if( mpXorEmulation )
-        delete mpXorEmulation;
-
-    if( mxLayer )
-        CGLayerRelease( mxLayer );
-    else if( mrContext && mbWindow )
-    {
-        // destroy backbuffer bitmap context that we created ourself
-        CGContextRelease( mrContext );
-        mrContext = NULL;
-    }
-}
-
-// =======================================================================
-
-void AquaSalGraphics::SetTextColor( SalColor nSalColor )
-{
-    RGBColor color;
-    color.red     = (unsigned short) ( SALCOLOR_RED(nSalColor)   * 65535.0 / 255.0 );
-    color.green   = (unsigned short) ( SALCOLOR_GREEN(nSalColor) * 65535.0 / 255.0 );
-    color.blue    = (unsigned short) ( SALCOLOR_BLUE(nSalColor)  * 65535.0 / 255.0 );
-
-    ATSUAttributeTag aTag = kATSUColorTag;
-    ByteCount aValueSize = sizeof( color );
-    ATSUAttributeValuePtr aValue = &color;
-
-    OSStatus err = ATSUSetAttributes( maATSUStyle, 1, &aTag, &aValueSize, &aValue );
-    DBG_ASSERT( (err==noErr), "AquaSalGraphics::SetTextColor() : Could not set font attributes!\n");
-    if( err != noErr )
-        return;
-}
-
-// -----------------------------------------------------------------------
-
-void AquaSalGraphics::GetFontMetric( ImplFontMetricData* pMetric, int nFallbackLevel )
-{
-    (void)nFallbackLevel; // glyph-fallback on ATSU is done differently -> no fallback level
-
-    // get the ATSU font metrics (in point units)
-    // of the font that has eventually been size-limited
-
-    ATSUFontID fontId;
-    OSStatus err = ATSUGetAttribute( maATSUStyle, kATSUFontTag, sizeof(ATSUFontID), &fontId, 0 );
-    DBG_ASSERT( (err==noErr), "AquaSalGraphics::GetFontMetric() : could not get font id\n");
-
-    ATSFontMetrics aMetrics;
-    ATSFontRef rFont = FMGetATSFontRefFromFont( fontId );
-    err = ATSFontGetHorizontalMetrics ( rFont, kATSOptionFlagsDefault, &aMetrics );
-    DBG_ASSERT( (err==noErr), "AquaSalGraphics::GetFontMetric() : could not get font metrics\n");
-    if( err != noErr )
-        return;
-
-    // all ATS fonts are scalable fonts
-    pMetric->mbScalableFont = true;
-    // TODO: check if any kerning is possible
-    pMetric->mbKernableFont = true;
-
-    // convert into VCL font metrics (in unscaled pixel units)
-
-    Fixed ptSize;
-    err = ATSUGetAttribute( maATSUStyle, kATSUSizeTag, sizeof(Fixed), &ptSize, 0);
-    DBG_ASSERT( (err==noErr), "AquaSalGraphics::GetFontMetric() : could not get font size\n");
-    const double fPointSize = Fix2X( ptSize );
-
-    // convert quartz units to pixel units
-    // please see the comment in AquaSalGraphics::SetFont() for details
-    const double fPixelSize = (mfFontScale * mfFakeDPIScale * fPointSize);
-    pMetric->mnAscent       = static_cast<long>(+aMetrics.ascent  * fPixelSize + 0.5);
-    pMetric->mnDescent      = static_cast<long>(-aMetrics.descent * fPixelSize + 0.5);
-    const long nExtDescent  = static_cast<long>((-aMetrics.descent + aMetrics.leading) * fPixelSize + 0.5);
-    pMetric->mnExtLeading   = nExtDescent - pMetric->mnDescent;
-    pMetric->mnIntLeading   = 0;
-    // ATSFontMetrics.avgAdvanceWidth is obsolete, so it is usually set to zero
-    // since ImplFontMetricData::mnWidth is only used for stretching/squeezing fonts
-    // setting this width to the pixel height of the fontsize is good enough
-    // it also makes the calculation of the stretch factor simple
-    pMetric->mnWidth        = static_cast<long>(mfFontStretch * fPixelSize + 0.5);
-}
-
-// -----------------------------------------------------------------------
-
-static bool AddTempFontDir( const char* pDir )
-{
-    FSRef aPathFSRef;
-    Boolean bIsDirectory = true;
-    OSStatus eStatus = FSPathMakeRef( reinterpret_cast<const UInt8*>(pDir), &aPathFSRef, &bIsDirectory );
-    DBG_ASSERTWARNING( (eStatus==noErr) && bIsDirectory, "vcl AddTempFontDir() with invalid directory name!" );
-    if( eStatus != noErr )
-        return false;
-
-    // TODO: deactivate ATSFontContainerRef when closing app
-    ATSFontContainerRef aATSFontContainer;
-
-    const ATSFontContext eContext = kATSFontContextLocal; // TODO: *Global???
-    eStatus = ::ATSFontActivateFromFileReference( &aPathFSRef,
-        eContext, kATSFontFormatUnspecified, NULL, kATSOptionFlagsDefault,
-        &aATSFontContainer );
-    if( eStatus != noErr )
-        return false;
-
-    return true;
-}
-
-static bool AddLocalTempFontDirs( void )
-{
-    static bool bFirst = true;
-    if( !bFirst )
-        return false;
-    bFirst = false;
-
-    // add private font files
-
-    OUString aBrandStr( "$BRAND_BASE_DIR" );
-    rtl_bootstrap_expandMacros( &aBrandStr.pData );
-    OUString aBrandSysPath;
-    OSL_VERIFY( osl_getSystemPathFromFileURL( aBrandStr.pData, &aBrandSysPath.pData ) == osl_File_E_None );
-
-    OStringBuffer aBrandFontDir( aBrandSysPath.getLength()*2 );
-    aBrandFontDir.append( OUStringToOString( aBrandSysPath, RTL_TEXTENCODING_UTF8 ) );
-    aBrandFontDir.append( "/" LIBO_SHARE_FOLDER "/fonts/truetype/" );
-    return AddTempFontDir( aBrandFontDir.getStr() );
-}
-
-void AquaSalGraphics::GetDevFontList( ImplDevFontList* pFontList )
-{
-    DBG_ASSERT( pFontList, "AquaSalGraphics::GetDevFontList(NULL) !");
-
-    AddLocalTempFontDirs();
-
-    // The idea is to cache the list of system fonts once it has been generated.
-    // SalData seems to be a good place for this caching. However we have to
-    // carefully make the access to the font list thread-safe. If we register
-    // a font-change event handler to update the font list in case fonts have
-    // changed on the system we have to lock access to the list. The right
-    // way to do that is the solar mutex since GetDevFontList is protected
-    // through it as should be all event handlers
-
-    SalData* pSalData = GetSalData();
-    if (pSalData->mpFontList == NULL)
-        pSalData->mpFontList = new SystemFontList();
-
-    // Copy all PhysicalFontFace objects contained in the SystemFontList
-    pSalData->mpFontList->AnnounceFonts( *pFontList );
-}
-
-void AquaSalGraphics::ClearDevFontCache()
-{
-    SalData* pSalData = GetSalData();
-    delete pSalData->mpFontList;
-    pSalData->mpFontList = NULL;
-}
-
-// -----------------------------------------------------------------------
-
-bool AquaSalGraphics::AddTempDevFont( ImplDevFontList*,
-    const OUString& rFontFileURL, const OUString& /*rFontName*/ )
-{
-    OUString aUSytemPath;
-    OSL_VERIFY( !osl::FileBase::getSystemPathFromFileURL( rFontFileURL, aUSytemPath ) );
-
-    FSRef aNewRef;
-    Boolean bIsDirectory = true;
-    OString aCFileName = OUStringToOString( aUSytemPath, RTL_TEXTENCODING_UTF8 );
-    OSStatus eStatus = FSPathMakeRef( (UInt8*)aCFileName.getStr(), &aNewRef, &bIsDirectory );
-    DBG_ASSERT( (eStatus==noErr) && !bIsDirectory, "vcl AddTempDevFont() with invalid fontfile name!" );
-    if( eStatus != noErr )
-        return false;
-
-    ATSFontContainerRef oContainer;
-
-    const ATSFontContext eContext = kATSFontContextLocal; // TODO: *Global???
-    eStatus = ::ATSFontActivateFromFileReference( &aNewRef,
-        eContext, kATSFontFormatUnspecified, NULL, kATSOptionFlagsDefault,
-        &oContainer );
-    if( eStatus != noErr )
-        return false;
-
-    // TODO: ATSFontDeactivate( oContainer ) when fonts are no longer needed
-    // TODO: register new ImplMacFontdata in pFontList
-    return true;
-}
-
-// -----------------------------------------------------------------------
-
-// callbacks from ATSUGlyphGetCubicPaths() fore GetGlyphOutline()
-struct GgoData { basegfx::B2DPolygon maPolygon; basegfx::B2DPolyPolygon* mpPolyPoly; };
-
-static OSStatus GgoLineToProc( const Float32Point* pPoint, void* pData )
-{
-    basegfx::B2DPolygon& rPolygon = static_cast<GgoData*>(pData)->maPolygon;
-    const basegfx::B2DPoint aB2DPoint( pPoint->x, pPoint->y );
-    rPolygon.append( aB2DPoint );
-    return noErr;
-}
-
-static OSStatus GgoCurveToProc( const Float32Point* pCP1, const Float32Point* pCP2,
-    const Float32Point* pPoint, void* pData )
-{
-    basegfx::B2DPolygon& rPolygon = static_cast<GgoData*>(pData)->maPolygon;
-    const sal_uInt32 nPointCount = rPolygon.count();
-    const basegfx::B2DPoint aB2DControlPoint1( pCP1->x, pCP1->y );
-    rPolygon.setNextControlPoint( nPointCount-1, aB2DControlPoint1 );
-    const basegfx::B2DPoint aB2DEndPoint( pPoint->x, pPoint->y );
-    rPolygon.append( aB2DEndPoint );
-    const basegfx::B2DPoint aB2DControlPoint2( pCP2->x, pCP2->y );
-    rPolygon.setPrevControlPoint( nPointCount, aB2DControlPoint2 );
-    return noErr;
-}
-
-static OSStatus GgoClosePathProc( void* pData )
-{
-    GgoData* pGgoData = static_cast<GgoData*>(pData);
-    basegfx::B2DPolygon& rPolygon = pGgoData->maPolygon;
-    if( rPolygon.count() > 0 )
-        pGgoData->mpPolyPoly->append( rPolygon );
-    rPolygon.clear();
-    return noErr;
-}
-
-static OSStatus GgoMoveToProc( const Float32Point* pPoint, void* pData )
-{
-    GgoClosePathProc( pData );
-    OSStatus eStatus = GgoLineToProc( pPoint, pData );
-    return eStatus;
-}
-
-sal_Bool AquaSalGraphics::GetGlyphOutline( sal_GlyphId nGlyphId, basegfx::B2DPolyPolygon& rPolyPoly )
-{
-    GgoData aGgoData;
-    aGgoData.mpPolyPoly = &rPolyPoly;
-    rPolyPoly.clear();
-
-    ATSUStyle rATSUStyle = maATSUStyle; // TODO: handle glyph fallback when CWS pdffix02 is integrated
-    GlyphID aGlyphId = nGlyphId & GF_IDXMASK;
-    OSStatus eGgoStatus = noErr;
-    OSStatus eStatus = ATSUGlyphGetCubicPaths( rATSUStyle, aGlyphId,
-        GgoMoveToProc, GgoLineToProc, GgoCurveToProc, GgoClosePathProc,
-        &aGgoData, &eGgoStatus );
-    if( (eStatus != noErr) ) // TODO: why is (eGgoStatus!=noErr) when curves are involved?
-        return false;
-
-    GgoClosePathProc( &aGgoData );
-    if( mfFontScale != 1.0 ) {
-        rPolyPoly.transform(basegfx::tools::createScaleB2DHomMatrix(+mfFontScale, +mfFontScale));
-    }
-    return true;
-}
-
-// -----------------------------------------------------------------------
-
-sal_Bool AquaSalGraphics::GetGlyphBoundRect( sal_GlyphId nGlyphId, Rectangle& rRect )
-{
-    ATSUStyle rATSUStyle = maATSUStyle; // TODO: handle glyph fallback
-    GlyphID aGlyphId = nGlyphId & GF_IDXMASK;
-    ATSGlyphScreenMetrics aGlyphMetrics;
-    OSStatus eStatus = ATSUGlyphGetScreenMetrics( rATSUStyle,
-        1, &aGlyphId, 0, FALSE, !mbNonAntialiasedText, &aGlyphMetrics );
-    if( eStatus != noErr )
-        return false;
-
-    const long nMinX = (long)(+aGlyphMetrics.topLeft.x * mfFontScale + 0.5);
-    const long nMinY = (long)(-aGlyphMetrics.topLeft.y * mfFontScale + 0.5);
-    const long nWidth  = (long)(aGlyphMetrics.width * mfFontScale + 0.5);
-    const long nHeight = (long)(aGlyphMetrics.height * mfFontScale + 0.5);
-    Rectangle aRect(Point(nMinX, nMinY), Size(nWidth, nHeight));
-
-    if ( mnATSUIRotation == 0 )
-        rRect = aRect;
-    else
-    {
-        const double fRadians = mnATSUIRotation * (M_PI/0xB40000);
-        const double nSin = sin( fRadians );
-        const double nCos = cos( fRadians );
-
-        rRect.Left() =  nCos*aRect.Left() + nSin*aRect.Top();
-        rRect.Top()  = -nSin*aRect.Left() - nCos*aRect.Top();
-
-        rRect.Right()  =  nCos*aRect.Right() + nSin*aRect.Bottom();
-        rRect.Bottom() = -nSin*aRect.Right() - nCos*aRect.Bottom();
-    }
-
-    return true;
-}
-
-// -----------------------------------------------------------------------
-
-void AquaSalGraphics::DrawServerFontLayout( const ServerFontLayout& )
-{
-}
-
-// -----------------------------------------------------------------------
-
-sal_uInt16 AquaSalGraphics::SetFont( FontSelectPattern* pReqFont, int /*nFallbackLevel*/ )
-{
-    if( !pReqFont )
-    {
-        ATSUClearStyle( maATSUStyle );
-        mpMacFontData = NULL;
-        return 0;
-    }
-
-    // store the requested device font entry
-    const ImplMacFontData* pMacFont = static_cast<const ImplMacFontData*>( pReqFont->mpFontData );
-    mpMacFontData = pMacFont;
-
-    // convert pixel units (as seen by upper layers) to typographic point units
-    double fScaledAtsHeight = pReqFont->mfExactHeight;
-    // avoid Fixed16.16 overflows by limiting the ATS font size
-    static const float fMaxAtsHeight = 144.0;
-    if( fScaledAtsHeight <= fMaxAtsHeight )
-        mfFontScale = 1.0;
-    else
-    {
-        mfFontScale = fScaledAtsHeight / fMaxAtsHeight;
-        fScaledAtsHeight = fMaxAtsHeight;
-    }
-    Fixed fFixedSize = FloatToFixed( fScaledAtsHeight );
-    // enable bold-emulation if needed
-    Boolean bFakeBold = FALSE;
-    if( (pReqFont->GetWeight() >= WEIGHT_BOLD)
-    &&  (pMacFont->GetWeight() < WEIGHT_SEMIBOLD) )
-        bFakeBold = TRUE;
-    // enable italic-emulation if needed
-    Boolean bFakeItalic = FALSE;
-    if( ((pReqFont->GetSlant() == ITALIC_NORMAL) || (pReqFont->GetSlant() == ITALIC_OBLIQUE))
-    && !((pMacFont->GetSlant() == ITALIC_NORMAL) || (pMacFont->GetSlant() == ITALIC_OBLIQUE)) )
-        bFakeItalic = TRUE;
-
-    // enable/disable antialiased text
-    mbNonAntialiasedText = pReqFont->mbNonAntialiased;
-    UInt32 nStyleRenderingOptions = kATSStyleNoOptions;
-    if( pReqFont->mbNonAntialiased )
-        nStyleRenderingOptions |= kATSStyleNoAntiAliasing;
-
-    // set horizontal/vertical mode
-    ATSUVerticalCharacterType aVerticalCharacterType = kATSUStronglyHorizontal;
-    if( pReqFont->mbVertical )
-        aVerticalCharacterType = kATSUStronglyVertical;
-
-    // prepare ATS-fontid as type matching to the kATSUFontTag request
-    ATSUFontID nFontID = static_cast<ATSUFontID>(pMacFont->GetFontId());
-
-    // update ATSU style attributes with requested font parameters
-    // TODO: no need to set styles which are already defaulted
-
-    const ATSUAttributeTag aTag[] =
-    {
-        kATSUFontTag,
-        kATSUSizeTag,
-        kATSUQDBoldfaceTag,
-        kATSUQDItalicTag,
-        kATSUStyleRenderingOptionsTag,
-        kATSUVerticalCharacterTag
-    };
-
-    const ByteCount aValueSize[] =
-    {
-        sizeof(ATSUFontID),
-        sizeof(fFixedSize),
-        sizeof(bFakeBold),
-        sizeof(bFakeItalic),
-        sizeof(nStyleRenderingOptions),
-        sizeof(aVerticalCharacterType)
-    };
-
-    const ATSUAttributeValuePtr aValue[] =
-    {
-        &nFontID,
-        &fFixedSize,
-        &bFakeBold,
-        &bFakeItalic,
-        &nStyleRenderingOptions,
-        &aVerticalCharacterType
-    };
-
-    static const int nTagCount = SAL_N_ELEMENTS(aTag);
-    OSStatus eStatus = ATSUSetAttributes( maATSUStyle, nTagCount,
-                             aTag, aValueSize, aValue );
-    // reset ATSUstyle if there was an error
-    if( eStatus != noErr )
-    {
-        DBG_WARNING( "AquaSalGraphics::SetFont() : Could not set font attributes!\n");
-        ATSUClearStyle( maATSUStyle );
-        mpMacFontData = NULL;
-        return 0;
-    }
-
-    // prepare font stretching
-    const ATSUAttributeTag aMatrixTag = kATSUFontMatrixTag;
-    if( (pReqFont->mnWidth == 0) || (pReqFont->mnWidth == pReqFont->mnHeight) )
-    {
-        mfFontStretch = 1.0;
-        ATSUClearAttributes( maATSUStyle, 1, &aMatrixTag );
-    }
-    else
-    {
-        mfFontStretch = (float)pReqFont->mnWidth / pReqFont->mnHeight;
-        CGAffineTransform aMatrix = CGAffineTransformMakeScale( mfFontStretch, 1.0F );
-        const ATSUAttributeValuePtr aAttr = &aMatrix;
-        const ByteCount aMatrixBytes = sizeof(aMatrix);
-        eStatus = ATSUSetAttributes( maATSUStyle, 1, &aMatrixTag, &aMatrixBytes, &aAttr );
-        DBG_ASSERT( (eStatus==noErr), "AquaSalGraphics::SetFont() : Could not set font matrix\n");
-    }
-
-    // prepare font rotation
-    mnATSUIRotation = FloatToFixed( pReqFont->mnOrientation / 10.0 );
-
-#if OSL_DEBUG_LEVEL > 3
-    fprintf( stderr, "SetFont to (\"%s\", \"%s\", fontid=%d) for (\"%s\" \"%s\" weight=%d, slant=%d size=%dx%d orientation=%d)\n",
-             OUStringToOString( pMacFont->GetFamilyName(), RTL_TEXTENCODING_UTF8 ).getStr(),
-             OUStringToOString( pMacFont->GetStyleName(), RTL_TEXTENCODING_UTF8 ).getStr(),
-             (int)nFontID,
-             OUStringToOString( pReqFont->GetFamilyName(), RTL_TEXTENCODING_UTF8 ).getStr(),
-             OUStringToOString( pReqFont->GetStyleName(), RTL_TEXTENCODING_UTF8 ).getStr(),
-             pReqFont->GetWeight(),
-             pReqFont->GetSlant(),
-             pReqFont->mnHeight,
-             pReqFont->mnWidth,
-             pReqFont->mnOrientation);
-#endif
-
-    return 0;
-}
-
-// -----------------------------------------------------------------------
-
-const ImplFontCharMap* AquaSalGraphics::GetImplFontCharMap() const
-{
-    if( !mpMacFontData )
-        return ImplFontCharMap::GetDefaultMap();
-
-    return mpMacFontData->GetImplFontCharMap();
-}
-
-bool AquaSalGraphics::GetImplFontCapabilities(vcl::FontCapabilities &rFontCapabilities) const
-{

... etc. - the rest is truncated


More information about the Libreoffice-commits mailing list