[Date Prev][Date Next][Thread Prev][Thread Next][Thread Index]

[XaraXtreme-commits] Commit Complete



Commit by  : phil
Repository : xara
Revision   : 732
Date       : Wed Mar 29 11:29:55 BST 2006

Changed paths:
   M /Trunk/XaraLX/wxOil/compatdef.h
   M /Trunk/XaraLX/wxOil/fontbase.cpp
   M /Trunk/XaraLX/wxOil/fontbase.h
   A /Trunk/XaraLX/wxOil/ftfonts.h

Martin Wuerthner's font patches


Diff:
Index: Trunk/XaraLX/wxOil/compatdef.h
===================================================================
--- Trunk/XaraLX/wxOil/compatdef.h	(revision 731)
+++ Trunk/XaraLX/wxOil/compatdef.h	(revision 732)
@@ -538,15 +538,10 @@
 {
 };
 
-struct LOGFONT
+struct CDC
 {
 };
-typedef LOGFONT		   *PLOGFONT, *LPLOGFONT;
 
-struct ENUMLOGFONT
-{
-};
-
 struct ABC
 {
 };
Index: Trunk/XaraLX/wxOil/fontbase.cpp
===================================================================
--- Trunk/XaraLX/wxOil/fontbase.cpp	(revision 731)
+++ Trunk/XaraLX/wxOil/fontbase.cpp	(revision 732)
@@ -102,8 +102,9 @@
 */
 
 #include "camtypes.h"
-#include "ttfonts.h"
-//#include "atmfonts.h"
+#ifdef __WXGTK__
+#include "ftfonts.h"
+#endif
 #include "textfuns.h"
 #include "fontman.h"		// includes fontbase.h
 #include "errors.h"
@@ -126,6 +127,9 @@
 
 #define new CAM_DEBUG_NEW
 
+// a macro to ignore a parameter without causing a warning
+#define IGNORE(x) x = x
+
 /////////////////////////////////////////
 // Some outline cache constants
 UINT32 CharOutlineCache::CacheSize = 0;
@@ -203,8 +207,19 @@
 #endif
 			break;
 		case FC_TRUETYPE:
+#ifndef EXCLUDE_FROM_XARALX
 			return TTFontMan::IsOkToCall();
+#else
+			return FALSE;
+#endif
 			break;
+		case FC_FREETYPE:
+#ifdef __WXGTK__
+			return FTFontMan::IsOkToCall();
+#else
+			return FALSE;
+#endif
+			break;
 	}
 	ERROR3("Unknown font class passed to OILFontMan::IsOkToCall()");
 	return FALSE;
@@ -244,9 +259,15 @@
 			{
 				case FC_UNDEFINED:
 				{
+#ifdef __WXGTK__
+					if (FTFontMan::CacheNamedFont(pFontName))
+						return TRUE;
+#endif
+PORTNOTE("text","We do not use TTFontMan in wxOil")
+#ifndef EXCLUDE_FROM_XARALX
 					if (TTFontMan::CacheNamedFont(pFontName))
 						return TRUE;
-
+#endif
 PORTNOTE("text","Never cache ATM font")
 #ifndef EXCLUDE_FROM_XARALX
 					return ATMFontMan::CacheNamedFont(pFontName);
@@ -258,7 +279,12 @@
 
 				case FC_TRUETYPE:
 				{
+PORTNOTE("text","We do not use TTFontMan in wxOil")
+#ifndef EXCLUDE_FROM_XARALX
 					return TTFontMan::CacheNamedFont(pFontName);
+#else
+					return FALSE;
+#endif
 					break;
 				}
 
@@ -273,6 +299,16 @@
 					break;
 				}
 
+				case FC_FREETYPE:
+				{
+#ifdef __WXGTK__
+					return FTFontMan::CacheNamedFont(pFontName);
+#else
+					return FALSE;
+#endif
+					break;
+				}
+
 				default:
 					ERROR3("Unknown font class passed to OILFontMan::CacheNamedFont()");
 			}
