Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / wpf / src / Core / CSharp / MS / Internal / Shaping / ShapeTypeface.cs / 1305600 / ShapeTypeface.cs
//------------------------------------------------------------------------ // // Microsoft Windows Client Platform // Copyright (C) Microsoft Corporation, 2002 // // File: ShapeTypeface.cs // // Contents: GlyphTypeface with shaping capability // // Created: 10-13-2003 Worachai Chaoweeraprasit (wchao) // //----------------------------------------------------------------------- using System; using System.Runtime.InteropServices; using System.Collections; using System.Collections.Generic; using System.Globalization; using System.Diagnostics; using System.Security; using System.Windows; using System.Windows.Media; using System.Windows.Media.TextFormatting; using MS.Utility; using MS.Internal; using MS.Internal.FontCache; using MS.Internal.FontFace; using MS.Internal.TextFormatting; using FontFace = MS.Internal.FontFace; namespace MS.Internal.Shaping { ////// Typeface that is capable of shaping character string. Shaping is done /// thru shaping engines. /// internal class ShapeTypeface { private GlyphTypeface _glyphTypeface; private IDeviceFont _deviceFont; internal ShapeTypeface( GlyphTypeface glyphTypeface, IDeviceFont deviceFont ) { Invariant.Assert(glyphTypeface != null); _glyphTypeface = glyphTypeface; _deviceFont = deviceFont; } public override int GetHashCode() { return HashFn.HashMultiply(_glyphTypeface.GetHashCode()) + (_deviceFont == null ? 0 : _deviceFont.Name.GetHashCode()); } public override bool Equals(object o) { ShapeTypeface t = o as ShapeTypeface; if(t == null) return false; if (_deviceFont == null) { if (t._deviceFont != null) return false; } else { if (t._deviceFont == null || t._deviceFont.Name != _deviceFont.Name) return false; } return _glyphTypeface.Equals(t._glyphTypeface); } internal IDeviceFont DeviceFont { get { return _deviceFont; } } ////// Get physical font face /// internal GlyphTypeface GlyphTypeface { get { return _glyphTypeface; } } } ////// Scaled shape typeface /// internal class ScaledShapeTypeface { private ShapeTypeface _shapeTypeface; private double _scaleInEm; private bool _nullShape; internal ScaledShapeTypeface( GlyphTypeface glyphTypeface, IDeviceFont deviceFont, double scaleInEm, bool nullShape ) { _shapeTypeface = new ShapeTypeface(glyphTypeface, deviceFont); _scaleInEm = scaleInEm; _nullShape = nullShape; } internal ShapeTypeface ShapeTypeface { get { return _shapeTypeface; } } internal double ScaleInEm { get { return _scaleInEm; } } internal bool NullShape { get { return _nullShape; } } public override int GetHashCode() { int hash = _shapeTypeface.GetHashCode(); unsafe { hash = HashFn.HashMultiply(hash) + (int)(_nullShape ? 1 : 0); hash = HashFn.HashMultiply(hash) + _scaleInEm.GetHashCode(); return HashFn.HashScramble(hash); } } public override bool Equals(object o) { ScaledShapeTypeface t = o as ScaledShapeTypeface; if (t == null) return false; return _shapeTypeface.Equals(t._shapeTypeface) && _scaleInEm == t._scaleInEm && _nullShape == t._nullShape; } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved. //------------------------------------------------------------------------ // // Microsoft Windows Client Platform // Copyright (C) Microsoft Corporation, 2002 // // File: ShapeTypeface.cs // // Contents: GlyphTypeface with shaping capability // // Created: 10-13-2003 Worachai Chaoweeraprasit (wchao) // //----------------------------------------------------------------------- using System; using System.Runtime.InteropServices; using System.Collections; using System.Collections.Generic; using System.Globalization; using System.Diagnostics; using System.Security; using System.Windows; using System.Windows.Media; using System.Windows.Media.TextFormatting; using MS.Utility; using MS.Internal; using MS.Internal.FontCache; using MS.Internal.FontFace; using MS.Internal.TextFormatting; using FontFace = MS.Internal.FontFace; namespace MS.Internal.Shaping { ////// Typeface that is capable of shaping character string. Shaping is done /// thru shaping engines. /// internal class ShapeTypeface { private GlyphTypeface _glyphTypeface; private IDeviceFont _deviceFont; internal ShapeTypeface( GlyphTypeface glyphTypeface, IDeviceFont deviceFont ) { Invariant.Assert(glyphTypeface != null); _glyphTypeface = glyphTypeface; _deviceFont = deviceFont; } public override int GetHashCode() { return HashFn.HashMultiply(_glyphTypeface.GetHashCode()) + (_deviceFont == null ? 0 : _deviceFont.Name.GetHashCode()); } public override bool Equals(object o) { ShapeTypeface t = o as ShapeTypeface; if(t == null) return false; if (_deviceFont == null) { if (t._deviceFont != null) return false; } else { if (t._deviceFont == null || t._deviceFont.Name != _deviceFont.Name) return false; } return _glyphTypeface.Equals(t._glyphTypeface); } internal IDeviceFont DeviceFont { get { return _deviceFont; } } ////// Get physical font face /// internal GlyphTypeface GlyphTypeface { get { return _glyphTypeface; } } } ////// Scaled shape typeface /// internal class ScaledShapeTypeface { private ShapeTypeface _shapeTypeface; private double _scaleInEm; private bool _nullShape; internal ScaledShapeTypeface( GlyphTypeface glyphTypeface, IDeviceFont deviceFont, double scaleInEm, bool nullShape ) { _shapeTypeface = new ShapeTypeface(glyphTypeface, deviceFont); _scaleInEm = scaleInEm; _nullShape = nullShape; } internal ShapeTypeface ShapeTypeface { get { return _shapeTypeface; } } internal double ScaleInEm { get { return _scaleInEm; } } internal bool NullShape { get { return _nullShape; } } public override int GetHashCode() { int hash = _shapeTypeface.GetHashCode(); unsafe { hash = HashFn.HashMultiply(hash) + (int)(_nullShape ? 1 : 0); hash = HashFn.HashMultiply(hash) + _scaleInEm.GetHashCode(); return HashFn.HashScramble(hash); } } public override bool Equals(object o) { ScaledShapeTypeface t = o as ScaledShapeTypeface; if (t == null) return false; return _shapeTypeface.Equals(t._shapeTypeface) && _scaleInEm == t._scaleInEm && _nullShape == t._nullShape; } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- Style.cs
- BaseTemplateParser.cs
- HitTestWithGeometryDrawingContextWalker.cs
- SQLMoney.cs
- State.cs
- SqlCommand.cs
- DataGrid.cs
- DataGridViewAdvancedBorderStyle.cs
- WebSysDisplayNameAttribute.cs
- Compress.cs
- TextFindEngine.cs
- FontDifferentiator.cs
- FormsAuthenticationUser.cs
- WrappedKeySecurityTokenParameters.cs
- TopClause.cs
- KeyConstraint.cs
- Expr.cs
- TemplatePropertyEntry.cs
- WSSecurityOneDotZeroSendSecurityHeader.cs
- LineServicesCallbacks.cs
- ValueUnavailableException.cs
- DataGridBeginningEditEventArgs.cs
- SimpleBitVector32.cs
- DesignerActionKeyboardBehavior.cs
- XmlNavigatorFilter.cs
- DiscreteKeyFrames.cs
- CodeDOMUtility.cs
- ChannelRequirements.cs
- VariableQuery.cs
- AuthorizationRule.cs
- BamlRecordWriter.cs
- PointKeyFrameCollection.cs
- EdmSchemaAttribute.cs
- _KerberosClient.cs
- TableColumn.cs
- ExternalFile.cs
- OracleBinary.cs
- DbParameterCollection.cs
- PerformanceCounterManager.cs
- TaskFileService.cs
- TemplateControl.cs
- PackageFilter.cs
- SQLBoolean.cs
- SequentialWorkflowRootDesigner.cs
- MetadataSource.cs
- CustomAttributeBuilder.cs
- DateTimeAutomationPeer.cs
- SafeRightsManagementSessionHandle.cs
- StrokeNode.cs
- DataGridViewLayoutData.cs
- BooleanToVisibilityConverter.cs
- BuildResult.cs
- DataGridViewTextBoxColumn.cs
- BidirectionalDictionary.cs
- CompensableActivity.cs
- MenuItemBinding.cs
- ToolStripItemDesigner.cs
- PriorityBinding.cs
- VectorCollectionConverter.cs
- brushes.cs
- SurrogateSelector.cs
- OdbcHandle.cs
- _ChunkParse.cs
- SchemaSetCompiler.cs
- NavigateEvent.cs
- OdbcEnvironmentHandle.cs
- DecimalKeyFrameCollection.cs
- SimpleHandlerFactory.cs
- TextRunProperties.cs
- FigureParagraph.cs
- Internal.cs
- NavigationPropertyEmitter.cs
- XmlSchemaAttributeGroup.cs
- XmlSchemaFacet.cs
- SqlDataSourceRefreshSchemaForm.cs
- ResourcesChangeInfo.cs
- WebResponse.cs
- DataGridTable.cs
- ConstNode.cs
- DataGridViewAutoSizeColumnsModeEventArgs.cs
- HtmlUtf8RawTextWriter.cs
- ToolStripSplitStackLayout.cs
- Transform3DCollection.cs
- BinaryVersion.cs
- NamedElement.cs
- PropertyPushdownHelper.cs
- StackBuilderSink.cs
- UnknownBitmapDecoder.cs
- SqlConnection.cs
- ObjectViewListener.cs
- TreeNodeMouseHoverEvent.cs
- LogRecordSequence.cs
- SymbolType.cs
- SBCSCodePageEncoding.cs
- Axis.cs
- ObjectContextServiceProvider.cs
- COM2IDispatchConverter.cs
- FamilyTypeface.cs
- ExpandoObject.cs
- FrameworkPropertyMetadata.cs