Index: branch/egtra-gdiplus/Classes/System/Drawing/Font.ab
===================================================================
--- Include/Classes/System/Drawing/Font.ab	(revision 212)
+++ branch/egtra-gdiplus/Classes/System/Drawing/Font.ab	(revision 241)
@@ -2,10 +2,20 @@
 #define _GDIPLUSFONT_H
 
-#require <GdiPlus.ab>
+#require <GdiPlusTypes.ab>
+#require <GdiPlusGpStubs.ab>
+#require <GdiPlusFlat.ab>
 #require <Classes/System/Drawing/misc.ab>
 #require <Classes/System/Drawing/Graphics.ab>
 
+Namespace System
+Namespace Drawing
+
 Class FontFamily : End Class
+
+Namespace Text
 Class FontCollection : End Class
+End Namespace
+
+'Todo: コンストラクタ内での別コンストラクタ呼出を修正せよ
 
 Class Font
@@ -14,32 +24,32 @@
 
 	Sub Font(/*IN*/ hdc As HDC)
-		Dim font = 0 As *GpFont
-		lastResult = GdipCreateFontFromDC(hdc, font)
+		Dim font = 0 As *Gdiplus.GpFont
+		lastResult = Gdiplus.DllExports.GdipCreateFontFromDC(hdc, font)
 		SetNativeFont(font)
 	End Sub
 
 	Sub Font(/*IN*/ hdc As HDC, /*IN const*/ ByRef logfont As LOGFONTA)
-		Dim font = 0 As *GpFont
-		lastResult =GdipCreateFontFromLogfontA(hdc, logfont, font)
+		Dim font = 0 As *Gdiplus.GpFont
+		lastResult = Gdiplus.DllExports.GdipCreateFontFromLogfontA(hdc, logfont, font)
 		SetNativeFont(font)
 	End Sub
 
 	Sub Font(/*IN*/ hdc As HDC, /*IN const*/ ByRef logfont As LOGFONTW)
-		Dim font = 0 As *GpFont
-		lastResult =GdipCreateFontFromLogfontW(hdc, logfont, font)
+		Dim font = 0 As *Gdiplus.GpFont
+		lastResult = Gdiplus.DllExports.GdipCreateFontFromLogfontW(hdc, logfont, font)
 		SetNativeFont(font)
 	End Sub
 
 	Sub Font(/*IN*/ hdc As HDC, /*IN const*/ hfont As HFONT)
-		Dim font = 0 As *GpFont
+		Dim font = 0 As *Gdiplus.GpFont
 		If hfont <> 0 Then
 			Dim lf As LOGFONTA
-			If GetObjectA(hfont, sizeof (LOGFONTA), lf) <> 0 Then
-				lastResult = GdipCreateFontFromLogfontA(hdc, lf, font)
+			If GetObjectA(hfont, SizeOf (LOGFONTA), lf) <> 0 Then
+				lastResult = Gdiplus.DllExports.GdipCreateFontFromLogfontA(hdc, lf, font)
 			Else
-				lastResult = GdipCreateFontFromDC(hdc, font)
+				lastResult = Gdiplus.DllExports.GdipCreateFontFromDC(hdc, font)
 			End If
 		Else
-			lastResult = GdipCreateFontFromDC(hdc, font)
+			lastResult = Gdiplus.DllExports.GdipCreateFontFromDC(hdc, font)
 		End If
 		SetNativeFont(font)
@@ -59,7 +69,6 @@
 		/*IN*/ style As Long, /*IN*/ unit As GraphicsUnit)
 
-		Dim font = 0 As *GpFont
-		lastResult = GdipCreateFont(
-			family.NativeFamily, emSize, style, unit, font)
+		Dim font = 0 As *Gdiplus.GpFont
+		lastResult = Gdiplus.DllExports.GdipCreateFont(family.NativeFamily, emSize, style, unit, font)
 		SetNativeFont(font)
 	End Sub
@@ -95,5 +104,5 @@
 	Sub Font(/*IN const*/ familyName As PCWSTR, /*IN*/ emSize As Single,
 		/*IN*/ style As Long, /*IN*/ unit As GraphicsUnit,
-		/*IN const*/ ByRef fontCollection As FontCollection)
+		/*IN const*/ ByRef fontCollection As Text.FontCollection)
 
 		nativeFont = 0
@@ -104,24 +113,23 @@
 		lastResult = family.GetLastStatus()
 
-		If lastResult <> Ok Then
-			nativeFamily = FontFamily.GenericSansSerif()->NativeFamily
-			lastResult = FontFamily.GenericSansSerif()->lastResult
-			If lastResult <> Ok Then
+		If lastResult <> Gdiplus.Status.Ok Then
+			nativeFamily = FontFamily.GenericSansSerif().NativeFamily
+			lastResult = FontFamily.GenericSansSerif().lastResult
+			If lastResult <> Gdiplus.Status.Ok Then
 				Exit Sub
 			End If
 		End If
 