@@ -286,9 +322,16 @@
 			{
 				case FC_UNDEFINED:
 				{
+#ifdef __WXGTK__
+					if (FTFontMan::CacheCompatibleFont(pFontName))
+						return TRUE;
+#endif
+
+PORTNOTE("text","We do not use TTFontMan in wxOil")
+#ifndef EXCLUDE_FROM_XARALX
 					if (TTFontMan::CacheCompatibleFont(pFontName))
 						return TRUE;
-
+#endif
 PORTNOTE("text","Never cache ATM font")
 #ifndef EXCLUDE_FROM_XARALX
 					return ATMFontMan::CacheCompatibleFont(pFontName);
@@ -300,7 +343,12 @@
 
 				case FC_TRUETYPE:
 				{
+PORTNOTE("text","We do not use TTFontMan in wxOil")
+#ifndef EXCLUDE_FROM_XARALX
 					return TTFontMan::CacheCompatibleFont(pFontName);
+#else
+					return FALSE;
+#endif
 					break;
 				}
 
@@ -313,7 +361,17 @@
 					return FALSE;
 #endif					
 				}
-		
+
+				case FC_FREETYPE:
+				{
+#ifdef __WXGTK__
+					return FTFontMan::CacheCompatibleFont(pFontName);
+#else
+					return FALSE;
+#endif
+					break;
+				}
+
 				default:
 					ERROR3("Unknown font class passed to OILFontMan::CacheNamedFont()");
 
@@ -340,7 +398,13 @@
 
 void OILFontMan::ValidateCache()
 {
+#ifdef __WXGTK__
+	FTFontMan::ValidateCache();
+#endif
+PORTNOTE("text","We do not use TTFontMan in wxOil")
+#ifndef EXCLUDE_FROM_XARALX
 	TTFontMan::ValidateCache();
+#endif
 PORTNOTE("text","ATM deactivated")
 #ifndef EXCLUDE_FROM_XARALX
 	ATMFontMan::ValidateCache();
@@ -361,7 +425,13 @@
 
 void OILFontMan::FindClosestFont()
 {
+#ifdef __WXGTK__
+	FTFontMan::FindClosestFont();
+#endif
+PORTNOTE("text","We do not use TTFontMan in wxOil")
+#ifndef EXCLUDE_FROM_XARALX
 	TTFontMan::FindClosestFont();
+#endif
 PORTNOTE("text","ATM deactivated")
 #ifndef EXCLUDE_FROM_XARALX
 	ATMFontMan::FindClosestFont();
@@ -386,15 +456,28 @@
 {
 	switch (Class)
 	{
+		case FC_FREETYPE:
+#ifdef __WXGTK__
+		case FC_UNDEFINED:
+			return FTFontMan::CreateNewFont(pFontName);
+#else
+			return NULL;
+#endif
+			break;
 		case FC_TRUETYPE:
+PORTNOTE("text","We do not use TTFontMan in wxOil")
+#ifndef EXCLUDE_FROM_XARALX
 			return TTFontMan::CreateNewFont(pFontName);
+#else
+			return NULL;
+#endif
 			break;
 		case FC_ATM:
 PORTNOTE("text","ATM deactivated")
 #ifndef EXCLUDE_FROM_XARALX
 			return ATMFontMan::CreateNewFont(pFontName);
 #else
-			return NULL
+			return NULL;
 #endif
 			break;
 	}
@@ -421,15 +504,27 @@
 {
 	switch (Class)
 	{
+		case FC_FREETYPE:
+#ifdef __WXGTK__
+			return FTFontMan::GetOutlineTextMetric(pLogFont);
+#else
+			return NULL;
+#endif
+			break;
 		case FC_TRUETYPE:
+PORTNOTE("text","ATM deactivated")
+#ifndef EXCLUDE_FROM_XARALX
 			return TTFontMan::GetOutlineTextMetric(pLogFont);
+#else
+			return NULL;
+#endif
 			break;
 		case FC_ATM:
-PORTNOTE("other","ATM deactivated")
+PORTNOTE("text","ATM deactivated")
 #ifndef EXCLUDE_FROM_XARALX
 			return ATMFontMan::GetOutlineTextMetric(pLogFont);
 #else
-			return NULL
+			return NULL;
 #endif
 			break;
 	}
@@ -704,21 +799,35 @@
 							 UINT32* pNumCoords,
 							 wxDC *pDC)
 {
+	TRACEUSER("wuerthne",_T("OILFontMan::GetCharPath"));
 	BOOL Success=FALSE;
 	switch (fclass)
 	{
 		case FC_TRUETYPE:
+PORTNOTE("text","TrueType deactivated")
+#ifndef EXCLUDE_FROM_XARALX
 			Success = TextManager::GetTTCharPath(ChDesc, ppCoords, ppVerbs, pNumCoords, pDC);
+#endif
 			ERROR1IF(Success==FALSE, FALSE, _R(IDE_FONTMAN_NOTTOUTLINE));
 			break;
 
 		case FC_ATM:
-PORTNOTE("other","ATM deactivated")
+PORTNOTE("text","ATM deactivated")
 #ifndef EXCLUDE_FROM_XARALX
 			Success = ATMFontMan::GetCharOutline(ChDesc, ppCoords, ppVerbs, pNumCoords, pDC);
 #endif
 			ERROR1IF(Success==FALSE, FALSE, _R(IDE_FONTMAN_NOATMOUTLINE));
 			break;
+
+		case FC_FREETYPE:
+#ifdef __WXGTK__
+			Success = FTFontMan::GetCharOutline(ChDesc, ppCoords, ppVerbs, pNumCoords, pDC);
+#else
+			Success = FALSE;
+#endif
+			ERROR1IF(Success==FALSE, FALSE, _R(IDE_FONTMAN_NOFTOUTLINE));
+			break;
+
 	}
 	ERROR3IF(Success==FALSE,"Unknown font class in OILFontMan::GetCharPath");
 	return Success;
@@ -745,7 +854,8 @@
 	FontEmWidth = 0;
 	FontAscent  = 0;
 	FontDescent = 0;
-	FontDesc    = CharDescription(0,0,0,0);
+	CharDescription emptyCharDesc(0, 0, 0, 0);
+	FontDesc    = emptyCharDesc;
 }
 
 
@@ -755,10 +865,10 @@
 
 	Author:		Ed_Cornes (Xara Group Ltd) <camelotdev@xxxxxxxx>
 	Created:	15/1/96
-	Inputs:		pDC          - DC with design size font selected
-				FontDesc     - descriptor of font which is being cached
-				DefaultHeght - default height of char (ie size of font for which char widths are cached)
-				DesignSize   - size of font selected in DC (in Logical units - pixels)
+	Inputs:		pDC           - DC with design size font selected
+				FontDesc      - descriptor of font which is being cached
+				DefaultHeight - default height of char (ie size of font for which char widths are cached)
+				DesignSize    - size of font selected in DC (in Logical units - pixels)
 	Returns:	FALSE if fails
 	Purpose:	Refill the font cache entry
 ********************************************************************************************/
@@ -767,15 +877,17 @@
 												MILLIPOINT DefaultHeight, INT32 DesignSize )
 {
 	// get font metrics and convert from design size in pixels to default height in millipoints
-	TEXTMETRIC TextMetrics;
-	if (pDC->GetTextMetrics(&TextMetrics)==0)
-		ERROR2(FALSE,"FontMetricsCache::GetCharMetrics() - GetTextMetrics() failed");
-	SetFontAscent( MulDiv( TextMetrics.tmAscent, DefaultHeight, DesignSize) );
-	SetFontDescent(MulDiv(-TextMetrics.tmDescent,DefaultHeight, DesignSize) );
+	INT32 Ascent;
+	INT32 Descent;
 
+#ifdef __WXGTK__
+	if (FTFontMan::GetAscentDescent(FontDesc, &Ascent, &Descent) == FALSE) return FALSE;
+	SetFontAscent( MulDiv( Ascent, DefaultHeight, DesignSize) );
+	SetFontDescent(MulDiv(-Descent,DefaultHeight, DesignSize) );
+
 	// get char widths and convert form design size in pixels to default height in millipoints
 	static INT32 pTempCharWidthBuf[NUMCHARS];
-	if (TextManager::GetCharWidth(pDC, FIRSTCHAR, LASTCHAR, pTempCharWidthBuf)==FALSE)
+	if (FTFontMan::GetCharWidth(FontDesc, FIRSTCHAR, LASTCHAR, pTempCharWidthBuf)==FALSE)
 		return FALSE;
 	for (INT32 i=0; i<NUMCHARS; i++)
 		pCharWidths[i] = MulDiv(pTempCharWidthBuf[i], DefaultHeight, DesignSize);
@@ -787,17 +899,21 @@
 	{
 		ERROR3("FontMetricsCache::GetCharMetrics() - 'FONTEMCHAR' not in cache!");
 		INT32 TempCharWidth = 0;
-		if (TextManager::GetCharWidth(pDC, FONTEMCHAR, FONTEMCHAR, &TempCharWidth)==FALSE)
+		if (FTFontMan::GetCharWidth(FontDesc, FONTEMCHAR, FONTEMCHAR, &TempCharWidth)==FALSE)
 			return FALSE;
 		SetFontEmWidth( MulDiv(TempCharWidth, DefaultHeight, DesignSize) );
 	}
 
 	// update cache tag
 	SetFontDesc(FontDesc);
+#else // !wxGTK
+	return FALSE;
+#endif
 
+#ifndef EXCLUDE_FROM_XARALX
 	// debug test
 	CheckCharWidthsSameAsABCWidths(pDC,FontDesc);
-
+#endif
 	return TRUE;
 }
 
@@ -815,6 +931,7 @@
 void FontMetricsCacheEntry::CheckCharWidthsSameAsABCWidths(wxDC* pDC, CharDescription FontDesc)
 {
 #ifdef _DEBUG
+#ifndef EXCLUDE_FROM_XARALX
 	// ensure that the char widths are the same as the sum of the ABC widths
 
 	// do nothing if its an ATM font (or an error)
@@ -874,7 +991,8 @@
 		}
 		TRACEUSER( "Ed", _T("Sum of CharWidths (%5dMP): new=%8.0f (e=%6.2f), old=%8.0f (e=%6.2f), accrutate=%8.2f
"), FontSizeInMP, SumNewMetrics, SumNewMetrics-SumAccurateMetrics, SumOldMetrics, SumOldMetrics-SumAccurateMetrics, SumAccurateMetrics);
 	}
-#endif
+#endif // EXCLUDE_FROM_XARALX
+#endif // _DEBUG
 }
 
 
@@ -898,7 +1016,8 @@
 
 BOOL FontMetricsCache::GetCharMetrics(wxDC* pDC, WCHAR ch, CharDescription& FontDesc, CharMetrics* pCharMetrics)
 {
-	ERROR2IF(         pDC==NULL,FALSE,"FontMetricsCache::GetCharMetrics() - pDC==NULL");
+	TRACEUSER("wuerthne", _T("FontMetricsCache::GetCharMetrics %04x"), ch);
+	IGNORE(pDC);
 	ERROR2IF(pCharMetrics==NULL,FALSE,"FontMetricsCache::GetCharMetrics() - pCharMetrics==NULL");
 	ERROR2IF(FontDesc.GetCharCode()!=FONTEMCHAR,FALSE,"FontMetricsCache::GetCharMetrics() - FontDesc char should be 'FONTEMCHAR'");
 
@@ -907,34 +1026,23 @@
 	while (CacheEntry<NUMENTRIES && mpFontMetricsData[CacheEntry].GetFontDesc()!=FontDesc)
 		CacheEntry +=1;
 
-	// if font not in cache, recache it, or if char not in cached ranged, get it explcitally
-	// both of these situations require the DC to be prepared, then either/both is done before restoring the DC
+	// if font not in cache, recache it, or if char not in cached range, get it explicitly
 	MILLIPOINT CharWidth  = 0;
 	BOOL CharInCacheRange = FontMetricsCacheEntry::CharInCacheRange(ch);
 	if (CacheEntry>=NUMENTRIES || !CharInCacheRange)
 	{
 		// get design size of font, and default heigh
-		INT32 DesignSize    = TextManager::GetDesignSize(pDC);
+		INT32 DesignSize    = TextManager::GetDesignSize(pDC);  // ignores pDC
 		INT32 DefaultHeight = TextManager::GetDefaultHeight();
 
-		// first, if ATM fonts, ensure accurate widths returned
-		// this should be a virtual function - but class structure does not facilitate such things!
 		CachedFontItem* pItem = FONTMANAGER->GetFont(FontDesc.GetTypefaceHandle());
 		if (pItem==NULL || pItem->IsCorrupt())
 			return FALSE;
-		if (pItem->GetFontClass()==FC_ATM)
-			ATMFontMan::ForceExactWidth();
-//			if (ATMFontMan::ForceExactWidth()==FALSE)
-//				pItem->SetIsCorrupt(TRUE);
 
 		// get a LogFont, create a font and select it into the DC
 		LOGFONT	CharLogFont;
 		if (TextManager::GetLogFontFromCharDescriptor(pDC, FontDesc, &CharLogFont, DesignSize)==FALSE)
 			return FALSE;
-		wxFont font;
-		font.CreateFontIndirect(&CharLogFont);
-		wxFont* pOldFont = pDC->SelectObject(&font);
-		ERROR2IF(pOldFont==NULL,FALSE,"FontMetricsCache::GetCharMetrics() - SelectObject() failed");
 
 		// if font not in cache, cache its metrics throwing out a random entry
 		if (CacheEntry>=NUMENTRIES)
@@ -957,9 +1065,6 @@
 				CharWidth = MulDiv(TempCharWidth, DefaultHeight, DesignSize);
 			}
 		}
-
-		// restore old font
-		pDC->SelectObject(pOldFont);
 	}
 
 	if (CharInCacheRange)
@@ -969,7 +1074,6 @@
 	pCharMetrics->FontAscent  = mpFontMetricsData[CacheEntry].GetFontAscent();
 	pCharMetrics->FontEmWidth = mpFontMetricsData[CacheEntry].GetFontEmWidth();
 	pCharMetrics->FontDescent = mpFontMetricsData[CacheEntry].GetFontDescent();
-
 	return TRUE;
 }
 
@@ -984,8 +1088,9 @@
 
 void FontMetricsCache::InvalidateCharMetrics()
 {
+	CharDescription emptyCharDesc(0, 0, 0, 0);
 	for (INT32 i=0; i<NUMENTRIES; i++)
-		mpFontMetricsData[i].SetFontDesc( CharDescription(0,0,0,0) );
+		mpFontMetricsData[i].SetFontDesc( emptyCharDesc );
 }
 
 /////////////////////////////////////////////////////////////////////////////////////////////
@@ -1009,6 +1114,7 @@
 MILLIPOINT FontKerningPairsCache::GetCharsKerning(wxDC* pDC, WCHAR chLeft, WCHAR chRight,
 																	CharDescription& FontDesc)
 {
+#ifndef EXCLUDE_FROM_XARALX
 	ERROR2IF(         pDC==NULL,FALSE,"FontKerningPairsCache::GetCharsKerning() - pDC==NULL");
 	ERROR2IF(FontDesc.GetCharCode()!=FONTEMCHAR,FALSE,
 			"FontKerningPairsCache::GetCharsKerning() - FontDesc char should be 'FONTEMCHAR'");
@@ -1058,6 +1164,9 @@
 #endif _DEBUG
 
 	return mpFontKerningPairsCacheData[CacheEntry].GetCharsKerning(chLeft, chRight);
+#else
+	return 0;
+#endif
 }
 
 
@@ -1070,8 +1179,9 @@
 ********************************************************************************************/
 void FontKerningPairsCache::InvalidateKerningPairsCache()
 {
+	CharDescription emptyCharDesc(0, 0, 0, 0);
 	for (INT32 i=0; i<NUMENTRIES; ++i)
-		mpFontKerningPairsCacheData[i].SetFontDesc( CharDescription(0,0,0,0) );
+		mpFontKerningPairsCacheData[i].SetFontDesc( emptyCharDesc );
 }
 
 #ifdef _DEBUG
@@ -1094,7 +1204,7 @@
 	}
 	TRACE( _T("<<< Font kerning data end <<<
"));
 }
-#endif _DEBUG
+#endif // _DEBUG
 
 /////////////////////////////////////////////////////////////////////////////////////////////
 // FontKerningPairsCacheEntry
@@ -1109,7 +1219,8 @@
 ********************************************************************************************/
 FontKerningPairsCacheEntry::FontKerningPairsCacheEntry()
 {
-	FontDesc = CharDescription(0,0,0,0);
+	CharDescription emptyCharDesc(0, 0, 0, 0);
+	FontDesc = emptyCharDesc;
 	KernCount = 0;
 	pKernPairs = 0;
 }
@@ -1169,6 +1280,7 @@
 {
 	delete[] pKernPairs;	// remove any old kern data
 
+#ifndef EXCLUDE_FROM_XARALX
 	KernCount = TextManager::GetKernCount(pDC);
 
 	// update cache tag
@@ -1198,6 +1310,7 @@
 			return false;
 		}
 	}
