summaryrefslogtreecommitdiff
path: root/vcl/aqua
diff options
context:
space:
mode:
authorBabak Mahbod <bmahbod@openoffice.org>2001-03-12 22:15:32 +0000
committerBabak Mahbod <bmahbod@openoffice.org>2001-03-12 22:15:32 +0000
commit6c780f6fe46394126da255b3c3c88a03ea735550 (patch)
tree2cf59de905cc6074ceacecabe70489fa11d66634 /vcl/aqua
parent70e4341dad560363cc5d753aebdf982787425b7e (diff)
ATSUI utility APIs for retriving, and sorting fonts by platform, language, script, family, and style.
Incorportated the ATSUI APIs into SAL font utiliy methods. Isolated the necessay headers and then updated all SAL headers. Updated SAL math utility APIs
Diffstat (limited to 'vcl/aqua')
-rw-r--r--vcl/aqua/inc/salatsuifontutils.hxx279
-rwxr-xr-xvcl/aqua/inc/salcolorutils.hxx39
-rw-r--r--vcl/aqua/inc/saldata.hxx71
-rw-r--r--vcl/aqua/inc/salfontutils.hxx93
-rw-r--r--vcl/aqua/inc/salgdi.h31
-rwxr-xr-xvcl/aqua/inc/salmathutils.hxx34
-rwxr-xr-xvcl/aqua/inc/salpixmaputils.hxx49
-rw-r--r--vcl/aqua/inc/salvd.h51
-rw-r--r--vcl/aqua/source/gdi/makefile.mk8
-rw-r--r--vcl/aqua/source/gdi/salatsuifontutils.cxx2142
-rw-r--r--vcl/aqua/source/gdi/salbmp.cxx44
-rwxr-xr-xvcl/aqua/source/gdi/salcolorutils.cxx14
-rw-r--r--vcl/aqua/source/gdi/salgdi.cxx91
-rwxr-xr-xvcl/aqua/source/gdi/salgdiutils.cxx26
-rwxr-xr-xvcl/aqua/source/gdi/salmathutils.cxx42
-rwxr-xr-xvcl/aqua/source/gdi/salpixmaputils.cxx14
-rw-r--r--vcl/aqua/source/gdi/salvd.cxx14
17 files changed, 2823 insertions, 219 deletions
diff --git a/vcl/aqua/inc/salatsuifontutils.hxx b/vcl/aqua/inc/salatsuifontutils.hxx
new file mode 100644
index 000000000000..1ec4930ab217
--- /dev/null
+++ b/vcl/aqua/inc/salatsuifontutils.hxx
@@ -0,0 +1,279 @@
+/*************************************************************************
+ *
+ * $RCSfile: salatsuifontutils.hxx,v $
+ *
+ * $Revision: 1.1 $
+ * last change: $Author: bmahbod $ $Date: 2001-03-12 23:15:30 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (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.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2001 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+// =======================================================================
+
+// =======================================================================
+
+#ifndef _SV_SALATSUIFONTUTILS_HXX
+#define _SV_SALATSUIFONTUTILS_HXX
+
+#ifndef _LIMITS_H
+ #include <limits.h>
+#endif
+
+#ifndef _STDDEF_H
+ #include <stddef.h>
+#endif
+
+#ifndef _STDIO_H
+ #include <stdio.h>
+#endif
+
+#ifndef _STDLIB_H
+ #include <stdlib.h>
+#endif
+
+#ifndef _STRING_H
+ #include <string.h>
+#endif
+
+#include <premac.h>
+
+ #ifndef __MACERRORS__ #include <CarbonCore/MacErrors.h>
+ #endif
+
+ #ifndef __MACTYPES__
+ #include <CarbonCore/MacTypes.h>
+ #endif
+
+ #ifndef __MACMEMORY__
+ #include <CarbonCore/MacMemory.h>
+ #endif
+
+ #ifndef __SCRIPT__
+ #include <CarbonCore/Script.h>
+ #endif
+
+ #ifndef __STRINGCOMPARE__
+ #include <CarbonCore/StringCompare.h>
+ #endif
+
+ #if (ATSU_TARG_VERSION >= ATSU_1_2)
+ #ifndef __UNICODEUTILITIES__
+ #include <CarbonCore/UnicodeUtilities.h>
+ #endif
+ #endif
+
+ #ifndef __MENUS__
+ #include <HIToolbox/Menus.h>
+ #endif
+
+ #ifndef __ATSUNICODE__ #include <QD/ATSUnicode.h>
+ #endif
+
+ #ifndef __FONTS__
+ #include <QD/Fonts.h>
+ #endif
+
+#include <postmac.h>
+
+#if PRAGMA_ONCE #pragma once #endif #ifdef __cplusplus extern "C" { #endif // =======================================================================
+
+// =======================================================================
+
+const short kMacOSCharSize = sizeof(char);
+ // -----------------------------------------------------------------------
+
+const short kFontFamilyNameLength = 32; const short kFontStyleNameLength = 32;
+ const long kFontFamilyNameMemSize = kFontFamilyNameLength * kMacOSCharSize;
+const long kFontStyleNameMemSize = kFontStyleNameLength * kMacOSCharSize;
+
+// -----------------------------------------------------------------------
+
+// To have fonts show up in a different style than the actual menu fonts
+// one must change this value.
+
+const short kATSUIFontInstanceMenuItemStyle = 0;
+
+// -----------------------------------------------------------------------
+
+// For simplicity, only this number of font axis variations are considered.
+
+const short kATSUIMaxVariations = 32;
+
+// -----------------------------------------------------------------------
+
+// To filter out invisible fonts
+
+const char kInvalidFontNamePrefixPeriodSign = '.';
+const char kInvalidFontNamePrefixPercentSign = '%';
+
+// -----------------------------------------------------------------------
+
+const SInt16 kMenuBufferMaxLength = 255;
+const MacOSStringPtr kMenuItemGenericName = "\pGeneric text";
+
+// =======================================================================
+
+// =======================================================================
+
+enum
+{
+ kATSUIDefaultInstance = SHRT_MAX,
+ kATSUINotAnInstance = -1
+};
+
+// =======================================================================
+
+// =======================================================================
+
+typedef short ATSUIInstanceIndex; // ----------------------------------------------------------------------- struct FontNameEncodingRecord { FontPlatformCode mnFontPlatformCode; FontScriptCode mnFontScriptCode; FontLanguageCode mnFontLanguageCode; ItemCount mnFontItemCount; }; typedef struct FontNameEncodingRecord FontNameEncodingRecord; typedef FontNameEncodingRecord *FontNameEncodingPtr; typedef FontNameEncodingPtr *FontNameEncodingMatrix; // ----------------------------------------------------------------------- struct FontNamesRecord { ATSUFontID mnFontID; FontNameEncodingRecord maFontFamilyNameEncoding; FontNameEncodingRecord maFontStyleNameEncoding; ATSUIInstanceIndex mnFontInstanceIndex; ByteOffset mnFontStyleByteOffset; char mpFontName[ 1 ]; }; typedef struct FontNamesRecord FontNamesRecord; typedef FontNamesRecord *FontNamesPtr; typedef FontNamesPtr *FontNamesMatrix; // ----------------------------------------------------------------------- struct FontMenuItemRecord { short mnFontMenuID; short mnFontItemNum; ATSUFontID mnFontID; ATSUIInstanceIndex mnFontInstanceIndex; }; typedef struct FontMenuItemRecord FontMenuItemRecord; typedef FontMenuItemRecord *FontMenuItemPtr; typedef FontMenuItemPtr *FontMenuItemsHandle; // =======================================================================
+
+// =======================================================================
+
+// Note that the macro that follows evaluates pref twice.
+
+#define ElementMatches( elem, pref ) ((pref) == -1 || (elem) == (pref))
+
+#define EncodingMatchesPrefs( enc, prefs ) \
+ ( ElementMatches((enc).mnFontPlatformCode, (prefs).mnFontPlatformCode) \
+ && ElementMatches((enc).mnFontScriptCode, (prefs).mnFontScriptCode) \
+ && ElementMatches((enc).mnFontLanguageCode, (prefs).mnFontLanguageCode) )
+
+// -----------------------------------------------------------------------
+
+#define ATSUISetFont( aFontStyle, nFontID ) \
+ ATSUISetIntAttribute( aFontStyle, nFontID, kATSUFontTag )
+
+#define ATSUIGetFont( aFontStyle, rFontID ) \
+ ATSUIGetOneAttribute( aFontStyle, kATSUFontTag, sizeof(ATSUFontID), rFontID )
+
+// -----------------------------------------------------------------------
+
+#define ATSUICountStyleFontVariations( aFontStyle, oActualVariationCount ) \
+ ATSUGetAllFontVariations( aFontStyle, 0, NULL, NULL, oActualVariationCount )
+
+// =======================================================================
+
+// =======================================================================
+
+OSStatus ATSUIAppendFontMenu( MenuHandle hFontMenu,
+ short nHierarchiaFontMenuID,
+ short *rSubmenuCount,
+ void **hFontMenuLookupCookie
+ );
+
+OSStatus ATSUIDisposeFontNames( const ItemCount nFontListLength,
+ FontNamesMatrix hFontNames
+ );
+
+OSStatus ATSUIDisposeFontMenuLookupCookie( void *pMenuLookupCookie );
+
+OSStatus ATSUIFindBestFontName( ATSUFontID nFontID,
+ FontNameCode nFontNameCode,
+ FontPlatformCode *rFontPlatformCode,
+ FontScriptCode *rFontScriptCode,
+ FontLanguageCode *rFontLanguageCode,
+ ByteCount nFontMaxNameLength,
+ MacOSPtr rFontName,
+ ByteCount *rFontNameLength,
+ ItemCount *rFontNameIndex
+ );
+
+OSStatus ATSUIFONDtoFontID( short nFONDNumber,
+ StyleParameter nFONDStyle,
+ ATSUFontID *rFontID,
+ StyleParameter *rIntrinsicStyleParameter
+ );
+
+ATSUFontID ATSUIGetFontForFontMenuItem( short nMenuID,
+ short nMenuItemNum,
+ void *pMenuLookupCookie,
+ ATSUIInstanceIndex *pFontInstance
+ );
+
+void ATSUIFPrintFontList( const char *pFileName,
+ const char *pFilePermission,
+ const ItemCount nFontItemsCount,
+ FontNamesMatrix hFontList
+ );
+
+FontNamesMatrix ATSUIGetFontNames( ItemCount *rSortedFontListLength );
+
+OSStatus ATSUIGetOneAttribute( ATSUStyle aFontStyle,
+ ATSUAttributeTag nFontAttributeTag,
+ ByteCount nFontExpValueSize,
+ ATSUAttributeValuePtr rFontAttributeValue
+ );
+
+OSStatus ATSUIGetStyleFontInstance( ATSUStyle aFontStyle,
+ ATSUFontID *rFontID,
+ ATSUIInstanceIndex *rFontInstanceIndex
+ );
+
+OSStatus ATSUISetIntAttribute( ATSUStyle aFontStyle,
+ SInt32 nFontAttributeValue,
+ ATSUAttributeTag nFontAttributeTag
+ );
+
+OSStatus ATSUISetStyleFontInstance( ATSUStyle aFontStyle,
+ ATSUFontID nFontID,
+ ATSUIInstanceIndex nFontInstanceIndex
+ );
+
+void ATSUIPrintFontList( const ItemCount nFontItemsCount,
+ FontNamesMatrix hFontList
+ );
+
+// =======================================================================
+
+// ======================================================================= #ifdef __cplusplus } #endif #endif // _SV_SALATSUIFONTUTILS_HXX
+
diff --git a/vcl/aqua/inc/salcolorutils.hxx b/vcl/aqua/inc/salcolorutils.hxx
index 69d540cd9bd2..d73e0c906933 100755
--- a/vcl/aqua/inc/salcolorutils.hxx
+++ b/vcl/aqua/inc/salcolorutils.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: salcolorutils.hxx,v $
*
- * $Revision: 1.2 $
+ * $Revision: 1.3 $
*
- * last change: $Author: pluby $ $Date: 2001-03-10 22:30:00 $
+ * last change: $Author: bmahbod $ $Date: 2001-03-12 23:15:31 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -62,19 +62,46 @@
#ifndef _SV_SALCOLORUTILS_HXX
#define _SV_SALCOLORUTILS_HXX
+#ifndef _LIMITS_H
+ #include <limits.h>
+#endif
+
#include <premac.h>
-#include <ApplicationServices/ApplicationServices.h>
+
+ #ifndef __MACERRORS__ #include <CarbonCore/MacErrors.h>
+ #endif
+
+ #ifndef __MACTYPES__
+ #include <CarbonCore/MacTypes.h>
+ #endif
+
+ #ifndef __MACMEMORY__
+ #include <CarbonCore/MacMemory.h>
+ #endif
+
+ #ifndef __QUICKDRAW__
+ #include <QD/Quickdraw.h>
+ #endif
+
#include <postmac.h>
#ifndef _SV_SALBTYPE_HXX
-#include <salbtype.hxx>
+ #include <salbtype.hxx>
#endif
#ifndef _SV_SALGTYPE_HXX
-#include <salgtype.hxx>
+ #include <salgtype.hxx>
#endif
-// ------------------------------------------------------------------
+#ifndef _SV_SALCONST_H
+ #include <salconst.h>
+#endif
+
+#ifndef _SV_SALMATHUTILS_HXX
+ #include <salmathutils.hxx>
+#endif
+
+#if PRAGMA_ONCE #pragma once #endif // ------------------------------------------------------------------
SalColor RGBColor2SALColor ( const RGBColor *pRGBColor );
diff --git a/vcl/aqua/inc/saldata.hxx b/vcl/aqua/inc/saldata.hxx
index 7980bc1c8cb2..e3155110a7da 100644
--- a/vcl/aqua/inc/saldata.hxx
+++ b/vcl/aqua/inc/saldata.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: saldata.hxx,v $
*
- * $Revision: 1.9 $
+ * $Revision: 1.10 $
*
- * last change: $Author: pluby $ $Date: 2001-01-03 21:29:20 $
+ * last change: $Author: bmahbod $ $Date: 2001-03-12 23:15:31 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -63,37 +63,41 @@
#define _SV_SALDATA_HXX
#ifndef _SV_SV_H
-#include <sv.h>
+ #include <sv.h>
#endif
#ifdef __cplusplus
-#ifndef _SV_SVDATA_HXX
-#include <svdata.hxx>
-#endif
+ #ifndef _SV_SVDATA_HXX
+ #include <svdata.hxx>
+ #endif
#endif // __cplusplus
#ifndef _SV_SALWTYPE_HXX
-#include <salwtype.hxx>
+ #include <salwtype.hxx>
#endif
+
#ifndef _SV_VCLWINDOW_H
-#include <VCLWindow.h>
+ #include <VCLWindow.h>
#endif
-#ifdef __cplusplus
+#if PRAGMA_ONCE #pragma once #endif #ifdef __cplusplus
+
+ class SalInstance;
+ class SalObject;
+ class SalFrame;
+ class SalVirtualDevice;
+ class SalPrinter;
-class SalInstance;
-class SalObject;
-class SalFrame;
-class SalVirtualDevice;
-class SalPrinter;
+ class FontList;
#else // __cplusplus
-#define SalInstance void
-#define SalVirtualDevice void
-#define SalPrinter void
+ #define SalInstance void
+ #define SalVirtualDevice void
+ #define SalPrinter void
+ #define FontList void
#endif // __cplusplus
@@ -103,27 +107,32 @@ class SalPrinter;
struct SalData
{
- SALTIMERPROC mpTimerProc; // timer callback proc
- SalInstance* mpFirstInstance; // pointer of first instance
- SalFrame* mpFirstFrame; // pointer of first frame
- SalObject* mpFirstObject; // pointer of first object window
- SalVirtualDevice* mpFirstVD; // first VirDev
- SalPrinter* mpFirstPrinter; // first printing printer
+ SALTIMERPROC mpTimerProc; // timer callback proc
+ SalInstance *mpFirstInstance; // pointer of first instance
+ SalFrame *mpFirstFrame; // pointer of first frame
+ SalObject *mpFirstObject; // pointer of first object window
+ SalVirtualDevice *mpFirstVD; // first VirDev
+ SalPrinter *mpFirstPrinter; // first printing printer
+ FontList *mpFontList; // Mac OS font list
};
#ifdef __cplusplus
-inline void SetSalData( SalData* pData ) { ImplGetSVData()->mpSalData = (void*)pData; }
-inline SalData* GetSalData() { return (SalData*)ImplGetSVData()->mpSalData; }
-inline SalData* GetAppSalData() { return (SalData*)ImplGetAppSVData()->mpSalData; }
+ inline void SetSalData( SalData* pData ) { ImplGetSVData()->mpSalData = (void*)pData; }
+
+ inline SalData *GetSalData() { return (SalData*)ImplGetSVData()->mpSalData; }
+ inline SalData *GetAppSalData() { return (SalData*)ImplGetAppSVData()->mpSalData; }
#else // __cplusplus
-// C wrapper functions around SetSalData, GetSalData, and GetAppSalData
-void SalSetSalData( struct SalData* pData );
-struct SalData* SalGetSalData();
-struct SalData* SalGetAppSalData();
-BOOL SalGetAppQuit();
+ // C wrapper functions around SetSalData, GetSalData, and GetAppSalData
+
+ void SalSetSalData( struct SalData* pData );
+
+ struct SalData *SalGetSalData();
+ struct SalData *SalGetAppSalData();
+
+ BOOL SalGetAppQuit();
#endif // __cplusplus
diff --git a/vcl/aqua/inc/salfontutils.hxx b/vcl/aqua/inc/salfontutils.hxx
new file mode 100644
index 000000000000..bc94b66164aa
--- /dev/null
+++ b/vcl/aqua/inc/salfontutils.hxx
@@ -0,0 +1,93 @@
+/*************************************************************************
+ *
+ * $RCSfile: salfontutils.hxx,v $
+ *
+ * $Revision: 1.1 $
+ * last change: $Author: bmahbod $ $Date: 2001-03-12 23:15:31 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (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.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2001 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+// =======================================================================
+
+// =======================================================================
+
+#ifndef _SV_SALFONTUTILS_HXX
+#define _SV_SALFONTUTILS_HXX
+
+#ifndef _SV_SALDATA_HXX
+ #include <saldata.hxx>
+#endif
+
+#ifndef _SV_OUTFONT_HXX
+ #include <outfont.hxx>
+#endif
+
+#if PRAGMA_ONCE #pragma once #endif // =======================================================================
+
+// =======================================================================
+
+DECLARE_LIST( FontList, ImplFontData* );
+
+// =======================================================================
+
+// =======================================================================
+
+FontList *GetMacFontList();
+
+// =======================================================================
+
+// =======================================================================
+
+#endif // _SV_SALFONTUTILS_HXX
+
diff --git a/vcl/aqua/inc/salgdi.h b/vcl/aqua/inc/salgdi.h
index 44926735df62..d94cf38a22b6 100644
--- a/vcl/aqua/inc/salgdi.h
+++ b/vcl/aqua/inc/salgdi.h
@@ -2,9 +2,9 @@
*
* $RCSfile: salgdi.h,v $
*
- * $Revision: 1.25 $
+ * $Revision: 1.26 $
*
- * last change: $Author: pluby $ $Date: 2001-03-10 22:30:00 $
+ * last change: $Author: bmahbod $ $Date: 2001-03-12 23:15:31 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -63,18 +63,37 @@
#define _SV_SALGDI_H
#include <premac.h>
-#include <ApplicationServices/ApplicationServices.h>
+
+ #ifndef __MACERRORS__ #include <CarbonCore/MacErrors.h>
+ #endif
+
+ #ifndef __MACTYPES__
+ #include <CarbonCore/MacTypes.h>
+ #endif
+
+ #ifndef __MACMEMORY__
+ #include <CarbonCore/MacMemory.h>
+ #endif
+
+ #ifndef __QUICKDRAW__
+ #include <QD/Quickdraw.h>
+ #endif
+
+ #ifndef __QDOFFSCREEN__
+ #include <QD/QDOffscreen.h>
+ #endif
+
#include <postmac.h>
#ifndef _SV_SV_H
-#include <sv.h>
+ #include <sv.h>
#endif
#ifndef _SV_VCLWINDOW_H
-#include <VCLWindow.h>
+ #include <VCLWindow.h>
#endif
-// -------------------
+#if PRAGMA_ONCE #pragma once #endif // -------------------
// - Structures -
// -------------------
diff --git a/vcl/aqua/inc/salmathutils.hxx b/vcl/aqua/inc/salmathutils.hxx
index afced28878d0..1f0ce01f68c6 100755
--- a/vcl/aqua/inc/salmathutils.hxx
+++ b/vcl/aqua/inc/salmathutils.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: salmathutils.hxx,v $
*
- * $Revision: 1.1 $
+ * $Revision: 1.2 $
*
- * last change: $Author: bmahbod $ $Date: 2001-02-14 19:39:48 $
+ * last change: $Author: bmahbod $ $Date: 2001-03-12 23:15:31 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -62,9 +62,11 @@
#ifndef _SV_SALMATHUTILS_HXX
#define _SV_SALMATHUTILS_HXX
-// --------------------
-// - Structures -
-// --------------------
+#if PRAGMA_ONCE #pragma once #endif #ifdef __cplusplus extern "C" { #endif // ------------------------------------------------------------------
+//
+// Structures
+//
+// ------------------------------------------------------------------
// LRectCoor is an abreviation for rectangular coordinates
// represented as long integers
@@ -76,9 +78,11 @@ struct LRectCoor
long z;
};
-// --------------------
-// - Type Definitions -
-// --------------------
+// ------------------------------------------------------------------
+//
+// Type Definitions
+//
+// ------------------------------------------------------------------
// LRectCoorVec is an abreviation for vectors in rectangular
// coordinates represented as long integers
@@ -87,9 +91,11 @@ typedef struct LRectCoor LRectCoor;
typedef LRectCoor *LRectCoorVector;
typedef LRectCoorVector *LRectCoorTensor;
-// --------------------
-// - Function Headers -
-// --------------------
+// ------------------------------------------------------------------
+//
+// Function Headers
+//
+// ------------------------------------------------------------------
void CSwap ( char &rX, char &rY );
void UCSwap ( unsigned char &rX, unsigned char &rY );
@@ -98,6 +104,10 @@ void USSwap ( unsigned short &rX, unsigned short &rY );
void LSwap ( long &rX, long &rY );
void ULSwap ( unsigned long &rX, unsigned long &rY );
+// ------------------------------------------------------------------
+
unsigned long Euclidian2Norm ( const LRectCoorVector pVec );
-#endif // _SV_SALMATHUTILS_HXX
+// ------------------------------------------------------------------
+
+#ifdef __cplusplus } #endif #endif // _SV_SALMATHUTILS_HXX
diff --git a/vcl/aqua/inc/salpixmaputils.hxx b/vcl/aqua/inc/salpixmaputils.hxx
index ef4ba2a92a96..79f0de4bb759 100755
--- a/vcl/aqua/inc/salpixmaputils.hxx
+++ b/vcl/aqua/inc/salpixmaputils.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: salpixmaputils.hxx,v $
*
- * $Revision: 1.2 $
+ * $Revision: 1.3 $
*
- * last change: $Author: pluby $ $Date: 2001-03-10 22:30:00 $
+ * last change: $Author: bmahbod $ $Date: 2001-03-12 23:15:31 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -63,22 +63,53 @@
#define _SV_SALPIXMAPUTILS_HXX
#include <premac.h>
-#include <ApplicationServices/ApplicationServices.h>
+
+ #ifndef __FIXMATH__
+ #include <CarbonCore/FixMath.h>
+ #endif
+
+ #ifndef __MACERRORS__ #include <CarbonCore/MacErrors.h>
+ #endif
+
+ #ifndef __MACTYPES__
+ #include <CarbonCore/MacTypes.h>
+ #endif
+
+ #ifndef __MACMEMORY__
+ #include <CarbonCore/MacMemory.h>
+ #endif
+
+ #ifndef __QUICKDRAW__
+ #include <QD/Quickdraw.h>
+ #endif
+
+ #ifndef __QDOFFSCREEN__
+ #include <QD/QDOffscreen.h>
+ #endif
+
#include <postmac.h>
#ifndef _GEN_HXX
-#include <tools/gen.hxx>
+ #include <tools/gen.hxx>
#endif
#ifndef _SV_SALBTYPE_HXX
-#include <salbtype.hxx>
+ #include <salbtype.hxx>
#endif
#ifndef _SV_SALGTYPE_HXX
-#include <salgtype.hxx>
+ #include <salgtype.hxx>
+#endif
+
+#ifndef _SV_SALCONST_H
+ #include <salconst.h>
#endif
-// ------------------------------------------------------------------
+#ifndef _SV_SALCOLORUTILS_HXX
+ #include <salcolorutils.hxx>
+#endif
+
+#if PRAGMA_ONCE #pragma once #endif // ------------------------------------------------------------------
PixMapHandle GetNewPixMap ( const Size &rPixMapSize,
@@ -94,6 +125,4 @@ PixMapHandle GetCGrafPortPixMap ( const Size &rPixMapSize,
const CGrafPtr pCGraf
);
-// ------------------------------------------------------------------
-
-#endif // _SV_SALPIXMAPUTILS_HXX
+// ------------------------------------------------------------------ #endif // _SV_SALPIXMAPUTILS_HXX
diff --git a/vcl/aqua/inc/salvd.h b/vcl/aqua/inc/salvd.h
index c1349b90bbca..ba39f47fd6e3 100644
--- a/vcl/aqua/inc/salvd.h
+++ b/vcl/aqua/inc/salvd.h
@@ -2,9 +2,9 @@
*
* $RCSfile: salvd.h,v $
*
- * $Revision: 1.7 $
+ * $Revision: 1.8 $
*
- * last change: $Author: bmahbod $ $Date: 2001-02-14 19:39:48 $
+ * last change: $Author: bmahbod $ $Date: 2001-03-12 23:15:31 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -62,14 +62,53 @@
#ifndef _SV_SALVD_H
#define _SV_SALVD_H
+#include <premac.h>
+
+ #ifndef __MACERRORS__ #include <CarbonCore/MacErrors.h>
+ #endif
+
+ #ifndef __MACTYPES__
+ #include <CarbonCore/MacTypes.h>
+ #endif
+
+ #ifndef __MACMEMORY__
+ #include <CarbonCore/MacMemory.h>
+ #endif
+
+ #ifndef __FONTS__
+ #include <QD/Fonts.h>
+ #endif
+
+ #ifndef __QUICKDRAW__
+ #include <QD/Quickdraw.h>
+ #endif
+
+ #ifndef __QDOFFSCREEN__
+ #include <QD/QDOffscreen.h>
+ #endif
+
+#include <postmac.h>
+
#ifndef _SV_SV_H
-#include <sv.h>
+ #include <sv.h>
#endif
#ifndef _SV_SALGDI_HXX
-#include <salgdi.hxx>
+ #include <salgdi.hxx>
#endif
+#ifndef _SV_SALCONST_H
+ #include <salconst.h>
+#endif
+
+#ifndef _SV_SALCOLORUTILS_HXX
+ #include <salcolorutils.hxx>
+#endif
+
+#if PRAGMA_ONCE #pragma once #endif // =======================================================================
+
+// =======================================================================
+
// -----------------
// - SalVirDevData -
// -----------------
@@ -87,4 +126,8 @@ typedef struct SalVirDevData SalVirDevData;
typedef SalVirDevData *SalVirDevDataPtr;
typedef SalVirDevDataPtr *SalVirDevDataHandle;
+// =======================================================================
+
+// =======================================================================
+
#endif // _SV_SALVD_H
diff --git a/vcl/aqua/source/gdi/makefile.mk b/vcl/aqua/source/gdi/makefile.mk
index 4229de8798b3..deff0a9cd411 100644
--- a/vcl/aqua/source/gdi/makefile.mk
+++ b/vcl/aqua/source/gdi/makefile.mk
@@ -2,9 +2,9 @@
#
# $RCSfile: makefile.mk,v $
#
-# $Revision: 1.5 $
+# $Revision: 1.6 $
#
-# last change: $Author: bmahbod $ $Date: 2001-02-14 19:39:49 $
+# last change: $Author: bmahbod $ $Date: 2001-03-12 23:15:32 $
#
# The Contents of this file are made available subject to the terms of
# either of the following licenses
@@ -86,6 +86,8 @@ SLOFILES= $(SLO)$/salmathutils.obj \
$(SLO)$/salcolorutils.obj \
$(SLO)$/salpixmaputils.obj \
$(SLO)$/salgdiutils.obj \
+ $(SLO)$/salatsuifontutils.obj \
+ $(SLO)$/salfontutils.obj \
$(SLO)$/salgdi.obj \
$(SLO)$/VCLGraphics.obj \
$(SLO)$/salvd.obj \
@@ -99,6 +101,8 @@ OBJFILES= $(OBJ)$/salmathutils.obj \
$(OBJ)$/salcolorutils.obj \
$(OBJ)$/salpixmaputils.obj \
$(OBJ)$/salgdiutils.obj \
+ $(OBJ)$/salatsuifontutils.obj \
+ $(OBJ)$/salfontutils.obj \
$(OBJ)$/salgdi.obj \
$(OBJ)$/VCLGraphics.obj \
$(OBJ)$/salvd.obj \
diff --git a/vcl/aqua/source/gdi/salatsuifontutils.cxx b/vcl/aqua/source/gdi/salatsuifontutils.cxx
new file mode 100644
index 000000000000..e25f59216801
--- /dev/null
+++ b/vcl/aqua/source/gdi/salatsuifontutils.cxx
@@ -0,0 +1,2142 @@
+/*************************************************************************
+ *
+ * $RCSfile: salatsuifontutils.cxx,v $
+ *
+ * $Revision: 1.1 $
+ * last change: $Author: bmahbod $ $Date: 2001-03-12 23:15:32 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (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.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2001 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+// =======================================================================
+
+// =======================================================================
+
+#define _SV_SALATSUIFONTUTILS_CXX
+
+#ifndef _SV_SALATSUIFONTUTILS_HXX
+ #include <salatsuifontutils.hxx>
+#endif
+
+// =======================================================================
+
+// =======================================================================
+
+static SInt16 AppendMenuName( MenuHandle hMenu,
+ long nMenuLength,
+ char pMenuName[],
+ ScriptCode nMenuScriptCode
+ );
+
+static MacOSBoolean ATSUIBetterEncoding( const FontNameEncodingPtr pFontNewNameEncoding,
+ const FontNameEncodingPtr pFontOldNameEncoding,
+ const FontNameEncodingPtr pFontFamilyNameEncodingPrefs
+ );
+
+static FontNamesPtr ATSUIBuildFontNamesRecord( ATSUFontID nFontID,
+ ATSUIInstanceIndex nFontInstanceIndex,
+ FontNameCode nFontNameCode
+ );
+
+static long ATSUICompareFontNames( FontNamesPtr pFontName1,
+ FontNamesPtr pFontName2
+ );
+
+static void ATSUIInsertFontInSortedList( FontNamesPtr pFontNames,
+ FontNamesPtr pSortedFontList[],
+ ItemCount *pFontListLength
+ );
+
+static ATSUIInstanceIndex ATSUIInstanceMatchingDefaultVariations( ATSUFontID nFontID );
+
+static ATSUIInstanceIndex ATSUIInstanceMatchingVariations( ATSUFontID nFontID,
+ ItemCount nFontVariationsCount,
+ const ATSUFontVariationValue pFontVariationValuesToMatch[]
+ );
+
+static ItemCount ATSUILookForFontInstances( ATSUFontID *rFontIDList,
+ ItemCount nFontItemsCount
+ );
+
+static void FontListToHierarchialMenu( MenuHandle hFontMenu,
+ short nHierarchiaFontMenuID,
+ const FontNamesMatrix hFontList,
+ ItemCount nFontItemsCount,
+ short *rFontSubmenusCount,
+ void **hFontMenuLookupCookie
+ );
+
+static MenuHandle NewMenuName( short nMenuID,
+ long nMenuItemLength,
+ char nMenuTitle[]
+ );
+
+// =======================================================================
+
+// =======================================================================
+
+OSStatus ATSUIGetOneAttribute( ATSUStyle aFontStyle,
+ ATSUAttributeTag nFontAttributeTag,
+ ByteCount nFontExpValueSize,
+ ATSUAttributeValuePtr rFontAttributeValue
+ )
+{
+ // Filters out kATSUNotSetErr
+
+ OSStatus nGetAttributeStatus = noErr;
+ OSStatus nAttributeStatus = noErr;
+ ByteCount *pFontActValueSize = NULL;
+
+ nGetAttributeStatus = ATSUGetAttribute( aFontStyle,
+ nFontAttributeTag,
+ nFontExpValueSize,
+ rFontAttributeValue,
+ pFontActValueSize
+ );
+
+ if ( nGetAttributeStatus != kATSUNotSetErr )
+ {
+ nAttributeStatus = nGetAttributeStatus;
+ }
+
+ return nAttributeStatus;
+} // ATSUIGetOneAttribute
+
+// -----------------------------------------------------------------------
+
+OSStatus ATSUISetIntAttribute( ATSUStyle aFontStyle,
+ SInt32 nFontAttributeValue,
+ ATSUAttributeTag nFontAttributeTag
+ )
+{
+ ByteCount nFontExpValueSize = sizeof(nFontAttributeValue);
+ ATSUAttributeValuePtr pFontAttributeValue = &nFontAttributeValue;
+ ItemCount nFontAttributeCount = 1;
+ OSStatus nSetAttributesStatus = noErr;
+
+ if ( IsPointerValid( (MacOSPtr)pFontAttributeValue ) )
+ {
+ nSetAttributesStatus = ATSUSetAttributes( aFontStyle,
+ nFontAttributeCount,
+ &nFontAttributeTag,
+ &nFontExpValueSize,
+ &pFontAttributeValue
+ );
+ } // if
+
+ return nSetAttributesStatus;
+} // ATSUISetIntAttribute
+
+// -----------------------------------------------------------------------
+//
+// Given a font ID number, a font instance index, and name code for the
+// style name, we shall attempt to find a usable matching strings for the
+// font family and style name, and build up a font names structure. The
+// font names structure packs family and all style strings together.
+//
+// -----------------------------------------------------------------------
+
+static FontNamesPtr ATSUIBuildFontNamesRecord( ATSUFontID nFontID,
+ ATSUIInstanceIndex nFontInstanceIndex,
+ FontNameCode nFontNameCode
+ )
+{
+ ByteCount nFontFamilyMaxNameLength = 0;
+ ByteCount nFontFamilyNameLength = 0;
+ FontNamesPtr pFontFamilyNames = NULL;
+ FontNameCode nFontFamilyNameCode = kFontFamilyName;
+ FontLanguageCode nFontFamilyLanguageCode = kFontNoLanguage;
+ FontPlatformCode nFontFamilyPlatformCode = kFontNoPlatform;
+ FontScriptCode nFontFamilyScriptCode = kFontNoScript;
+ ItemCount nFontFamilyIndex = 0;
+ OSStatus nStatus = noErr;
+ MacOSPtr pFontFamilyName = NULL;
+
+ // If one needs font names that match the font's (QD Text) script, we
+ // may get the corresponding QD family ID, and the script for that
+ // family, and then pass this parameter to the ATSUIFindBestFontName()
+ // API, that can be found in this file. This will in turn force ATSUI
+ // to look for a name in a desired script first.
+
+ nStatus = ATSUIFindBestFontName( nFontID,
+ nFontFamilyNameCode,
+ &nFontFamilyPlatformCode,
+ &nFontFamilyScriptCode,
+ &nFontFamilyLanguageCode,
+ nFontFamilyMaxNameLength,
+ pFontFamilyName,
+ &nFontFamilyNameLength,
+ &nFontFamilyIndex
+ );
+
+ // If there was no Mac name there is nothing to be done here.
+ // Instead, we shall attempt to convert the font name first.
+
+ if ( ( nStatus == noErr )
+ && ( nFontFamilyPlatformCode == kFontMacintoshPlatform )
+ )
+ {
+ ByteCount nFontStyleNameLength = 0;
+ FontLanguageCode nFontStyleLanguageCode = nFontFamilyLanguageCode;
+ FontPlatformCode nFontStylePlatformCode = nFontFamilyPlatformCode;
+ FontScriptCode nFontStyleScriptCode = nFontFamilyScriptCode;
+ ItemCount nFontStyleIndex = 0;
+
+ // Find the font's style name whilst attempting to match
+ // the family name's encoding and language.
+
+ nStatus = ATSUIFindBestFontName( nFontID,
+ nFontNameCode,
+ &nFontStylePlatformCode,
+ &nFontStyleScriptCode,
+ &nFontStyleLanguageCode,
+ nFontFamilyMaxNameLength,
+ pFontFamilyName,
+ &nFontStyleNameLength,
+ &nFontStyleIndex
+ );
+
+ // As before, if there was no Mac name there is no need to continue.
+ // Again, we shall attempt to convert the font name first.
+
+ if ( ( nStatus == noErr )
+ && ( nFontStylePlatformCode == kFontMacintoshPlatform )
+ )
+ {
+ long nFontNamesOffset = offsetof(FontNamesRecord, mpFontName);
+ long nFontNameSize = nFontNamesOffset
+ + nFontFamilyNameLength
+ + nFontStyleNameLength;
+
+ pFontFamilyNames = (FontNamesPtr)NewPtrClear( nFontNameSize );
+
+ nStatus = MemError();
+
+ if ( ( nStatus == noErr)
+ && ( IsPointerValid( (MacOSPtr)pFontFamilyNames ) )
+ )
+ {
+ FontNameCode *pFontNameCode = NULL;
+ FontPlatformCode *pFontNamePlatformCode = NULL;
+ FontScriptCode *pFontNameScriptCode = NULL;
+ FontLanguageCode *pFontNameLanguageCode = NULL;
+
+ pFontFamilyNames->mnFontID = nFontID;
+ pFontFamilyNames->maFontFamilyNameEncoding.mnFontScriptCode = nFontFamilyScriptCode;
+ pFontFamilyNames->maFontFamilyNameEncoding.mnFontPlatformCode = nFontFamilyPlatformCode;
+ pFontFamilyNames->maFontFamilyNameEncoding.mnFontLanguageCode = nFontFamilyLanguageCode;
+
+ nStatus = ATSUGetIndFontName( nFontID,
+ nFontFamilyIndex,
+ nFontFamilyNameLength,
+ &pFontFamilyNames->mpFontName[ 0 ],
+ &pFontFamilyNames->maFontFamilyNameEncoding.mnFontItemCount,
+ pFontNameCode,
+ pFontNamePlatformCode,
+ pFontNameScriptCode,
+ pFontNameLanguageCode
+ );
+
+ if ( nStatus == noErr)
+ {
+ pFontFamilyNames->mnFontStyleByteOffset = nFontFamilyNameLength;
+ pFontFamilyNames->maFontStyleNameEncoding.mnFontScriptCode = nFontStyleScriptCode;
+ pFontFamilyNames->maFontStyleNameEncoding.mnFontPlatformCode = nFontStylePlatformCode;
+ pFontFamilyNames->maFontStyleNameEncoding.mnFontLanguageCode = nFontStyleLanguageCode;
+
+ nStatus = ATSUGetIndFontName( nFontID,
+ nFontStyleIndex,
+ nFontStyleNameLength,
+ &pFontFamilyNames->mpFontName[ nFontFamilyNameLength ],
+ &pFontFamilyNames->maFontStyleNameEncoding.mnFontItemCount,
+ pFontNameCode,
+ pFontNamePlatformCode,
+ pFontNameScriptCode,
+ pFontNameLanguageCode
+ );
+
+ if ( nStatus == noErr )
+ {
+ pFontFamilyNames->mnFontInstanceIndex = nFontInstanceIndex;
+
+ // Filter out invisible fonts.
+
+ if ( ( pFontFamilyNames->mpFontName[ 0 ] == kInvalidFontNamePrefixPeriodSign )
+ || ( pFontFamilyNames->mpFontName[ 0 ] == kInvalidFontNamePrefixPercentSign )
+ )
+ {
+ nStatus = kATSUInvalidFontErr;
+ } // if
+
+ if ( ( nStatus != noErr )
+ && ( pFontFamilyNames != NULL )
+ )
+ {
+ DisposePtr( (MacOSPtr) pFontFamilyNames );
+
+ pFontFamilyNames = NULL;
+ } // if
+ } // if
+ else
+ {
+ DisposePtr( (MacOSPtr) pFontFamilyNames );
+
+ pFontFamilyNames = NULL;
+ } // else
+ } // if
+ else
+ {
+ DisposePtr( (MacOSPtr) pFontFamilyNames );
+
+ pFontFamilyNames = NULL;
+ } // else
+ } // if
+ } // if
+ } // if
+
+ return pFontFamilyNames;
+} // ATSUIBuildFontNamesRecord
+
+// -----------------------------------------------------------------------
+//
+// Sort the font by family name and then by style.
+//
+// -----------------------------------------------------------------------
+
+static long ATSUICompareFontNames( FontNamesPtr pFontName1,
+ FontNamesPtr pFontName2
+ )
+{
+ long nTextOrder = 0;
+ LangCode pFontLangCode[2] = { currentDefLang, currentDefLang };
+
+ nTextOrder = TextOrder( &pFontName1->mpFontName[ 0 ],
+ &pFontName2->mpFontName[ 0 ],
+ pFontName1->maFontFamilyNameEncoding.mnFontItemCount,
+ pFontName2->maFontFamilyNameEncoding.mnFontItemCount,
+ pFontName1->maFontFamilyNameEncoding.mnFontScriptCode,
+ pFontName2->maFontFamilyNameEncoding.mnFontScriptCode,
+ pFontLangCode[0],
+ pFontLangCode[1]
+ );
+
+ if ( nTextOrder == 0 )
+ {
+ nTextOrder = TextOrder( &pFontName1->mpFontName[ pFontName1->mnFontStyleByteOffset ],
+ &pFontName2->mpFontName[ pFontName2->mnFontStyleByteOffset ],
+ pFontName1->maFontStyleNameEncoding.mnFontItemCount,
+ pFontName2->maFontStyleNameEncoding.mnFontItemCount,
+ pFontName1->maFontStyleNameEncoding.mnFontScriptCode,
+ pFontName2->maFontStyleNameEncoding.mnFontScriptCode,
+ pFontLangCode[0],
+ pFontLangCode[1]
+ );
+ } // if
+
+ return nTextOrder;
+} // ATSUICompareFontNames
+
+// -----------------------------------------------------------------------
+
+static void ATSUIInsertFontInSortedList( FontNamesPtr pFontNames,
+ FontNamesPtr pSortedFontList[],
+ ItemCount *pFontListLength
+ )
+{
+ if ( IsPointerValid( (MacOSPtr)pFontNames ) )
+ {
+ long nHighIndex = *pFontListLength;
+ long nLowIndex = 0;
+ long nInsertIndex = 0;
+ long nTextOrder = 0;
+
+ // Find the insertion position and then start Binary search procedure.
+
+ nInsertIndex = nLowIndex + (nHighIndex - nLowIndex) / 2;
+
+ while ( nLowIndex < nHighIndex )
+ {
+ nTextOrder = ATSUICompareFontNames( pFontNames,
+ pSortedFontList[ nInsertIndex ]
+ );
+
+ if ( nTextOrder < 0 )
+ {
+ // New font goes before the current high index
+
+ nHighIndex = nInsertIndex;
+ } // if
+ else if ( nTextOrder > 0 )
+ {
+ // New font goes after the current low index
+
+ nLowIndex = nInsertIndex + 1;
+ } // else if
+ else
+ {
+ // same as the current index, we infer duplicates,
+ // and hence avoid inserting duplicates in the list
+
+ nInsertIndex = -1;
+
+ break;
+ } // else
+
+ nInsertIndex = nLowIndex + (nHighIndex - nLowIndex) / 2;
+ } // while
+
+ if ( nInsertIndex >= 0 )
+ {
+ MacOSSize aByteCount = (*pFontListLength - nInsertIndex) * sizeof(FontNamesPtr);
+
+ // Add a font to our current list.
+
+ BlockMoveData( &pSortedFontList[ nInsertIndex ],
+ &pSortedFontList[ nInsertIndex + 1 ],
+ aByteCount
+ );
+
+ pSortedFontList[ nInsertIndex ] = pFontNames;
+
+ *pFontListLength += 1;
+ } // if
+ } // while
+} // ATSUIInsertFontInSortedList
+
+// -----------------------------------------------------------------------
+//
+// Create a new menu with the given ID and title
+//
+// -----------------------------------------------------------------------
+
+static MenuHandle NewMenuName( short nMenuID,
+ long nMenuItemLength,
+ char hMenuTitle[]
+ )
+{
+ MenuHandle hMenu = NULL;
+
+ if ( IsPointerValid( (MacOSPtr)hMenuTitle ) )
+ {
+ Str255 pMenuItemNameBuffer;
+
+ if ( nMenuItemLength < 255 )
+ {
+ pMenuItemNameBuffer[ 0 ] = nMenuItemLength;
+ } // if
+ else
+ {
+ pMenuItemNameBuffer[ 0 ] = 255;
+ } // else
+
+ BlockMove( hMenuTitle,
+ &pMenuItemNameBuffer[ 1 ],
+ pMenuItemNameBuffer[ 0 ]
+ );
+
+ hMenu = NewMenu( nMenuID, pMenuItemNameBuffer );
+ } // if
+
+ return hMenu;
+} // NewMenuName
+
+// -----------------------------------------------------------------------
+//
+// Append the given string to the menu
+//
+// -----------------------------------------------------------------------
+
+static SInt16 AppendMenuName( MenuHandle hMenu,
+ long nMenuLength,
+ char pMenuName[],
+ ScriptCode nMenuScriptCode
+ )
+{
+ SInt16 nItemNum = 0;
+
+ if ( ( IsHandleValid( (Handle)hMenu ) )
+ && ( IsPointerValid( (MacOSPtr)pMenuName ) )
+ )
+ {
+ OSErr nStatus = noErr;
+ Str255 pMenuBufferName;
+
+ if ( nMenuLength <= kMenuBufferMaxLength )
+ {
+ pMenuBufferName[ 0 ] = nMenuLength;
+ } // if
+ else
+ {
+ short nCharByteType = 0;
+
+ pMenuBufferName[ 0 ] = kMenuBufferMaxLength;
+
+ nCharByteType = CharacterByteType( pMenuName,
+ kMenuBufferMaxLength,
+ nMenuScriptCode
+ );
+
+ if ( nCharByteType > smSingleByte )
+ {
+ // truncate properly for multi-byte.
+
+ --pMenuBufferName[ 0 ];
+ } // if
+ } // else
+
+ BlockMoveData( pMenuName,
+ &pMenuBufferName[ 1 ],
+ pMenuBufferName[ 0 ]
+ );
+
+ // avoid metacharacter processing
+
+ AppendMenu( hMenu, kMenuItemGenericName );
+
+ nItemNum = CountMenuItems( hMenu );
+
+ SetMenuItemText( hMenu,
+ nItemNum,
+ pMenuBufferName
+ );
+
+ nStatus = SetMenuItemTextEncoding( hMenu,
+ nItemNum,
+ nMenuScriptCode
+ );
+ } // if
+
+ return nItemNum;
+} // AppendMenuName
+
+// -----------------------------------------------------------------------
+//
+// Construct the font hierarchial menu using our font ID list.
+//
+// -----------------------------------------------------------------------
+
+static void FontListToHierarchialMenu( MenuHandle hFontMenu,
+ short nHierarchiaFontMenuID,
+ const FontNamesMatrix hFontList,
+ ItemCount nFontItemsCount,
+ short *rFontSubmenusCount,
+ void **hFontMenuLookupCookie
+ )
+{
+ hFontMenuLookupCookie = NULL;
+ *rFontSubmenusCount = 0;
+
+ if ( nFontItemsCount > 0 )
+ {
+ long nFontMenuHandleSize = nFontItemsCount * sizeof(FontMenuItemRecord);
+ OSStatus nStatus = noErr;
+ FontMenuItemsHandle hFontMenuItems = NULL;
+
+ hFontMenuItems = (FontMenuItemsHandle)NewHandleClear( nFontMenuHandleSize );
+
+ nStatus = MemError();
+
+ if ( ( nStatus == noErr )
+ && ( IsHandleValid( (Handle)hFontMenuItems ) )
+ )
+ {
+ SInt8 nFlags = noErr;
+
+ nFlags = HGetState( (Handle)hFontMenuItems );
+
+ if ( nFlags == noErr )
+ {
+ long i = 0;
+ long j = 0;
+ long k = 0;
+ long nFontMenuItem = 0;
+ long nRecordNum = 0;
+ long nTextOrder = 0;
+ long nFontSubItemNum = 0;
+ short nFontSubMenuID = 0;
+ short nFontSubmenusCreated = 0;
+ LangCode aFontLangCode[2] = { currentDefLang, currentDefLang };
+ MenuHandle hFontSubMenu = NULL;
+ OSStatus nStatus = noErr;
+
+ HLock( (Handle)hFontMenuItems );
+
+ while ( i < nFontItemsCount )
+ {
+ // Collect up the fonts with the same family name
+
+ for ( j = i + 1; j < nFontItemsCount; j++ )
+ {
+ nTextOrder = TextOrder( &hFontList[ i ]->mpFontName[ 0 ],
+ &hFontList[ j ]->mpFontName[ 0 ],
+ hFontList[ i ]->maFontFamilyNameEncoding.mnFontItemCount,
+ hFontList[ j ]->maFontFamilyNameEncoding.mnFontItemCount,
+ hFontList[ i ]->maFontFamilyNameEncoding.mnFontScriptCode,
+ hFontList[ j ]->maFontFamilyNameEncoding.mnFontScriptCode,
+ aFontLangCode[0],
+ aFontLangCode[1]
+ );
+
+ if ( nTextOrder != 0 )
+ {
+ break;
+ } // if
+ } // for
+
+ // Should the style name be added to the top level if there's only one style?
+ // How about using full name instead?
+
+ nFontMenuItem = AppendMenuName( hFontMenu,
+ hFontList[ i ]->maFontFamilyNameEncoding.mnFontItemCount,
+ &hFontList[ i ]->mpFontName[ 0 ],
+ hFontList[ i ]->maFontFamilyNameEncoding.mnFontScriptCode
+ );
+
+ // Add a submenu for the styles
+
+ if ( j - i > 1 )
+ {
+ nFontSubMenuID = nHierarchiaFontMenuID + nFontSubmenusCreated++;
+
+ hFontSubMenu = NewMenuName( nFontSubMenuID,
+ hFontList[ i ]->maFontFamilyNameEncoding.mnFontItemCount,
+ &hFontList[ i ]->mpFontName[ 0 ]
+ );
+
+ if ( hFontSubMenu != NULL )
+ {
+ for ( k = i; k < j; k++ )
+ {
+ nFontSubItemNum
+ = AppendMenuName( hFontSubMenu,
+ hFontList[ k ]->maFontStyleNameEncoding.mnFontItemCount,
+ &hFontList[ k ]->mpFontName[ hFontList[ k ]->mnFontStyleByteOffset ],
+ hFontList[ k ]->maFontStyleNameEncoding.mnFontScriptCode
+ );
+
+ if ( ( kATSUIFontInstanceMenuItemStyle != 0 )
+ && ( hFontList[ k ]->mnFontInstanceIndex != kATSUIDefaultInstance )
+ )
+ {
+ SetItemStyle( hFontSubMenu,
+ nFontSubItemNum,
+ kATSUIFontInstanceMenuItemStyle
+ );
+ } //if
+
+ // leave a trail so we can recover the font ID
+
+ (*hFontMenuItems)[ nRecordNum ].mnFontID = hFontList[ k ]->mnFontID;
+ (*hFontMenuItems)[ nRecordNum ].mnFontInstanceIndex = hFontList[ k ]->mnFontInstanceIndex;
+ (*hFontMenuItems)[ nRecordNum ].mnFontMenuID = nFontSubMenuID;
+ (*hFontMenuItems)[ nRecordNum ].mnFontItemNum = nFontSubItemNum;
+
+ nRecordNum += 1;
+ } // for
+
+ InsertMenu( hFontSubMenu, hierMenu );
+
+ nStatus = SetMenuItemHierarchicalID( hFontMenu,
+ nFontMenuItem,
+ nFontSubMenuID
+ );
+ } //if
+ } // if
+ else
+ {
+ // leave a trail so we can recover the font ID
+
+ (*hFontMenuItems)[ nRecordNum ].mnFontID = hFontList[ i ]->mnFontID;
+ (*hFontMenuItems)[ nRecordNum ].mnFontInstanceIndex = hFontList[ i ]->mnFontInstanceIndex;
+ (*hFontMenuItems)[ nRecordNum ].mnFontMenuID = GetMenuID(hFontMenu);
+ (*hFontMenuItems)[ nRecordNum ].mnFontItemNum = nFontMenuItem;
+
+ nRecordNum += 1;
+
+ } // else
+
+ i = j; // next family name
+ } // while
+
+ if ( rFontSubmenusCount != NULL )
+ {
+ *rFontSubmenusCount = nFontSubmenusCreated;
+ } // if
+
+ *hFontMenuLookupCookie = hFontMenuItems;
+
+ HSetState( (Handle)hFontMenuItems, nFlags );
+ } // if
+ else
+ {
+ // If we can't lock the font menu items handle, dispose of it
+ // and exit
+
+ DisposeHandle( (Handle)hFontMenuItems );
+ } // else
+ } // if
+ } // if
+} // FontListToHierarchialMenu
+
+// -----------------------------------------------------------------------
+//
+// Loop throught our font ID list, count the font instances, and if a
+// "bad" font is encountered, remove it from the font ID list.
+//
+// -----------------------------------------------------------------------
+
+static ItemCount ATSUILookForFontInstances( ATSUFontID *rFontIDList,
+ ItemCount nFontItemsCount
+ )
+{
+ ItemCount nFontInstancesCount = 0;
+
+ if ( IsPointerValid( (MacOSPtr)rFontIDList ) )
+ {
+ OSStatus nStatus = noErr;
+ ItemCount nFontsInstances = 0;
+ long nFontInstanceIndex;
+
+ for ( nFontInstanceIndex = 0;
+ nFontInstanceIndex < nFontItemsCount;
+ ++nFontInstanceIndex
+ )
+ {
+ nStatus = ATSUCountFontInstances( rFontIDList[ nFontInstanceIndex ],
+ &nFontsInstances
+ );
+
+ if ( nStatus == noErr )
+ {
+ nFontInstancesCount += nFontsInstances;
+ }
+ else
+ {
+ rFontIDList[ nFontInstanceIndex ] = kATSUInvalidFontID;
+ }
+ } // for
+ } // if
+
+ return nFontInstancesCount;
+} // ATSUILookForFontInstances
+
+// -----------------------------------------------------------------------
+//
+// Loop through a font's instances, if any, and check whether any of them
+// match the given variations. The input array must be complete and
+// in canonical order. If unsuccessful and no match were to be found, then
+// we shall return the constant kATSUINotAnInstance.
+//
+// -----------------------------------------------------------------------
+
+static ATSUIInstanceIndex ATSUIInstanceMatchingVariations( ATSUFontID nFontID,
+ ItemCount nFontVariationsCount,
+ const ATSUFontVariationValue pFontVariationsToMatch[]
+ )
+{
+ ATSUIInstanceIndex nFontInstanceIndex = kATSUINotAnInstance;
+ ItemCount nFontInstancesCount = 0;
+ OSStatus nStatus = noErr;
+
+ nStatus = ATSUCountFontInstances( nFontID, &nFontInstancesCount );
+
+ if ( nStatus == noErr )
+ {
+ ATSUFontVariationValue pFontVariationInstanceValue[ kATSUIMaxVariations ];
+ ATSUFontVariationAxis *pFontVariationAxis = NULL;
+ ItemCount nFontIndex = 0;
+ ItemCount nFontMatchIndex = 0;
+ ItemCount nFontActualVariationCount = 0;
+
+ // Values in an instance are always in canonical order,
+ // and hence we shall utilize these values and compare
+ // them directly.
+
+ for ( nFontIndex = 0;
+ nFontIndex < nFontInstancesCount;
+ ++nFontIndex
+ )
+ {
+ nStatus = ATSUGetFontInstance( nFontID,
+ nFontIndex,
+ nFontVariationsCount,
+ pFontVariationAxis,
+ pFontVariationInstanceValue,
+ &nFontActualVariationCount
+ );
+
+ if ( ( nStatus == noErr )
+ && ( nFontActualVariationCount == nFontVariationsCount )
+ )
+ {
+ nFontInstanceIndex = nFontIndex;
+
+ for ( nFontMatchIndex = 0;
+ nFontMatchIndex < nFontVariationsCount
+ && nFontIndex < kATSUIMaxVariations;
+ ++nFontMatchIndex
+ )
+ {
+ if ( pFontVariationsToMatch[ nFontMatchIndex ]
+ != pFontVariationInstanceValue[ nFontMatchIndex ]
+ )
+ {
+ nFontInstanceIndex = kATSUINotAnInstance;
+
+ break;
+ } // if
+ } // for
+
+ if ( nFontInstanceIndex != kATSUINotAnInstance )
+ {
+ break;
+ } // if
+ } // if
+ } // for
+ } // if
+
+ return nFontInstanceIndex;
+} // ATSUIInstanceMatchingVariations
+
+// -----------------------------------------------------------------------
+//
+// Find the font instance index, that matches the default variation
+// values, and if we were unable to find such a match, then we shall
+// kATSUIDefaultInstance.
+//
+// -----------------------------------------------------------------------
+
+static ATSUIInstanceIndex ATSUIInstanceMatchingDefaultVariations( ATSUFontID nFontID )
+{
+ ItemCount nFontInstancesCount = 0;
+ OSStatus nStatus = noErr;
+
+ nStatus = ATSUCountFontInstances( nFontID, &nFontInstancesCount );
+
+ if ( nStatus == noErr )
+ {
+ if ( nFontInstancesCount == 0 )
+ {
+ return kATSUIDefaultInstance;
+ } // if
+ else
+ {
+ ItemCount nFontVariationsCount = 0;
+
+ nStatus = ATSUCountFontVariations( nFontID, &nFontVariationsCount );
+
+ if ( nStatus == noErr )
+ {
+ if ( nFontVariationsCount > 0 )
+ {
+ long nFontVariationIndex = 0;
+ ATSUIInstanceIndex nFoundInstanceIndex = 0;
+ ATSUFontVariationAxis *pATSUFontVariationAxis = NULL;
+ ATSUFontVariationValue *pFontMinimumVariationValue = NULL;
+ ATSUFontVariationValue *pFontMaximumVariationValue = NULL;
+ ATSUFontVariationValue pFontDefaultVariationValues[ kATSUIMaxVariations ];
+
+ // Get the variations in canonical order, as we only require
+ // the font variation values.
+
+ for ( nFontVariationIndex = 0;
+ nFontVariationIndex < nFontVariationsCount
+ && nFontVariationIndex < kATSUIMaxVariations;
+ ++nFontVariationIndex
+ )
+ {
+ nStatus = ATSUGetIndFontVariation( nFontID,
+ nFontVariationIndex,
+ pATSUFontVariationAxis,
+ pFontMinimumVariationValue,
+ pFontMaximumVariationValue,
+ &pFontDefaultVariationValues[ nFontVariationIndex ]
+ );
+
+ if ( nStatus != noErr )
+ {
+ return kATSUIDefaultInstance;
+ } // if
+ } // for
+
+ nFoundInstanceIndex = ATSUIInstanceMatchingVariations( nFontID,
+ nFontVariationsCount,
+ pFontDefaultVariationValues
+ );
+
+ if ( nFoundInstanceIndex != kATSUINotAnInstance )
+ {
+ return nFoundInstanceIndex;
+ } // if
+ } // if
+ } // if
+ else
+ {
+ return kATSUIDefaultInstance;
+ } // else
+ } // else
+ } // if
+
+ return kATSUIDefaultInstance;
+} // ATSUIInstanceMatchingDefaultVariations
+
+// -----------------------------------------------------------------------
+//
+// Here we shall construct a hierarchial font menu. The top level of our
+// font menu consists of font family name, and if there's more than one
+// style for a given family, a submenu is created for those styles. We
+// will treat font instances as styles.
+//
+// Note that:
+//
+// * If there's only one representative of a family, we shall insert the
+// full font name into the menu instead of only the family name. We can
+// not determine this immediately until all the fonts are sorted.
+//
+// * If there are multiple fonts with the same name, all but the first
+// occurance of this particular font is kept.
+//
+// -----------------------------------------------------------------------
+
+OSStatus ATSUIAppendFontMenu( MenuHandle hFontMenu,
+ short nHierarchiaFontMenuID,
+ short *rSubmenuCount,
+ void **hFontMenuLookupCookie
+ )
+{
+ OSStatus nStatus = noErr;
+ ItemCount nFontItemsSize = 0;
+
+ nStatus = ATSUFontCount( &nFontItemsSize );
+
+ if ( ( nStatus == noErr )
+ && ( nFontItemsSize > 0 )
+ )
+ {
+ ATSUFontID *pFontIDList = NULL;
+ long nFontIDListSize = nFontItemsSize * sizeof(ATSUFontID);
+
+ pFontIDList = (ATSUFontID *)NewPtrClear( nFontIDListSize );
+
+ nStatus = MemError();
+
+ if ( ( nStatus == noErr )
+ && ( IsPointerValid( (MacOSPtr)pFontIDList ) )
+ )
+ {
+ ItemCount *pFontItemsCount = NULL;
+
+ nStatus = ATSUGetFontIDs( pFontIDList,
+ nFontItemsSize,
+ pFontItemsCount
+ );
+
+ if ( nStatus == noErr )
+ {
+ long nSortedFontListSize = 0;
+ ItemCount nTotalFontInstances = 0;
+ ItemCount nSortedFontListLength = 0;
+ FontNamesMatrix hSortedFontList = NULL;
+
+ nTotalFontInstances = ATSUILookForFontInstances( pFontIDList, nFontItemsSize );
+
+ // The allocated size for the sorted font list might be larger than
+ // neccessary because of "bad" fonts, but at least we have had more
+ // than enough memory storage.
+
+ nSortedFontListSize = (nFontItemsSize + nTotalFontInstances)
+ * sizeof(FontNamesPtr);
+
+ hSortedFontList = (FontNamesMatrix)NewPtrClear( nSortedFontListSize );
+
+ nStatus = MemError();
+
+ if ( ( nStatus == noErr )
+ && ( IsPointerValid( (MacOSPtr)hSortedFontList ) )
+ )
+ {
+ ATSUIInstanceIndex nFontInstanceIndex = 0;
+ FontNamesPtr pFontNames = NULL;
+ FontNameCode nFontInstanceNameCode = 0;
+ ItemCount nFontInstance = 0;
+ ItemCount nFontInstancesCount = 0;
+ ItemCount nFontIndex;
+
+ for ( nFontIndex = 0;
+ nFontIndex < nFontItemsSize;
+ nFontIndex++
+ )
+ {
+ if ( pFontIDList[ nFontIndex ] != kATSUInvalidFontID )
+ {
+ // If there exists a name list then add the font's
+ // instances to this particular list.
+
+ nStatus = ATSUCountFontInstances( pFontIDList[ nFontIndex ],
+ &nFontInstancesCount
+ );
+
+ for ( nFontInstance = 0;
+ nFontInstance < nFontInstancesCount;
+ ++nFontInstance
+ )
+ {
+ nStatus = ATSUGetFontInstanceNameCode( pFontIDList[ nFontIndex ],
+ nFontInstance,
+ &nFontInstanceNameCode
+ );
+
+ if ( nStatus == noErr )
+ {
+ pFontNames = ATSUIBuildFontNamesRecord( pFontIDList[ nFontIndex ],
+ nFontInstance,
+ nFontInstanceNameCode
+ );
+
+ if ( pFontNames != NULL )
+ {
+ ATSUIInsertFontInSortedList( pFontNames,
+ hSortedFontList,
+ &nSortedFontListLength
+ );
+ } // if
+ } // if
+ } // if
+
+ // Now add the font. However, and if this font has the same name as
+ // an instance index, skip this font, and defer any actions until
+ // name collisions issue is resolved.
+
+ nFontInstanceIndex
+ = ATSUIInstanceMatchingDefaultVariations( pFontIDList[ nFontIndex ] );
+
+ if ( nFontInstanceIndex == kATSUIDefaultInstance )
+ {
+ pFontNames = ATSUIBuildFontNamesRecord( pFontIDList[ nFontIndex ],
+ kATSUIDefaultInstance,
+ kFontStyleName
+ );
+
+ if ( pFontNames != NULL )
+ {
+ ATSUIInsertFontInSortedList( pFontNames,
+ hSortedFontList,
+ &nSortedFontListLength
+ );
+ } // if
+ } // if
+ } // if
+ } // for
+
+ FontListToHierarchialMenu( hFontMenu,
+ nHierarchiaFontMenuID,
+ hSortedFontList,
+ nSortedFontListLength,
+ rSubmenuCount,
+ hFontMenuLookupCookie
+ );
+
+ for ( nFontIndex = 0;
+ nFontIndex < nSortedFontListLength;
+ nFontIndex++
+ )
+ {
+ if ( hSortedFontList[ nFontIndex ] != NULL )
+ {
+ DisposePtr( (MacOSPtr)hSortedFontList[ nFontIndex ] );
+ } // if
+ } // for
+
+ DisposePtr( (MacOSPtr)hSortedFontList );
+ } // if
+ } // if
+
+ DisposePtr( (MacOSPtr)pFontIDList );
+ } // if
+ } // if
+
+ return nStatus;
+} // ATSUIAppendFontMenu
+
+// -----------------------------------------------------------------------
+
+ATSUFontID ATSUIGetFontForFontMenuItem( short nMenuID,
+ short nMenuItemNum,
+ void *pMenuLookupCookie,
+ ATSUIInstanceIndex *rFontInstance
+ )
+{
+ if ( ( IsPointerValid( (MacOSPtr)pMenuLookupCookie ) )
+ && ( IsPointerValid( (MacOSPtr)rFontInstance ) )
+ )
+ {
+ // Have to search for this font in the data structure we're
+ // about to build.
+
+ FontMenuItemsHandle hFontMenuItems = (FontMenuItemsHandle)pMenuLookupCookie;
+
+ if ( IsHandleValid( (Handle)hFontMenuItems ) )
+ {
+ SInt8 nFlags = noErr;
+
+ nFlags = HGetState( (Handle)hFontMenuItems );
+
+ if ( nFlags == noErr )
+ {
+ short nFontMenuItemHandleSize = GetHandleSize( (Handle)hFontMenuItems );
+ short nFontMenuItemRecSize = sizeof(FontMenuItemRecord);
+ short nMenuEntriesCount = nFontMenuItemHandleSize / nFontMenuItemRecSize;
+ short nMenuEntriesIndex;
+
+ HLock( (Handle)hFontMenuItems );
+
+ // To find the font, perform a linear search.
+
+ for ( nMenuEntriesIndex = 0;
+ nMenuEntriesIndex < nMenuEntriesCount;
+ ++nMenuEntriesIndex
+ )
+ {
+ if ( ( nMenuID == (*hFontMenuItems)[nMenuEntriesIndex ].mnFontMenuID )
+ && ( nMenuItemNum == (*hFontMenuItems)[ nMenuEntriesIndex ].mnFontItemNum )
+ )
+ {
+ if ( rFontInstance != NULL )
+ {
+ *rFontInstance = (*hFontMenuItems)[ nMenuEntriesIndex ].mnFontInstanceIndex;
+ } // if
+
+ // Set font menu items handle state before leaving
+
+ HSetState( (Handle)hFontMenuItems, nFlags );
+
+ return (*hFontMenuItems)[ nMenuEntriesIndex ].mnFontID;
+ } // if
+ } // for
+
+ // If we get here then our linear search yielded no results
+
+ HSetState( (Handle)hFontMenuItems, nFlags );
+ }// if
+ } // if
+ } // if
+
+ // If we get here, either we didn't find the font, an invalid
+ // pointer was passed in, or there was a problem with the handle
+ // we constructed.
+
+ return kATSUInvalidFontID;
+} // ATSUIGetFontForFontMenuItem
+
+// -----------------------------------------------------------------------
+
+OSStatus ATSUIDisposeFontMenuLookupCookie( void *pMenuLookupCookie )
+{
+ OSStatus nStatus = noErr;
+
+ if ( IsHandleValid( (Handle)pMenuLookupCookie ) )
+ {
+ DisposeHandle( (Handle) pMenuLookupCookie );
+
+ nStatus = MemError();
+ } // if
+ else
+ {
+ nStatus = nilHandleErr;
+ } // else
+
+ return nStatus;
+} // ATSUIDisposeFontMenuLookupCookie
+
+// -----------------------------------------------------------------------
+
+OSStatus ATSUISetStyleFontInstance( ATSUStyle aFontStyle,
+ ATSUFontID nFontID,
+ ATSUIInstanceIndex nFontInstanceIndex
+ )
+{
+ ATSUFontVariationValue pFontVariationValues[ kATSUIMaxVariations ];
+ ATSUFontVariationAxis pFontVariationAxis[ kATSUIMaxVariations ];
+ ATSUFontVariationAxis *pClearFontVariations = NULL;
+ ItemCount aClearFontAxisCount = kATSUClearAll;
+ ItemCount nFontVariationsCount = 0;
+ OSStatus nStatus = noErr;
+
+ if ( nFontInstanceIndex == kATSUIDefaultInstance )
+ {
+ nStatus = ATSUClearFontVariations( aFontStyle,
+ aClearFontAxisCount,
+ pClearFontVariations
+ );
+
+ if ( nStatus == noErr )
+ {
+ // If the font has variations, then place the default font
+ // variation values into the style. Doing so, allows one
+ // to deal with font variations in a uniform manner and aid
+ // the glyph cache.
+
+ nStatus = ATSUCountFontVariations( nFontID, &nFontVariationsCount );
+
+ if ( nStatus == noErr )
+ {
+ if ( ( nStatus == noErr )
+ && ( 0 < nFontVariationsCount )
+ && ( nFontVariationsCount < kATSUIMaxVariations )
+ )
+ {
+ ATSUFontVariationValue *pFontVariationMinimumValue = NULL;
+ ATSUFontVariationValue *pFontVariationMaximumValue = NULL;
+ long nFontVariationIndex;
+
+ for ( nFontVariationIndex = 0;
+ nFontVariationIndex < nFontVariationsCount;
+ ++nFontVariationIndex
+ )
+ {
+ nStatus = ATSUGetIndFontVariation( nFontID,
+ nFontVariationIndex,
+ &pFontVariationAxis[ nFontVariationIndex ],
+ pFontVariationMinimumValue,
+ pFontVariationMaximumValue,
+ &pFontVariationValues[ nFontVariationIndex ]
+ );
+
+ if ( nStatus != noErr )
+ {
+ return nStatus;
+ } // if
+ } // for
+
+ nStatus = ATSUSetVariations( aFontStyle,
+ nFontVariationsCount,
+ pFontVariationAxis,
+ pFontVariationValues
+ );
+ } // if
+ } // if
+ } // if
+ } // if
+ else if ( nFontInstanceIndex >= 0 )
+ {
+ ItemCount nFontInstanceIndex = kATSUIMaxVariations;
+
+ nStatus = ATSUGetFontInstance( nFontID,
+ nFontInstanceIndex,
+ nFontInstanceIndex,
+ pFontVariationAxis,
+ pFontVariationValues,
+ &nFontVariationsCount
+ );
+
+ if ( ( nStatus == noErr )
+ && ( nFontVariationsCount < kATSUIMaxVariations )
+ )
+ {
+ nStatus = ATSUClearFontVariations( aFontStyle,
+ aClearFontAxisCount,
+ pClearFontVariations
+ );
+
+ nStatus = ATSUSetVariations( aFontStyle,
+ nFontVariationsCount,
+ pFontVariationAxis,
+ pFontVariationValues
+ );
+ } // if
+ } // else if
+
+ if ( nStatus == noErr )
+ {
+ nStatus = ATSUISetFont( aFontStyle, nFontID );
+ } // if
+
+ return nStatus;
+} // ATSUISetStyleFontInstance
+
+// -----------------------------------------------------------------------
+
+OSStatus ATSUIGetStyleFontInstance( ATSUStyle aFontStyle,
+ ATSUFontID *rFontID,
+ ATSUIInstanceIndex *rFontInstanceIndex
+ )
+{
+ ATSUFontID nFontID = kATSUInvalidFontID;
+ ATSUIInstanceIndex nFontInstanceIndex = 0;
+ ItemCount nFontInstancesCount = 0;
+ ItemCount nFontVariationsCount = 0;
+ OSStatus nStatus = noErr;
+
+ // Determine font attributes including variations and instances
+
+ nStatus = ATSUIGetFont( aFontStyle, &nFontID );
+
+ if ( nStatus == noErr )
+ {
+ if ( nFontID != kATSUInvalidFontID )
+ {
+ nStatus = ATSUCountFontVariations( nFontID, &nFontVariationsCount );
+
+ nStatus = ATSUCountFontInstances( nFontID, &nFontInstancesCount );
+ } // if
+
+ if ( nFontVariationsCount > 0 )
+ {
+ long nFontVariationIndex;
+ ATSUFontVariationAxis pFontVariationAxis[ kATSUIMaxVariations ];
+ ATSUFontVariationValue pFontStyleVaraitionValues[ kATSUIMaxVariations ];
+ ATSUFontVariationValue *pFontVariationMinimumValue = NULL;
+ ATSUFontVariationValue *pFontVariationMaximumValue = NULL;
+ ItemCount nFontStyleVariationCount = 0;
+ MacOSBoolean bFontsDefaultValues = true;
+
+ // First we shall determine the font's variation axis and default
+ // variation values. This will further give us the canonical text
+ // order for the variations.
+
+ for ( nFontVariationIndex = 0;
+ nFontVariationIndex < nFontVariationsCount
+ && nFontVariationIndex < kATSUIMaxVariations;
+ ++nFontVariationIndex
+ )
+ {
+ nStatus = ATSUGetIndFontVariation( nFontID,
+ nFontVariationIndex,
+ &pFontVariationAxis[nFontVariationIndex],
+ pFontVariationMinimumValue,
+ pFontVariationMaximumValue,
+ &pFontStyleVaraitionValues[nFontVariationIndex]
+ );
+
+ if ( nStatus != noErr )
+ {
+ break;
+ } // if
+ } // if
+
+ if ( nStatus == noErr )
+ {
+ // Here we shall determine all of particular font's style variations.
+ // Also, we shall note whether or not these values are default font
+ // settings. Furthermore, we shall only proceed if the there are
+ // no variations in the style.
+
+ nStatus = ATSUICountStyleFontVariations( aFontStyle, &nFontStyleVariationCount );
+
+ if ( ( nStatus == noErr )
+ && ( nFontStyleVariationCount > 0 )
+ )
+ {
+ ATSUFontVariationValue aFontVariationValue = 0;
+
+ for ( nFontVariationIndex = 0;
+ nFontVariationIndex < nFontVariationsCount;
+ ++nFontVariationIndex
+ )
+ {
+ nStatus = ATSUGetFontVariationValue( aFontStyle,
+ pFontVariationAxis[nFontVariationIndex],
+ &aFontVariationValue
+ );
+
+ if ( ( nStatus == noErr )
+ && ( aFontVariationValue != pFontStyleVaraitionValues[nFontVariationIndex] )
+ )
+ {
+ // If the value's not been set, the we shall treat this as an error.
+
+ pFontStyleVaraitionValues[nFontVariationIndex] = aFontVariationValue;
+
+ bFontsDefaultValues = false;
+ }
+ }
+ } // if
+
+ // Do the search.
+
+ nFontInstanceIndex = ATSUIInstanceMatchingVariations( nFontID,
+ nFontVariationsCount,
+ pFontStyleVaraitionValues
+ );
+
+ // The current settings may match the defaults, for which there
+ // may not have been a named instance index.
+
+ if ( ( nFontInstanceIndex == kATSUINotAnInstance )
+ && ( bFontsDefaultValues )
+ )
+ {
+ nFontInstanceIndex = kATSUIDefaultInstance;
+ } // if
+ } // if
+ } // if
+ else
+ {
+ nFontInstanceIndex = kATSUIDefaultInstance;
+ } // else
+
+ if ( rFontID != NULL )
+ {
+ *rFontID = nFontID;
+ } // if
+
+ if ( rFontInstanceIndex != NULL )
+ {
+ *rFontInstanceIndex = nFontInstanceIndex;
+ } // if
+ } // if
+
+ return nStatus;
+} // ATSUIGetStyleFontInstance
+
+// -----------------------------------------------------------------------
+//
+// Determines if the first font encoding is a better choice than the
+// second font encoding.
+//
+// -----------------------------------------------------------------------
+
+static MacOSBoolean ATSUIBetterEncoding( const FontNameEncodingPtr pFontNewNameEncoding,
+ const FontNameEncodingPtr pFontOldNameEncoding,
+ const FontNameEncodingPtr pFontFamilyNameEncodingPrefs
+ )
+{
+ MacOSBoolean bCheckPlatform = false;
+ MacOSBoolean bCheckScript = false;
+ MacOSBoolean bCheckLanguage = false;
+
+ if ( EncodingMatchesPrefs( *pFontNewNameEncoding, *pFontFamilyNameEncodingPrefs )
+ && EncodingMatchesPrefs( *pFontOldNameEncoding, *pFontFamilyNameEncodingPrefs )
+ )
+ {
+ // If both font names match the font family name encoding preferences,
+ // then determine which elements need to be compared.
+
+ bCheckPlatform = pFontFamilyNameEncodingPrefs->mnFontPlatformCode == kFontNoPlatform;
+ bCheckScript = pFontFamilyNameEncodingPrefs->mnFontScriptCode == kFontNoScript;
+ bCheckLanguage = pFontFamilyNameEncodingPrefs->mnFontLanguageCode == kFontNoLanguage;
+ } // if
+ else if ( EncodingMatchesPrefs( *pFontOldNameEncoding, *pFontFamilyNameEncodingPrefs ) )
+ {
+ // If only one name matches the font family name encoding preferences,
+ // then we like that one better.
+
+ return false;
+ } // else if
+ else if ( EncodingMatchesPrefs( *pFontNewNameEncoding, *pFontFamilyNameEncodingPrefs ) )
+ {
+ return true;
+ } // else if
+ else
+ {
+ // If neither matches the font family name encoding preferences,
+ // then we have no choice but to compare everything.
+
+ bCheckPlatform = true;
+ bCheckScript = true;
+ bCheckLanguage = true;
+ } // else
+
+ // We have to compare everything.
+ //
+ // Should language have priority over platform or script?
+
+ if ( ( bCheckPlatform )
+ && ( pFontNewNameEncoding->mnFontPlatformCode != pFontOldNameEncoding->mnFontPlatformCode )
+ )
+ {
+ if ( pFontOldNameEncoding->mnFontPlatformCode == kFontMacintoshPlatform )
+ {
+ // We like Macintosh font names best
+
+ return false;
+ } // if
+ else if ( pFontNewNameEncoding->mnFontPlatformCode == kFontMacintoshPlatform )
+ {
+ return true;
+ } // else if
+ else if ( pFontOldNameEncoding->mnFontPlatformCode == kFontUnicodePlatform )
+ {
+ // Unicode font names are the next best thing
+
+ return false;
+ } // else if
+ else if ( pFontNewNameEncoding->mnFontPlatformCode == kFontUnicodePlatform )
+ {
+ return true;
+ } // else
+
+ // If it's neither Unicode font nor Macintosh font,
+ // then it's not important to us the kind of font
+ // we have been processing.
+ } // if
+
+ // Font script is meaningful if and only if it is associated with
+ // a particular platform. Whence, the fonts can be compared if
+ // the platforms are the same.
+
+ if ( ( bCheckScript )
+ && ( pFontNewNameEncoding->mnFontPlatformCode == pFontOldNameEncoding->mnFontPlatformCode )
+ && ( pFontNewNameEncoding->mnFontScriptCode != pFontOldNameEncoding->mnFontScriptCode )
+ )
+ {
+ if ( pFontNewNameEncoding->mnFontPlatformCode == kFontMacintoshPlatform )
+ {
+ short nFontScriptOrder = 0;
+ MacOSBoolean bFontScriptOrder = false;
+
+ // For Macintosh scripts, we use the system script text order.
+ // Since we know that the scripts are different, we can exit
+ // this API at this juncture.
+
+ nFontScriptOrder = ScriptOrder( pFontNewNameEncoding->mnFontScriptCode,
+ pFontOldNameEncoding->mnFontScriptCode
+ );
+
+ bFontScriptOrder = nFontScriptOrder < 0;
+
+ return bFontScriptOrder;
+ }
+ // No preference otherwise.
+ } // if
+
+ // Font language codes are (so far) identical to the standard Mac
+ // language codes, hence we can just use language order to determine
+ // a preference regardless of the encoding.
+
+ if ( ( bCheckLanguage )
+ && ( pFontNewNameEncoding->mnFontLanguageCode
+ != pFontOldNameEncoding->mnFontLanguageCode
+ )
+ )
+ {
+ short nFontLanguageOrder = 0;
+ MacOSBoolean bFontLanguageOrder = false;
+
+ // For Macintosh languages, we use the system language order.
+ // Since we know that the languages are different, we can exit
+ // this API at this juncture.
+
+ nFontLanguageOrder = LanguageOrder( pFontNewNameEncoding->mnFontLanguageCode,
+ pFontOldNameEncoding->mnFontLanguageCode
+ );
+
+ bFontLanguageOrder = nFontLanguageOrder < 0;
+
+ return bFontLanguageOrder;
+ } // if
+
+ // If no better matches were discovered, return the earlier one.
+
+ return false;
+} // ATSUIBetterEncoding
+
+// -----------------------------------------------------------------------
+//
+// Given a font and name code, a preference for platform, script and
+// language, and font variation values, determine the best match
+// for the current system.
+//
+// -----------------------------------------------------------------------
+
+OSStatus ATSUIFindBestFontName( ATSUFontID nFontID,
+ FontNameCode nFontNameCode,
+ FontPlatformCode *rFontPlatformCode,
+ FontScriptCode *rFontScriptCode,
+ FontLanguageCode *rFontLanguageCode,
+ ByteCount nFontMaxNameLength,
+ MacOSPtr rFontName,
+ ByteCount *rFontNameLength,
+ ItemCount *rFontNameIndex
+ )
+{
+ OSStatus nStatus = kATSUFontsNotMatched;
+ MacOSBoolean bScriptWithoutPlatform = false;
+ FontNameEncodingRecord aFontFamilyNameEncodingPrefs;
+
+ aFontFamilyNameEncodingPrefs.mnFontPlatformCode = *rFontPlatformCode;
+ aFontFamilyNameEncodingPrefs.mnFontScriptCode = *rFontScriptCode;
+ aFontFamilyNameEncodingPrefs.mnFontLanguageCode = *rFontLanguageCode;
+
+ // Script without a platform, is meaningless, so make sure
+ // one is provided if required.
+
+ bScriptWithoutPlatform = ( *rFontScriptCode != kFontNoScript )
+ && ( *rFontPlatformCode == kFontNoPlatform );
+
+ if ( !bScriptWithoutPlatform )
+ {
+ // If a specific name was requested, t.hen try to find a
+ // match with that specific name.
+
+ if ( ( *rFontPlatformCode != kFontNoPlatform )
+ && ( *rFontScriptCode != kFontNoScript )
+ && ( *rFontLanguageCode != kFontNoLanguage )
+ )
+ {
+ nStatus = ATSUFindFontName( nFontID,
+ nFontNameCode,
+ *rFontPlatformCode,
+ *rFontScriptCode,
+ *rFontLanguageCode,
+ nFontMaxNameLength,
+ rFontName,
+ rFontNameLength,
+ rFontNameIndex
+ );
+ }
+
+ // If at first we were unsuccessful, then search the name table.
+
+ if ( nStatus != noErr )
+ {
+ FontNameEncodingRecord aBestFontNameEncoding;
+ FontNameCode *pFontNameCode = NULL;
+ FontPlatformCode nFontNamePlatformCode = kFontNoPlatform;
+ FontScriptCode nFontNameScriptCode = kFontNoScript;
+ FontLanguageCode nFontNameLanguageCode = kFontNoLanguage;
+ ItemCount nBestFontIndex = ULONG_MAX;
+ ItemCount nNextFontIndex = 0;
+ ItemCount nFontNamesCount = 0;
+ ByteCount nFontExpectedNameLength = 0;
+ ByteCount *pFontActualNameLength = NULL;
+ MacOSPtr pFontName = NULL;
+
+ // Firstly, check to see if there are any names at all with
+ // the given code. Store the attributes associated with that
+ // name. This will be used be as our initial guess.
+
+ nStatus = ATSUFindFontName( nFontID,
+ nFontNameCode,
+ nFontNamePlatformCode,
+ nFontNameScriptCode,
+ nFontNameLanguageCode,
+ nFontExpectedNameLength,
+ pFontName,
+ pFontActualNameLength,
+ &nBestFontIndex
+ );
+
+ if ( nStatus == noErr )
+ {
+ nNextFontIndex = nBestFontIndex + 1;
+
+ nStatus = ATSUGetIndFontName( nFontID,
+ nBestFontIndex,
+ nFontExpectedNameLength,
+ pFontName,
+ pFontActualNameLength,
+ pFontNameCode,
+ &aBestFontNameEncoding.mnFontPlatformCode,
+ &aBestFontNameEncoding.mnFontScriptCode,
+ &aBestFontNameEncoding.mnFontLanguageCode
+ );
+ }
+
+ // Now go through the rest of the names by comparing them with
+ // our best guess so far. The proceeding search will yield
+ // the initial best guess, and as a result we can proceed with
+ // our search starting at the next index.
+
+ nStatus = ATSUCountFontNames( nFontID, &nFontNamesCount );
+
+ while ( ( nStatus == noErr )
+ && ( nNextFontIndex < nFontNamesCount )
+ )
+ {
+ FontNameEncodingRecord aNextFontNameEncoding;
+ FontNameCode nNextFontNameCode = 0;
+ MacOSBoolean bGotBetterFontEncoding = false;
+
+ nStatus = ATSUGetIndFontName( nFontID,
+ nNextFontIndex,
+ nFontExpectedNameLength,
+ pFontName,
+ pFontActualNameLength,
+ &nNextFontNameCode,
+ &aNextFontNameEncoding.mnFontPlatformCode,
+ &aNextFontNameEncoding.mnFontScriptCode,
+ &aNextFontNameEncoding.mnFontLanguageCode
+ );
+
+ bGotBetterFontEncoding = ATSUIBetterEncoding( &aNextFontNameEncoding,
+ &aBestFontNameEncoding,
+ &aFontFamilyNameEncodingPrefs
+ );
+
+ if ( ( nStatus == noErr )
+ && ( nNextFontNameCode == nFontNameCode )
+ && ( bGotBetterFontEncoding )
+ )
+ {
+ nBestFontIndex = nNextFontIndex;
+ aBestFontNameEncoding = aNextFontNameEncoding;
+ }
+
+ ++nNextFontIndex;
+ }
+
+ if ( nStatus == noErr )
+ {
+ // If we have gotten this far, then we do have a good candidate
+
+ *rFontNameIndex = nBestFontIndex;
+ *rFontPlatformCode = aBestFontNameEncoding.mnFontPlatformCode;
+ *rFontScriptCode = aBestFontNameEncoding.mnFontScriptCode;
+ *rFontLanguageCode = aBestFontNameEncoding.mnFontLanguageCode;
+
+ if ( rFontName || rFontNameLength )
+ {
+ FontPlatformCode *pFontNamePlatformCode = NULL;
+ FontScriptCode *pFontNameScriptCode = NULL;
+ FontLanguageCode *pFontNameLanguageCode = NULL;
+
+ nStatus = ATSUGetIndFontName( nFontID,
+ nBestFontIndex,
+ nFontMaxNameLength,
+ rFontName,
+ rFontNameLength,
+ pFontNameCode,
+ pFontNamePlatformCode,
+ pFontNameScriptCode,
+ pFontNameLanguageCode
+ );
+ } // if
+ } // if
+ } // if
+ } //if
+
+ return nStatus;
+} // ATSUIFindBestFontName
+
+// -----------------------------------------------------------------------
+
+OSStatus ATSUIFONDtoFontID( short nFONDNumber,
+ StyleParameter nFONDStyle,
+ ATSUFontID *rFontID,
+ StyleParameter *rIntrinsicStyleParameter
+ )
+{
+ OSStatus nStatus = noErr;
+
+ nStatus = FMGetFontFromFontFamilyInstance( nFONDNumber,
+ nFONDStyle,
+ rFontID,
+ rIntrinsicStyleParameter
+ );
+
+ return nStatus;
+} // ATSUIFONDtoFontID
+
+// -----------------------------------------------------------------------
+
+void ATSUIPrintFontList( const ItemCount nFontItemsCount,
+ FontNamesMatrix hFontList
+ )
+{
+ if ( IsPointerValid( (MacOSPtr)hFontList ) )
+ {
+ const void *pFontNames[2] = { NULL, NULL };
+ long i = 0;
+ long j = 0;
+ long k = 0;
+ long nTextOrder = 0;
+ short pFontFamilyLength[2] = { 0, 0 };
+ LangCode pFontFamilyLangCode[2] = { currentDefLang, currentDefLang };
+ ScriptCode pFontFamilyScriptCode[2] = { smRoman, smRoman };
+ char pFontFamilyStyle[kFontStyleNameLength];
+ char pFontFamilyName[kFontFamilyNameLength];
+
+ while ( i < nFontItemsCount )
+ {
+ for ( j = i + 1;
+ j < nFontItemsCount;
+ j++
+ )
+ {
+ pFontNames[0] = &hFontList[ i ]->mpFontName[ 0 ];
+ pFontNames[1] = &hFontList[ j ]->mpFontName[ 0 ];
+ pFontFamilyLength[0] = hFontList[ i ]->maFontFamilyNameEncoding.mnFontItemCount;
+ pFontFamilyLength[1] = hFontList[ j ]->maFontFamilyNameEncoding.mnFontItemCount;
+ pFontFamilyScriptCode[0] = hFontList[ i ]->maFontFamilyNameEncoding.mnFontScriptCode;
+ pFontFamilyScriptCode[1] = hFontList[ j ]->maFontFamilyNameEncoding.mnFontScriptCode;
+
+ nTextOrder = TextOrder( pFontNames[0],
+ pFontNames[1],
+ pFontFamilyLength[0],
+ pFontFamilyLength[1],
+ pFontFamilyScriptCode[0],
+ pFontFamilyScriptCode[1],
+ pFontFamilyLangCode[0],
+ pFontFamilyLangCode[1]
+ );
+
+ if ( nTextOrder != 0 )
+ {
+ break;
+ } // if
+ } // for
+
+ memset( pFontFamilyName, 0, kFontFamilyNameMemSize );
+
+ strncpy( pFontFamilyName,
+ &hFontList[ i ]->mpFontName[ 0 ],
+ hFontList[ i ]->mnFontStyleByteOffset
+ );
+
+ printf( "%s ", pFontFamilyName );
+
+ if ( j - i > 1 )
+ {
+ for ( k = i; k < j; k++ )
+ {
+ strcpy( pFontFamilyStyle,
+ &hFontList[ k ]->mpFontName[ hFontList[ k ]->mnFontStyleByteOffset ]
+ );
+
+ printf( "%s ", pFontFamilyStyle );
+ } // for
+ } // if
+
+ printf( "\n " );
+
+ i = j; // next family name
+ } // while
+ } // if
+} // ATSUIPrintFontList
+
+// -----------------------------------------------------------------------
+
+void ATSUIFPrintFontList( const char *pFileName,
+ const char *pFilePermission,
+ const ItemCount nFontItemsCount,
+ FontNamesMatrix hFontList
+ )
+{
+ FILE *pFileStream = NULL;
+
+ if ( pFileName != NULL )
+ {
+ if ( pFilePermission == NULL )
+ {
+ pFileStream = fopen( pFileName, "w" );
+ } // if
+ else
+ {
+ pFileStream = fopen( pFileName, pFilePermission );
+ } // else
+
+ if ( ( pFileStream != NULL )
+ && ( IsPointerValid( (MacOSPtr)hFontList ) )
+ )
+ {
+ const void *pFontNames[2] = { NULL, NULL };
+ long i = 0;
+ long j = 0;
+ long k = 0;
+ long nTextOrder = 0;
+ short pFontFamilyLength[2] = { 0, 0 };
+ LangCode pFontFamilyLangCode[2] = { currentDefLang, currentDefLang };
+ ScriptCode pFontFamilyScriptCode[2] = { smRoman, smRoman };
+ char pFontFamilyStyle[kFontStyleNameLength];
+ char pFontFamilyName[kFontFamilyNameLength];
+
+ while ( i < nFontItemsCount )
+ {
+ for ( j = i + 1;
+ j < nFontItemsCount;
+ j++
+ )
+ {
+ pFontNames[0] = &hFontList[ i ]->mpFontName[ 0 ];
+ pFontNames[1] = &hFontList[ j ]->mpFontName[ 0 ];
+ pFontFamilyLength[0] = hFontList[ i ]->maFontFamilyNameEncoding.mnFontItemCount;
+ pFontFamilyLength[1] = hFontList[ j ]->maFontFamilyNameEncoding.mnFontItemCount;
+ pFontFamilyScriptCode[0] = hFontList[ i ]->maFontFamilyNameEncoding.mnFontScriptCode;
+ pFontFamilyScriptCode[1] = hFontList[ j ]->maFontFamilyNameEncoding.mnFontScriptCode;
+
+ nTextOrder = TextOrder( pFontNames[0],
+ pFontNames[1],
+ pFontFamilyLength[0],
+ pFontFamilyLength[1],
+ pFontFamilyScriptCode[0],
+ pFontFamilyScriptCode[1],
+ pFontFamilyLangCode[0],
+ pFontFamilyLangCode[1]
+ );
+
+ if ( nTextOrder != 0 )
+ {
+ break;
+ } // if
+ } // for
+
+ memset( pFontFamilyName, 0, kFontFamilyNameMemSize );
+
+ strncpy( pFontFamilyName,
+ &hFontList[ i ]->mpFontName[ 0 ],
+ hFontList[ i ]->mnFontStyleByteOffset
+ );
+
+ fprintf( pFileStream, "%s ", pFontFamilyName );
+
+ if ( j - i > 1 )
+ {
+ for ( k = i; k < j; k++ )
+ {
+ strcpy( pFontFamilyStyle,
+ &hFontList[ k ]->mpFontName[ hFontList[ k ]->mnFontStyleByteOffset ]
+ );
+
+ fprintf( pFileStream, "%s ", pFontFamilyStyle );
+ } // for
+ } // if
+
+ fprintf( pFileStream, "\n" );
+
+ i = j; // next family name
+ } // while
+
+ fclose( pFileStream );
+ } // if
+ } // if
+} // ATSUIFPrintFontList
+
+// -----------------------------------------------------------------------
+//
+// Here we shall construct a font list.
+//
+// Note that:
+//
+// * If there's only one representative of a family, we shall insert the
+// full font name into the list instead of only the family name. We can
+// not determine this immediately until all the fonts are sorted.
+//
+// * If there are multiple fonts with the same name, all but the first
+// occurance of this particular font is kept.
+//
+// -----------------------------------------------------------------------
+
+FontNamesMatrix ATSUIGetFontNames( ItemCount *rSortedFontListLength )
+{
+ FontNamesMatrix hSortedFontList = NULL;
+ ItemCount nFontItemsSize = 0;
+ OSStatus nStatus = noErr;
+
+ nStatus = ATSUFontCount( &nFontItemsSize );
+
+ if ( ( nStatus == noErr )
+ && ( nFontItemsSize > 0 )
+ )
+ {
+ ATSUFontID *pFontIDList = NULL;
+ long nFontIDListSize = nFontItemsSize * sizeof(ATSUFontID);
+
+ pFontIDList = (ATSUFontID *)NewPtrClear( nFontIDListSize );
+
+ nStatus = MemError();
+
+ if ( ( nStatus == noErr )
+ && ( IsPointerValid( (MacOSPtr)pFontIDList ) )
+ )
+ {
+ ItemCount *pFontItemsCount = NULL;
+
+ nStatus = ATSUGetFontIDs( pFontIDList,
+ nFontItemsSize,
+ pFontItemsCount
+ );
+
+ if ( nStatus == noErr )
+ {
+ long nSortedFontListSize = 0;
+ ItemCount nTotalFontInstances = 0;
+
+ nTotalFontInstances
+ = ATSUILookForFontInstances( pFontIDList,
+ nFontItemsSize
+ );
+
+ // This might be too much because of "bad" fonts, but
+ // it's guaranteed to be big enough.
+
+ nSortedFontListSize = (nFontItemsSize + nTotalFontInstances)
+ * sizeof(FontNamesPtr);
+
+ hSortedFontList = (FontNamesMatrix)NewPtrClear( nSortedFontListSize );
+
+ nStatus = MemError();
+
+ if ( ( nStatus == noErr )
+ && ( IsPointerValid( (MacOSPtr)hSortedFontList ) )
+ )
+ {
+ ATSUIInstanceIndex nFontInstanceIndex = 0;
+ FontNamesPtr pFontNames = NULL;
+ FontNameCode nFontInstanceNameCode = 0;
+ ItemCount nFontInstance = 0;
+ ItemCount nFontInstancesCount = 0;
+ ItemCount nFontIndex;
+
+ for ( nFontIndex = 0;
+ nFontIndex < nFontItemsSize;
+ nFontIndex++
+ )
+ {
+ if ( pFontIDList[ nFontIndex ] != kATSUInvalidFontID )
+ {
+ // Add the font's instances to the name list, if any.
+
+ nStatus = ATSUCountFontInstances( pFontIDList[ nFontIndex ],
+ &nFontInstancesCount
+ );
+
+ for ( nFontInstance = 0;
+ nFontInstance < nFontInstancesCount;
+ ++nFontInstance
+ )
+ {
+ nStatus = ATSUGetFontInstanceNameCode( pFontIDList[ nFontIndex ],
+ nFontInstance,
+ &nFontInstanceNameCode
+ );
+
+ if ( nStatus == noErr )
+ {
+ pFontNames = ATSUIBuildFontNamesRecord( pFontIDList[ nFontIndex ],
+ nFontInstance,
+ nFontInstanceNameCode
+ );
+
+ if ( pFontNames != NULL )
+ {
+ ATSUIInsertFontInSortedList( pFontNames,
+ hSortedFontList,
+ rSortedFontListLength
+ );
+ } // if
+ } // if
+ } // if
+
+ // Add the font itself. If it happens to have the same name as an nFontInstanceIndex,
+ // it'll be skipped until we figure out what to do about name clashes.
+
+ nFontInstanceIndex
+ = ATSUIInstanceMatchingDefaultVariations( pFontIDList[ nFontIndex ] );
+
+ if ( nFontInstanceIndex == kATSUIDefaultInstance )
+ {
+ pFontNames = ATSUIBuildFontNamesRecord( pFontIDList[ nFontIndex ],
+ kATSUIDefaultInstance,
+ kFontStyleName
+ );
+
+ if ( pFontNames != NULL )
+ {
+ ATSUIInsertFontInSortedList( pFontNames,
+ hSortedFontList,
+ rSortedFontListLength
+ );
+ } // if
+ } // if
+ } // if
+ } // for
+ } // if
+ } // if
+
+ DisposePtr( (MacOSPtr)pFontIDList );
+ } // if
+ } // if
+
+ return hSortedFontList;
+} // ATSUIPrintFonts
+
+// -----------------------------------------------------------------------
+
+OSStatus ATSUIDisposeFontNames( const ItemCount nFontListLength,
+ FontNamesMatrix hFontNames
+ )
+{
+ OSStatus nStatus = noErr;
+
+ if ( ( nFontListLength > 0 )
+ && ( IsPointerValid( (MacOSPtr)hFontNames ) )
+ )
+ {
+ ItemCount nFontIndex;
+
+ for ( nFontIndex = 0;
+ nFontIndex < nFontListLength;
+ nFontIndex++
+ )
+ {
+ if ( IsPointerValid( (MacOSPtr)hFontNames[ nFontIndex ] ) )
+ {
+ DisposePtr( (MacOSPtr)hFontNames[ nFontIndex ] );
+ } // if
+ } // for
+
+ DisposePtr( (MacOSPtr)hFontNames );
+
+ nStatus = MemError();
+
+ hFontNames = NULL;
+ } // if
+
+ return nStatus;
+} // ATSUIDisposeFontNames
+
+// =======================================================================
+
+// =======================================================================
+
diff --git a/vcl/aqua/source/gdi/salbmp.cxx b/vcl/aqua/source/gdi/salbmp.cxx
index 945f09b3c8d4..9259736b4e01 100644
--- a/vcl/aqua/source/gdi/salbmp.cxx
+++ b/vcl/aqua/source/gdi/salbmp.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: salbmp.cxx,v $
*
- * $Revision: 1.20 $
+ * $Revision: 1.21 $
*
- * last change: $Author: bmahbod $ $Date: 2001-02-14 19:39:49 $
+ * last change: $Author: bmahbod $ $Date: 2001-03-12 23:15:32 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -61,40 +61,8 @@
#define _SV_SALBMP_CXX
-#ifndef _SV_SALCONST_H
-#include <salconst.h>
-#endif
-
#ifndef _SV_SALBMP_HXX
-#include <salbmp.hxx>
-#endif
-
-#ifndef _SV_SALBTYPE_HXX
-#include <salbtype.hxx>
-#endif
-
-#ifndef _SV_SALDATA_HXX
-#include <saldata.hxx>
-#endif
-
-#ifndef _SV_SALINST_HXX
-#include <salinst.hxx>
-#endif
-
-#ifndef _SV_SALVD_HXX
-#include <salvd.hxx>
-#endif
-
-#ifndef _SV_SALCOLORUTILS_HXX
-#include <salcolorutils.hxx>
-#endif
-
-#ifndef _SV_SALPIXMAPUTILS_HXX
-#include <salpixmaputils.hxx>
-#endif
-
-#ifndef _SV_SALRECTANGLEUTILS_HXX
-#include <salrectangleutils.hxx>
+ #include <salbmp.hxx>
#endif
// =======================================================================
@@ -164,7 +132,7 @@ BOOL SalBitmap::Create( const Size& rSize,
if ( ( mhPixMap != NULL ) && ( *mhPixMap != NULL ) )
{
mnBitCount = GetPixDepth( mhPixMap);
- maSize = rSize;
+ mnSize = rSize;
bSalBitmapCreated = TRUE;
} // if
@@ -233,7 +201,7 @@ BOOL SalBitmap::Create( const SalBitmap& rSalBmp, USHORT nNewBitCount )
{
BOOL bSalBitmapCreated = FALSE;
- if ( Create( rSalBmp.maSize, nNewBitCount, BitmapPalette() ) )
+ if ( Create( rSalBmp.mnSize, nNewBitCount, BitmapPalette() ) )
{
// Copy pixels from rSalBmp.mpVirDev to mpVirDev
@@ -283,7 +251,7 @@ void SalBitmap::Destroy()
} // if
mhPixMap = NULL;
- maSize = Size();
+ mnSize = Size();
mnBitCount = 0;
} // if
} // SalBitmap::Destroy
diff --git a/vcl/aqua/source/gdi/salcolorutils.cxx b/vcl/aqua/source/gdi/salcolorutils.cxx
index 7800c2f26aa3..a6d0480ab48c 100755
--- a/vcl/aqua/source/gdi/salcolorutils.cxx
+++ b/vcl/aqua/source/gdi/salcolorutils.cxx
@@ -2,8 +2,8 @@
*
* $RCSfile: salcolorutils.cxx,v $
*
- * $Revision: 1.2 $
- * last change: $Author: bmahbod $ $Date: 2001-02-26 20:02:27 $
+ * $Revision: 1.3 $
+ * last change: $Author: bmahbod $ $Date: 2001-03-12 23:15:32 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -60,16 +60,8 @@
#define _SV_SALCOLORUTILS_CXX
-#ifndef _SV_SALCONST_H
-#include <salconst.h>
-#endif
-
-#ifndef _SV_SALCOLORUTILS_HXX
-#include <salmathutils.hxx>
-#endif
-
#ifndef _SV_SALCOLORUTILS_HXX
-#include <salcolorutils.hxx>
+ #include <salcolorutils.hxx>
#endif
// =======================================================================
diff --git a/vcl/aqua/source/gdi/salgdi.cxx b/vcl/aqua/source/gdi/salgdi.cxx
index f3529a7ee632..95ae71208cfb 100644
--- a/vcl/aqua/source/gdi/salgdi.cxx
+++ b/vcl/aqua/source/gdi/salgdi.cxx
@@ -2,8 +2,8 @@
*
* $RCSfile: salgdi.cxx,v $
*
- * $Revision: 1.52 $
- * last change: $Author: bmahbod $ $Date: 2001-02-21 20:48:46 $
+ * $Revision: 1.53 $
+ * last change: $Author: bmahbod $ $Date: 2001-03-12 23:15:32 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -57,46 +57,41 @@
*
*
************************************************************************/
-
#define _SV_SALGDI_CXX
#ifndef _SV_SALCONST_H
-#include <salconst.h>
-#endif
-
-#ifndef _SV_SALBMP_HXX
-#include <salbmp.hxx>
-#endif
-
-#ifndef _SV_SALDATA_HXX
-#include <saldata.hxx>
+ #include <salconst.h>
#endif
-#ifndef _SV_SALGDI_HXX
-#include <salgdi.hxx>
+#ifndef _SV_SALGDI_H
+ #include <salgdi.h>
#endif
-#ifndef _SV_OUTFONT_HXX
-#include <outfont.hxx>
+#ifndef _SV_SALBMP_HXX
+ #include <salbmp.hxx>
#endif
#ifndef _SV_VCLGRAPHICS_H
-#include <VCLGraphics.h>
+ #include <VCLGraphics.h>
#endif
#ifndef _SV_SALCOLORUTILS_HXX
-#include <salcolorutils.hxx>
+ #include <salcolorutils.hxx>
#endif
-#ifndef _SV_SALRECTANGLEUTILS_HXX
-#include <salrectangleutils.hxx>
+#ifndef _SV_SALFONTUTILS_HXX
+ #include <salfontutils.hxx>
#endif
#ifndef _SV_SALGDIUTILS_HXX
-#include <salgdiutils.hxx>
+ #include <salgdiutils.hxx>
#endif
-// =======================================================================
+#ifndef _SV_SALRECTANGLEUTILS_HXX
+ #include <salrectangleutils.hxx>
+#endif
+
+#if PRAGMA_ONCE #pragma once #endif // =======================================================================
// =======================================================================
@@ -1310,18 +1305,54 @@ ULONG SalGraphics::GetKernPairs( ULONG nPairs,
// -----------------------------------------------------------------------
-void SalGraphics::GetDevFontList( ImplDevFontList* pList )
+void SalGraphics::GetDevFontList( ImplDevFontList *pList )
{
- ImplFontData *pFontData = new ImplFontData;
+ if ( pList != NULL )
+ {
+ SalData *pSalData = GetSalData();
- pFontData->mnWidth = 10;
- pFontData->mnHeight = 10;
+ if ( pSalData != NULL )
+ {
+ FontList *pMacFontList = NULL;
+ ImplFontData *pDevFontData = NULL;
+ ImplFontData *pSysFontData = NULL;
- pList->Add( pFontData );
+ if ( pSalData->mpFontList != NULL )
+ {
+ pSalData->mpFontList = GetMacFontList();
- fprintf( stderr,
- "<<WARNING>> SalGraphics::GetDevFontList not yet implemented!\n"
- );
+ pMacFontList = pSalData->mpFontList;
+ pSysFontData = pMacFontList->First();
+
+ while ( pSysFontData != NULL )
+ {
+ pDevFontData = new ImplFontData;
+
+ pDevFontData->mpSysData = pSysFontData;
+ pDevFontData->maName = pSysFontData->maName;
+ pDevFontData->maStyleName = pSysFontData->maStyleName;
+ pDevFontData->mnWidth = pSysFontData->mnWidth;
+ pDevFontData->mnHeight = pSysFontData->mnHeight;
+ pDevFontData->meFamily = pSysFontData->meFamily;
+ pDevFontData->meCharSet = pSysFontData->meCharSet;
+ pDevFontData->meScript = pSysFontData->meScript;
+ pDevFontData->mePitch = pSysFontData->mePitch;
+ pDevFontData->meWidthType = pSysFontData->meWidthType;
+ pDevFontData->meWeight = pSysFontData->meWeight;
+ pDevFontData->meItalic = pSysFontData->meItalic;
+ pDevFontData->meType = pSysFontData->meType;
+ pDevFontData->mnVerticalOrientation = pSysFontData->mnVerticalOrientation;
+ pDevFontData->mbOrientation = pSysFontData->mbOrientation;
+ pDevFontData->mbDevice = pSysFontData->mbDevice;
+ pDevFontData->mnQuality = pSysFontData->mnQuality;
+
+ pList->Add( pDevFontData );
+
+ pSysFontData = pMacFontList->Next();
+ } // while
+ } // if
+ } // if
+ } // if
} // SalGraphics::GetDevFontList
// -----------------------------------------------------------------------
diff --git a/vcl/aqua/source/gdi/salgdiutils.cxx b/vcl/aqua/source/gdi/salgdiutils.cxx
index 4a000a8641f3..8ac31ca71cbb 100755
--- a/vcl/aqua/source/gdi/salgdiutils.cxx
+++ b/vcl/aqua/source/gdi/salgdiutils.cxx
@@ -2,8 +2,8 @@
*
* $RCSfile: salgdiutils.cxx,v $
*
- * $Revision: 1.3 $
- * last change: $Author: bmahbod $ $Date: 2001-02-21 20:48:46 $
+ * $Revision: 1.4 $
+ * last change: $Author: bmahbod $ $Date: 2001-03-12 23:15:32 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -60,28 +60,8 @@
#define _SV_SALGDIUTILS_CXX
-#ifndef _SV_SALCONST_H
-#include <salconst.h>
-#endif
-
-#ifndef _SV_SALDATA_HXX
-#include <saldata.hxx>
-#endif
-
-#ifndef _SV_SALGDI_HXX
-#include <salgdi.hxx>
-#endif
-
-#ifndef _SV_VCLGRAPHICS_H
-#include <VCLGraphics.h>
-#endif
-
-#ifndef _SV_SALCOLORUTILS_HXX
-#include <salcolorutils.hxx>
-#endif
-
#ifndef _SV_SALGDIUTILS_HXX
-#include <salgdiutils.hxx>
+ #include <salgdiutils.hxx>
#endif
// =======================================================================
diff --git a/vcl/aqua/source/gdi/salmathutils.cxx b/vcl/aqua/source/gdi/salmathutils.cxx
index a62e1d6ffc0c..99247aaaa6f9 100755
--- a/vcl/aqua/source/gdi/salmathutils.cxx
+++ b/vcl/aqua/source/gdi/salmathutils.cxx
@@ -2,8 +2,8 @@
*
* $RCSfile: salmathutils.cxx,v $
*
- * $Revision: 1.1 $
- * last change: $Author: bmahbod $ $Date: 2001-02-14 19:39:49 $
+ * $Revision: 1.2 $
+ * last change: $Author: bmahbod $ $Date: 2001-03-12 23:15:32 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -60,21 +60,25 @@
#define _SV_SALMATHUTILS_CXX
-#ifndef _SV_SALCOLORUTILS_HXX
-#include <salmathutils.hxx>
+#ifndef _SV_SALMATHUTILS_HXX
+ #include <salmathutils.hxx>
#endif
// =======================================================================
// =======================================================================
+#define Swap( x, y ) { x ^= y; y ^= x; x ^= y; }
+
+// =======================================================================
+
+// =======================================================================
+
// Storage free swapping using XOR
void CSwap ( char &rX, char &rY )
{
- rX ^= rY;
- rY ^= rX;
- rX ^= rY;
+ Swap( rX, rY );
} // CSwap
// -----------------------------------------------------------------------
@@ -83,9 +87,7 @@ void CSwap ( char &rX, char &rY )
void UCSwap ( unsigned char &rX, unsigned char &rY )
{
- rX ^= rY;
- rY ^= rX;
- rX ^= rY;
+ Swap( rX, rY );
} // UCSwap
// -----------------------------------------------------------------------
@@ -94,9 +96,7 @@ void UCSwap ( unsigned char &rX, unsigned char &rY )
void SSwap ( short &rX, short &rY )
{
- rX ^= rY;
- rY ^= rX;
- rX ^= rY;
+ Swap( rX, rY );
} // SSwap
// -----------------------------------------------------------------------
@@ -105,9 +105,7 @@ void SSwap ( short &rX, short &rY )
void USSwap ( unsigned short &rX, unsigned short &rY )
{
- rX ^= rY;
- rY ^= rX;
- rX ^= rY;
+ Swap( rX, rY );
} // USSwap
// -----------------------------------------------------------------------
@@ -116,9 +114,7 @@ void USSwap ( unsigned short &rX, unsigned short &rY )
void LSwap ( long &rX, long &rY )
{
- rX ^= rY;
- rY ^= rX;
- rX ^= rY;
+ Swap( rX, rY );
} // LSwap
// -----------------------------------------------------------------------
@@ -127,9 +123,7 @@ void LSwap ( long &rX, long &rY )
void ULSwap ( unsigned long &rX, unsigned long &rY )
{
- rX ^= rY;
- rY ^= rX;
- rX ^= rY;
+ Swap( rX, rY );
} // ULSwap
// =======================================================================
@@ -172,12 +166,12 @@ unsigned long Euclidian2Norm ( const LRectCoorVector pVec )
if ( nMax < nMed )
{
- ULSwap( nMax, nMed );
+ Swap( nMax, nMed );
} // if
if ( nMax < nMin )
{
- ULSwap( nMax, nMin );
+ Swap( nMax, nMin );
} // if
// Approximate Euclidian distance:
diff --git a/vcl/aqua/source/gdi/salpixmaputils.cxx b/vcl/aqua/source/gdi/salpixmaputils.cxx
index c5f490b064af..8d4135ce266a 100755
--- a/vcl/aqua/source/gdi/salpixmaputils.cxx
+++ b/vcl/aqua/source/gdi/salpixmaputils.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: salpixmaputils.cxx,v $
*
- * $Revision: 1.4 $
+ * $Revision: 1.5 $
*
- * last change: $Author: bmahbod $ $Date: 2001-02-26 20:02:27 $
+ * last change: $Author: bmahbod $ $Date: 2001-03-12 23:15:32 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -61,16 +61,8 @@
#define _SV_SALPIXMAPUTILS_CXX
-#ifndef _SV_SALCONST_H
-#include <salconst.h>
-#endif
-
-#ifndef _SV_SALCOLORUTILS_HXX
-#include <salcolorutils.hxx>
-#endif
-
#ifndef _SV_SALPIXMAPUTILS_HXX
-#include <salpixmaputils.hxx>
+ #include <salpixmaputils.hxx>
#endif
// =======================================================================
diff --git a/vcl/aqua/source/gdi/salvd.cxx b/vcl/aqua/source/gdi/salvd.cxx
index a06fcdf57186..2720d9aadf36 100644
--- a/vcl/aqua/source/gdi/salvd.cxx
+++ b/vcl/aqua/source/gdi/salvd.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: salvd.cxx,v $
*
- * $Revision: 1.12 $
+ * $Revision: 1.13 $
*
- * last change: $Author: bmahbod $ $Date: 2001-02-21 20:48:47 $
+ * last change: $Author: bmahbod $ $Date: 2001-03-12 23:15:32 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -61,16 +61,8 @@
#define _SV_SALVD_CXX
-#ifndef _SV_SALCONST_H
-#include <salconst.h>
-#endif
-
-#ifndef _SV_SALCOLORUTILS_HXX
-#include <salcolorutils.hxx>
-#endif
-
#ifndef _SV_SALVD_HXX
-#include <salvd.hxx>
+ #include <salvd.hxx>
#endif
// =======================================================================