-		lastResult = GdipCreateFont(
+		lastResult = Gdiplus.DllExports.GdipCreateFont(
 			nativeFamily, emSize, style, unit, nativeFont)
 
-		If lastResult <> Ok Then
-			nativeFamily = FontFamily.GenericSansSerif()->NativeFamily
-			lastResult = FontFamily.GenericSansSerif()->lastResult
-			If lastResult <> Ok Then
+		If lastResult <> Gdiplus.Status.Ok Then
+			nativeFamily = FontFamily.GenericSansSerif().NativeFamily
+			lastResult = FontFamily.GenericSansSerif().lastResult
+			If lastResult <> Gdiplus.Status.Ok Then
 				Exit Sub
 			End If
 
-			lastResult = GdipCreateFont(
-				nativeFamily, emSize, style, unit, nativeFont)
+			lastResult = Gdiplus.DllExports.GdipCreateFont(nativeFamily, emSize, style, unit, nativeFont)
 		End If
 	End Sub
@@ -129,34 +137,25 @@
 	Sub Font(/*IN const*/ familyName As String, /*IN*/ emSize As Single,
 		/*IN*/ style As Long, /*IN*/ unit As GraphicsUnit,
-		/*IN const*/ fontCollection As FontCollection)
-#ifdef __STRING_IS_NOT_UNICODE
-		Dim oldAlloc = _System_AllocForConvertedString
-		_System_AllocForConvertedString = AddressOf (_System_malloc)
-		Dim name = ToWCStr(familyName)
-		Font(name, emSize, style, unit, fontCollection)
-		_System_free(name)
-		_System_AllocForConvertedString = oldAlloc
-#else
-		Font(familyName.Chars, emSize, style, unit, fontCollection)
-#endif
-	End Sub
-
-	Const Function GetLogFontA(/*IN const*/ g As Graphics, /*OUT*/ ByRef lf As LOGFONTA) As Status
+		/*IN const*/ fontCollection As Text.FontCollection)
+		Font(ToWCStr(familyName), emSize, style, unit, fontCollection)
+	End Sub
+
+	Const Function GetLogFontA(/*IN const*/ g As Graphics, /*OUT*/ ByRef lf As LOGFONTA) As Gdiplus.Status
 		Dim nativeGraphics As *GpGraphics
 		If VarPtr(g) <> 0 Then
 			nativeGraphics = g.nativeGraphics
 		End If
-		Return SetStatus(GdipGetLogFontA(nativeFont, nativeGraphics, lf))
-	End Function
-
-	Const Function GetLogFontW(/*IN const*/ g As Graphics, /*OUT*/ ByRef lf As LOGFONTW) As Status
+		Return SetStatus(Gdiplus.DllExports.GdipGetLogFontA(nativeFont, nativeGraphics, lf))
+	End Function
+
+	Const Function GetLogFontW(/*IN const*/ g As Graphics, /*OUT*/ ByRef lf As LOGFONTW) As Gdiplus.Status
 		Dim nativeGraphics As *GpGraphics
 		If VarPtr(g) <> 0 Then
 			nativeGraphics = g.nativeGraphics
 		End If
-		Return SetStatus(GdipGetLogFontW(nativeFont, nativeGraphics, lf))
-	End Function
-
-	Const Function GetLogFont(/*IN const*/ g As Graphics, /*OUT*/ ByRef lf As LOGFONT) As Status
+		Return SetStatus(Gdiplus.DllExports.GdipGetLogFontW(nativeFont, nativeGraphics, lf))
+	End Function
+
+	Const Function GetLogFont(/*IN const*/ g As Graphics, /*OUT*/ ByRef lf As LOGFONT) As Gdiplus.Status
 		Dim nativeGraphics As *GpGraphics
 		If VarPtr(g) <> 0 Then
@@ -164,18 +163,25 @@
 		End If
 #ifdef UNICODE
-		Return SetStatus(GdipGetLogFontW(nativeFont, nativeGraphics, lf))
+		Return SetStatus(Gdiplus.DllExports.GdipGetLogFontW(nativeFont, nativeGraphics, lf))
 #else
-		Return SetStatus(GdipGetLogFontA(nativeFont, nativeGraphics, lf))
+		Return SetStatus(Gdiplus.DllExports.GdipGetLogFontA(nativeFont, nativeGraphics, lf))
 #endif
 	End Function
 
 	Const Function Clone() As Font
-		Dim cloneFont = 0 As *GpFont
-		SetStatus(GdipCloneFont(nativeFont, cloneFont))
+		Dim cloneFont = 0 As *Gdiplus.GpFont
+		SetStatus(Gdiplus.DllExports.GdipCloneFont(nativeFont, cloneFont))
 		Return New Font(cloneFont, lastResult)
 	End Function
 