+#endif
 	pKernPairs = 0;
 	return true; // No kern data so kern cache is valid
 }
@@ -1270,7 +1383,7 @@
 	}
 }
 
-#endif _DEBUG
+#endif // _DEBUG
 
 /////////////////////////////////////////////////////////////////////////////////////////////
 // some debug stuff
@@ -1345,8 +1458,10 @@
 	{
 		TRACE( _T(" ---------------- 
"));
 		TRACE( _T("Enum Log font structure:
"));
+#ifndef EXCLUDE_FROM_XARALX
 		TRACE( _T(" Full name = %s
"), lpelf->elfFullName);
 		TRACE( _T(" Style     = %s
"), lpelf->elfStyle);
+#endif
 		DumpLogFont(&(lpelf->elfLogFont));
 		TRACE( _T(" ---------------- 
"));
 	}
@@ -1357,6 +1472,7 @@
 	if (lplf!=NULL)
 	{
 		TRACE( _T("Log font structure:
"));
+#ifndef EXCLUDE_FROM_XARALX
 		TRACE( _T(" Height 			= %d
"), lplf->lfHeight);
 		TRACE( _T(" Width			= %d
"), lplf->lfWidth);
 		TRACE( _T(" Escapement		= %d
"), lplf->lfEscapement);
@@ -1371,6 +1487,7 @@
 		TRACE( _T(" Quality			= %d
"), lplf->lfQuality);
 		TRACE( _T(" PitchAndFamily	= %d
"), lplf->lfPitchAndFamily);
 		TRACE( _T(" FaceName		= %s
"), lplf->lfFaceName);
+#endif
 	}
 }
 
@@ -1487,8 +1604,17 @@
 
 void OILEnumFonts::Execute()
 {
+PORTNOTE("text","We do not use TTFontMan in wxOil")
+#ifndef EXCLUDE_FROM_XARALX
 	TTFontMan::EnumAllFonts(this);
+#endif
+PORTNOTE("text","We do not use ATMFontMan in wxOil")
+#ifndef EXCLUDE_FROM_XARALX
 	ATMFontMan::EnumAllFonts(this);
+#endif
+#ifdef __WXGTK__
+	FTFontMan::EnumAllFonts(this);
+#endif
 	// Add any further OIL Level font managers here
 }
 
Index: Trunk/XaraLX/wxOil/fontbase.h
===================================================================
--- Trunk/XaraLX/wxOil/fontbase.h	(revision 731)
+++ Trunk/XaraLX/wxOil/fontbase.h	(revision 732)
@@ -109,6 +109,7 @@
 
 #include "pathtype.h"
 #include "txtattr.h"
+#include "ccpanose.h"
 
 class  DocCoord;
 class CharMetrics;
@@ -125,11 +126,24 @@
 	FC_DEVICE,
 	FC_TRUETYPE,
 	FC_ATM,
+	FC_FREETYPE,
 
 	// Add further font classes before this
 	FC_ILLEGAL
 };
 
+// The kernel likes dealing with LOGFONT and ENUMLOGFONT structures, so we do it this favour
+struct LOGFONT
+{
+	String_64 FaceName;
+};
+typedef LOGFONT		   *PLOGFONT, *LPLOGFONT;
+
+struct ENUMLOGFONT
+{
+	LOGFONT elfLogFont;
+};
+
 /********************************************************************************************
 
 >	class FontBase : public CCObject
@@ -325,9 +339,6 @@
 	static FontKerningPairsCacheEntry mpFontKerningPairsCacheData[NUMENTRIES];
 };
 
-PORTNOTE("text","Removed OILFont* defn.")
-#ifndef EXCLUDE_FROM_XARALX
-
 /********************************************************************************************
 
 >	class OILFontMan : public CCObject
@@ -388,8 +399,6 @@
 };
 
 
-#endif
-
 /********************************************************************************************
 
 >	class EnumFonts : public CCObject
Index: Trunk/XaraLX/wxOil/ftfonts.h
===================================================================
--- Trunk/XaraLX/wxOil/ftfonts.h	(revision 0)
+++ Trunk/XaraLX/wxOil/ftfonts.h	(revision 732)
@@ -0,0 +1,184 @@
+// $Id$
+/* @@tag:xara-cn@@ DO NOT MODIFY THIS LINE
+================================XARAHEADERSTART===========================
+ 
+               Xara LX, a vector drawing and manipulation program.
+                    Copyright (C) 1993-2006 Xara Group Ltd.
+       Copyright on certain contributions may be held in joint with their
+              respective authors. See AUTHORS file for details.
+
+LICENSE TO USE AND MODIFY SOFTWARE
+----------------------------------
+
+This file is part of Xara LX.
+
+Xara LX is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License version 2 as published
+by the Free Software Foundation.
+
+Xara LX and its component source files are 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 General Public License for more details.
+
+You should have received a copy of the GNU General Public License along
+with Xara LX (see the file GPL in the root directory of the
+distribution); if not, write to the Free Software Foundation, Inc., 51
+Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
+
+
+ADDITIONAL RIGHTS
+-----------------
+
+Conditional upon your continuing compliance with the GNU General Public
+License described above, Xara Group Ltd grants to you certain additional
+rights. 
+
+The additional rights are to use, modify, and distribute the software
+together with the wxWidgets library, the wxXtra library, and the "CDraw"
+library and any other such library that any version of Xara LX relased
+by Xara Group Ltd requires in order to compile and execute, including
+the static linking of that library to XaraLX. In the case of the
+"CDraw" library, you may satisfy obligation under the GNU General Public
+License to provide source code by providing a binary copy of the library
+concerned and a copy of the license accompanying it.
+
+Nothing in this section restricts any of the rights you have under
+the GNU General Public License.
+
+
+SCOPE OF LICENSE
+----------------
+
+This license applies to this program (XaraLX) and its constituent source
+files only, and does not necessarily apply to other Xara products which may
+in part share the same code base, and are subject to their own licensing
+terms.
+
+This license does not apply to files in the wxXtra directory, which
+are built into a separate library, and are subject to the wxWindows
+license contained within that directory in the file "WXXTRA-LICENSE".
+
+This license does not apply to the binary libraries (if any) within
+the "libs" directory, which are subject to a separate license contained
+within that directory in the file "LIBS-LICENSE".
+
+
+ARRANGEMENTS FOR CONTRIBUTION OF MODIFICATIONS
+----------------------------------------------
+
+Subject to the terms of the GNU Public License (see above), you are
+free to do whatever you like with your modifications. However, you may
+(at your option) wish contribute them to Xara's source tree. You can
+find details of how to do this at:
+  http://www.xaraxtreme.org/developers/
+
+Prior to contributing your modifications, you will need to complete our
+contributor agreement. This can be found at:
+  http://www.xaraxtreme.org/developers/contribute/
+
+Please note that Xara will not accept modifications which modify any of
+the text between the start and end of this header (marked
+XARAHEADERSTART and XARAHEADEREND).
+
+
+MARKS
+-----
+
+Xara, Xara LX, Xara X, Xara X/Xtreme, Xara Xtreme, the Xtreme and Xara
+designs are registered or unregistered trademarks, design-marks, and/or
+service marks of Xara Group Ltd. All rights in these marks are reserved.
+
+
+      Xara Group Ltd, Gaddesden Place, Hemel Hempstead, HP2 6EX, UK.
+                        http://www.xara.com/
+
+=================================XARAHEADEREND============================
+ */
+// Header file for FreeType Font manager. This font manager provides access to
+// scalable fonts supported by FreeType (via Pango, fontconfig and FreeType)
+
+/*
+*/
+
+#ifndef INC_FTFONTS
+#define INC_FTFONTS
+
+#include "fontbase.h"
+
+// Forward definitions
+class OILEnumFonts;
+
+/********************************************************************************************
+>	class FTFont : public FontBase
+	   		
+	Author:		Martin Wuerthner <xara@xxxxxxxxxxxxxxx>
+	Created:	22/02/06
+	Purpose:	A class description of a font managed by FreeType.
+********************************************************************************************/
+
+class FTFont : public FontBase
+{
+	CC_DECLARE_DYNCREATE(FTFont)
+
+public:
+	 FTFont();
+	~FTFont();
+
+	virtual FontClass GetFontClass() { return FC_FREETYPE; };
+	virtual void Dump();
+};
+
+
+/********************************************************************************************
+
+>	class FTFontMan : public CCObject
+	   		
+	Author:		Martin Wuerthner <xara@xxxxxxxxxxxxxxx>
+	Created:	22/02/06
+	Purpose:	A static class to allow access to fonts managed by FreeType.
+
+********************************************************************************************/
+
+class FTFontMan : public CCObject
+{
+	CC_DECLARE_DYNCREATE(FTFontMan)
+
+	friend class OILFontMan;
+
+// constructor
+public:
+	FTFontMan();
+
+	static BOOL     GetAscentDescent(CharDescription& ChDesc, INT32* pAscent, INT32* pDescent);
+	static BOOL     GetCharWidth(CharDescription& ChDesc, TCHAR FirstChar, TCHAR LastChar, INT32* pCharWidthsBuf);
+
+// the support interface (functions in class OILFontMan will use these)
+private:
+	static BOOL		IsOkToCall();
+	static BOOL		CacheNamedFont(String_64* pFont);
+	static BOOL		CacheCompatibleFont(String_64* pFont);
+	static void		ValidateCache();
+	static void		FindClosestFont();
+	static FTFont*	CreateNewFont(String_64* pFontName);
+
+	// as in ATMFontMan, we cannot extract the relevant information, so do nothing
+	static OUTLINETEXTMETRIC* GetOutlineTextMetric(LOGFONT *pLogFont) { return NULL; }
+
+	// get a vector representation of a glyph
+	static BOOL 	GetCharOutline(CharDescription& ChDesc, 
+								   DocCoord** ppCoords,
+								   PathVerb** ppVerbs,
+								   UINT32* pNumCoords,
+								   wxDC* pDC);
+
+// utterly private
+private:
+	static BOOL CacheFontCore(String_64* pFont, BOOL compatible);
+
+// function called by class EnumFonts as a method for the kernel to enumerate all the installed fonts
+public:
+	static void		EnumAllFonts(OILEnumFonts* pClass);
+};
+
+#endif


Xara