3 * Copyright (c) 2007-2010 SlimDX Group
\r
5 * Permission is hereby granted, free of charge, to any person obtaining a copy
\r
6 * of this software and associated documentation files (the "Software"), to deal
\r
7 * in the Software without restriction, including without limitation the rights
\r
8 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
\r
9 * copies of the Software, and to permit persons to whom the Software is
\r
10 * furnished to do so, subject to the following conditions:
\r
12 * The above copyright notice and this permission notice shall be included in
\r
13 * all copies or substantial portions of the Software.
\r
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
\r
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
\r
17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
\r
18 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
\r
19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
\r
20 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
\r
26 #include "FontDescription10.h"
\r
28 using namespace System;
\r
32 namespace Direct3D10
\r
34 FontDescription::FontDescription( const D3DX10_FONT_DESC& native )
\r
36 m_Height = native.Height;
\r
37 m_Width = native.Width;
\r
38 m_Weight = static_cast<FontWeight>( native.Weight );
\r
39 m_MipLevels = native.MipLevels;
\r
40 m_Italic = native.Italic ? true : false;
\r
41 m_CharSet = static_cast<FontCharacterSet>( native.CharSet );
\r
42 m_OutputPrecision = static_cast<FontPrecision>( native.OutputPrecision );
\r
43 m_Quality = static_cast<FontQuality>( native.Quality );
\r
44 m_PitchAndFamily = static_cast<FontPitchAndFamily>( native.PitchAndFamily );
\r
45 m_FaceName = gcnew String( native.FaceName );
\r
48 /*D3DX10_FONT_DESC FontDescription::CreateNativeVersion()
\r
50 D3DX10_FONT_DESC native;
\r
51 native.Height = m_Height;
\r
52 native.Width = m_Width;
\r
53 native.Weight = static_cast<UINT>( m_Weight );
\r
54 native.MipLevels = m_MipLevels;
\r
55 native.Italic = m_Italic;
\r
56 native.CharSet = static_cast<BYTE>( m_CharSet );
\r
57 native.OutputPrecision = static_cast<BYTE>( m_OutputPrecision );
\r
58 native.Quality = static_cast<BYTE>( m_Quality );
\r
59 native.PitchAndFamily = static_cast<BYTE>( m_PitchAndFamily );
\r
61 for(int index = 0; index < LF_FACESIZE; ++index )
\r
63 if( index < m_FaceName->Length )
\r
64 native.FaceName[ index ] = m_FaceName[ index ];
\r
66 native.FaceName[ index ] = 0;
\r
72 int FontDescription::Width::get()
\r
77 void FontDescription::Width::set( int value )
\r
82 int FontDescription::Height::get()
\r
87 void FontDescription::Height::set( int value )
\r
92 FontWeight FontDescription::Weight::get()
\r
97 void FontDescription::Weight::set( FontWeight value )
\r
102 int FontDescription::MipLevels::get()
\r
104 return m_MipLevels;
\r
107 void FontDescription::MipLevels::set( int value )
\r
109 m_MipLevels = value;
\r
112 bool FontDescription::IsItalic::get()
\r
117 void FontDescription::IsItalic::set( bool value )
\r
122 FontCharacterSet FontDescription::CharacterSet::get()
\r
127 void FontDescription::CharacterSet::set( FontCharacterSet value )
\r
132 FontPrecision FontDescription::Precision::get()
\r
134 return m_OutputPrecision;
\r
137 void FontDescription::Precision::set( FontPrecision value )
\r
139 m_OutputPrecision = value;
\r
142 FontQuality FontDescription::Quality::get()
\r
147 void FontDescription::Quality::set( FontQuality value )
\r
152 FontPitchAndFamily FontDescription::PitchAndFamily::get()
\r
154 return m_PitchAndFamily;
\r
157 void FontDescription::PitchAndFamily::set( FontPitchAndFamily value )
\r
159 m_PitchAndFamily = value;
\r
162 String^ FontDescription::FaceName::get()
\r
167 void FontDescription::FaceName::set( String^ value )
\r
169 m_FaceName = value;
\r
173 bool FontDescription::operator == ( FontDescription left, FontDescription right )
\r
175 return FontDescription::Equals( left, right );
\r
178 bool FontDescription::operator != ( FontDescription left, FontDescription right )
\r
180 return !FontDescription::Equals( left, right );
\r
183 int FontDescription::GetHashCode()
\r
185 return m_Height.GetHashCode() + m_Width.GetHashCode() + m_Weight.GetHashCode()
\r
186 + m_MipLevels.GetHashCode() + m_Italic.GetHashCode() + m_CharSet.GetHashCode()
\r
187 + m_OutputPrecision.GetHashCode() + m_Quality.GetHashCode() + m_PitchAndFamily.GetHashCode()
\r
188 + m_FaceName->GetHashCode();
\r
191 bool FontDescription::Equals( Object^ value )
\r
193 if( value == nullptr )
\r
196 if( value->GetType() != GetType() )
\r
199 return Equals( safe_cast<FontDescription>( value ) );
\r
202 bool FontDescription::Equals( FontDescription value )
\r
204 return ( m_Height == value.m_Height && m_Width == value.m_Width && m_Weight == value.m_Weight
\r
205 && m_MipLevels == value.m_MipLevels && m_Italic == value.m_Italic && m_CharSet == value.m_CharSet
\r
206 && m_OutputPrecision == value.m_OutputPrecision && m_Quality == value.m_Quality && m_PitchAndFamily == value.m_PitchAndFamily
\r
207 && m_FaceName == value.m_FaceName );
\r
210 bool FontDescription::Equals( FontDescription% value1, FontDescription% value2 )
\r
212 return ( value1.m_Height == value2.m_Height && value1.m_Width == value2.m_Width && value1.m_Weight == value2.m_Weight
\r
213 && value1.m_MipLevels == value2.m_MipLevels && value1.m_Italic == value2.m_Italic && value1.m_CharSet == value2.m_CharSet
\r
214 && value1.m_OutputPrecision == value2.m_OutputPrecision && value1.m_Quality == value2.m_Quality && value1.m_PitchAndFamily == value2.m_PitchAndFamily
\r
215 && value1.m_FaceName == value2.m_FaceName );
\r