+	Sub Dispose()
+		Gdiplus.DllExports.GdipDeleteFont(nativeFont)
+		nativeFont = 0
+	End Sub
+
 	Sub ~Font()
-		GdipDeleteFont(nativeFont)
+		If nativeFont <> 0 Then
+			Dispose()
+		End If
 	End Sub
 
@@ -185,18 +191,18 @@
 
 	Const Function Style() As Long
-		SetStatus(GdipGetFontStyle(nativeFont, Style))
+		SetStatus(Gdiplus.DllExports.GdipGetFontStyle(nativeFont, Style))
 	End Function
 
 	Const Function Size() As Single
-		SetStatus(GdipGetFontSize(nativeFont, Size))
-	End Function
-
-	Const Function SizeInPoints() As Single
+		SetStatus(Gdiplus.DllExports.GdipGetFontSize(nativeFont, Size))
+	End Function
+
+'	Const Function SizeInPoints() As Single
 
 	Const Function Unit() As GraphicsUnit
-		SetStatus(GdipGetFontUnit(nativeFont, Unit))
-	End Function
-
-	Const Function LastStatus() As Status
+		SetStatus(Gdiplus.DllExports.GdipGetFontUnit(nativeFont, Unit))
+	End Function
+
+	Const Function LastStatus() As Gdiplus.Status
 		Return lastResult
 	End Function
@@ -207,25 +213,23 @@
 
 	Const Function GetHeight() As Single
-		SetStatus(GdipGetFontHeight(nativeFont, 0, GetHeight))
+		SetStatus(Gdiplus.DllExports.GdipGetFontHeight(nativeFont, 0, GetHeight))
 	End Function
 
 	Const Function GetHeight(/*IN const*/ g As Graphics) As Single
-		Dim nativeGraphics As *GpGraphics
+		Dim nativeGraphics As *Gdiplus.GpGraphics
 		If VarPtr(g) <> 0 Then
 			nativeGraphics = g.NativeGraphics
 		End If
-		SetStatus(GdipGetFontHeight(nativeFont, nativeGraphics, GetHeight))
+		SetStatus(Gdiplus.DllExports.GdipGetFontHeight(nativeFont, nativeGraphics, GetHeight))
 	End Function
 
 	Const Function GetHeight(/*IN*/ dpi As Single) As Single
-		SetStatus(GdipGetFontHeightGivenDPI(nativeFont, dpi, GetHeight))
+		SetStatus(Gdiplus.DllExports.GdipGetFontHeightGivenDPI(nativeFont, dpi, GetHeight))
 	End Function
 
 '	 Const Function FontFamily(/*OUT*/ ByRef family As FontFamily)
-'		If VarPtr(family) = 0 Then
-'			Return SetStatus(Status.InvalidParameter)
-'		End If
-'		Dim status = GdipGetFamily(nativeFont, family->nativeFamily)
-'		family->SetStatus(status)
+'		family = New FontFamily
+'		Dim status = GdipGetFamily(nativeFont, family.nativeFamily)
+'		family.SetStatus(status)
 '		Return SetStatus(status)
 '	End Function
@@ -245,5 +249,5 @@
 	'Const Function GdiVerticalFont() As Boolean
 
-	Const Function NativeFont() As *GpFont
+	Const Function NativeFont() As *Gdiplus.GpFont
 		Return nativeFont
 	End Function
@@ -270,5 +274,5 @@
 	'Const Function SizeInPoint() As Boolean
 
-	Const Function NativeFont() As *GpFont
+	Const Function NativeFont() As *Gdiplus.GpFont
 		Return nativeFont
 	End Function
@@ -315,19 +319,16 @@
 	End Sub
 
-Private
-'	Sub Font(ByRef f As Font)
-
-Protected
-	Sub Font(f As *GpFont, status As Status)
+'Protected
+	Sub Font(f As *Gdiplus.GpFont, status As Gdiplus.Status)
 		lastResult = status
 		SetNativeFont(f)
 	End Sub
-
-	Sub SetNativeFont(f As *GpFont)
+Protected
+	Sub SetNativeFont(f As *Gdiplus.GpFont)
 		nativeFont = f
 	End Sub
 
-	Const Function SetStatus(s As Status) As Status
-		If s <> Status.Ok Then
+	Const Function SetStatus(s As Gdiplus.Status) As Gdiplus.Status
+		If s <> Gdiplus.Status.Ok Then
 			lastResult = s
 			Return s
@@ -338,7 +339,10 @@
 
 Protected
-	nativeFont As *GpFont
-	/*mutable*/ lastResult As Status
+	nativeFont As *Gdiplus.GpFont
+	/*mutable*/ lastResult As Gdiplus.Status
 End Class
 
+End Namespace 'Drawing
+End Namespace 'System
+
 #endif
