Code:
/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / wpf / src / Framework / MS / Internal / Text / LineMetrics.cs / 1305600 / LineMetrics.cs
//---------------------------------------------------------------------------- // // Copyright (C) Microsoft Corporation. All rights reserved. // // File: LineMetrics.cs // // Description: Cached metrics of a text line. // // History: // 04/25/2003 : [....] - moving from Avalon branch. // //--------------------------------------------------------------------------- using System; using System.Diagnostics; using System.Windows; using System.Windows.Media; using System.Windows.Media.TextFormatting; namespace MS.Internal.Text { // --------------------------------------------------------------------- // Storage for metrics of a formatted line. // --------------------------------------------------------------------- internal struct LineMetrics { // ------------------------------------------------------------------ // Constructor. // // wrappingWidth - wrapping width for the line // length - number or characters in the line // width - width of the line // height - height of the line // baseline - baseline of the line // hasInlineObjects - has inline objects? // ----------------------------------------------------------------- internal LineMetrics( #if DEBUG double wrappingWidth, #endif int length, double width, double height, double baseline, bool hasInlineObjects, TextLineBreak textLineBreak) { #if DEBUG _wrappingWidth = wrappingWidth; #endif _start = 0; _width = width; _height = height; _baseline = baseline; _textLineBreak = textLineBreak; _packedData = ((uint) length & LengthMask) | (hasInlineObjects ? HasInlineObjectsMask : 0); } internal LineMetrics(LineMetrics source, double start, double width) { #if DEBUG _wrappingWidth = source.WrappingWidth; #endif _start = start; _width = width; _height = source.Height; _baseline = source.Baseline; _textLineBreak = source.TextLineBreak; _packedData = source._packedData | HasBeenUpdatedMask; } ////// Disposes linebreak object /// internal LineMetrics Dispose(bool returnUpdatedMetrics) { if(_textLineBreak != null) { _textLineBreak.Dispose(); if (returnUpdatedMetrics) { return new LineMetrics( #if DEBUG _wrappingWidth, #endif Length, _width, _height, _baseline, HasInlineObjects, null); } } return this; } #if DEBUG // ------------------------------------------------------------------ // Wrapping width for the line. // ------------------------------------------------------------------ internal double WrappingWidth { get { return _wrappingWidth; } } private double _wrappingWidth; #endif // ----------------------------------------------------------------- // Number or characters in the line. // ------------------------------------------------------------------ internal int Length { get { return (int) (_packedData & LengthMask); } } private uint _packedData; // ----------------------------------------------------------------- // Width of the line. // ----------------------------------------------------------------- internal double Width { get { Debug.Assert((_packedData & HasBeenUpdatedMask) != 0); return _width; } } private double _width; // ----------------------------------------------------------------- // Height of the line. // ------------------------------------------------------------------ internal double Height { get { return _height; } } private double _height; // ----------------------------------------------------------------- // Start of the line. Distance from paragraph edge to line start. // ------------------------------------------------------------------ internal double Start { get { Debug.Assert((_packedData & HasBeenUpdatedMask) != 0); return _start; } } private double _start; // ------------------------------------------------------------------ // Baseline offset of the line. // ----------------------------------------------------------------- internal double Baseline { get { return _baseline; } } private double _baseline; // ------------------------------------------------------------------ // Has inline objects? // ----------------------------------------------------------------- internal bool HasInlineObjects { get { return (_packedData & HasInlineObjectsMask) != 0; } } // ----------------------------------------------------------------- // Line break for formatting. (Line Break In) // ----------------------------------------------------------------- internal TextLineBreak TextLineBreak { get { return _textLineBreak; } } private TextLineBreak _textLineBreak; private static readonly uint HasBeenUpdatedMask = 0x40000000; private static readonly uint LengthMask = 0x3FFFFFFF; private static readonly uint HasInlineObjectsMask = 0x80000000; } } // 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
- wgx_render.cs
- DeclaredTypeElement.cs
- MemoryMappedViewAccessor.cs
- CopyOfAction.cs
- ListViewGroup.cs
- XsdBuildProvider.cs
- DbUpdateCommandTree.cs
- RoleManagerModule.cs
- Events.cs
- TextSelectionHelper.cs
- PowerStatus.cs
- ItemContainerPattern.cs
- COM2TypeInfoProcessor.cs
- XmlAtomicValue.cs
- SqlWorkflowPersistenceService.cs
- X509ChainElement.cs
- SqlColumnizer.cs
- SmtpDigestAuthenticationModule.cs
- LineMetrics.cs
- PropertyChangingEventArgs.cs
- WorkflowTransactionOptions.cs
- InsufficientMemoryException.cs
- SafeNativeMethods.cs
- DockingAttribute.cs
- DatasetMethodGenerator.cs
- UIElementParaClient.cs
- TableLayoutSettingsTypeConverter.cs
- Rect.cs
- base64Transforms.cs
- FocusManager.cs
- TextBoxView.cs
- DependencyObjectProvider.cs
- StaticResourceExtension.cs
- httpserverutility.cs
- RegexCompilationInfo.cs
- MaterialCollection.cs
- HtmlInputRadioButton.cs
- WebHeaderCollection.cs
- SchemaCompiler.cs
- AsynchronousChannelMergeEnumerator.cs
- ProxyAttribute.cs
- AttributeCollection.cs
- ObjectAnimationUsingKeyFrames.cs
- CompletionCallbackWrapper.cs
- ComponentCommands.cs
- IgnoreSectionHandler.cs
- SqlClientFactory.cs
- StreamWriter.cs
- ValueChangedEventManager.cs
- MediaSystem.cs
- ColumnTypeConverter.cs
- BamlResourceContent.cs
- Command.cs
- ExpanderAutomationPeer.cs
- ConnectionProviderAttribute.cs
- DecimalConstantAttribute.cs
- ContextMenu.cs
- UIElementIsland.cs
- WebScriptEndpoint.cs
- GACIdentityPermission.cs
- SuppressedPackageProperties.cs
- LabelLiteral.cs
- XpsS0ValidatingLoader.cs
- DataRecord.cs
- Error.cs
- QueryOptionExpression.cs
- TreeNode.cs
- XmlNullResolver.cs
- ChannelRequirements.cs
- Configuration.cs
- UnsafeNativeMethods.cs
- EnumMember.cs
- BamlLocalizableResourceKey.cs
- TrimSurroundingWhitespaceAttribute.cs
- CalendarItem.cs
- ReflectionTypeLoadException.cs
- AdRotator.cs
- ArgumentDirectionHelper.cs
- SizeFConverter.cs
- WebContext.cs
- SqlUdtInfo.cs
- EditCommandColumn.cs
- DataFieldConverter.cs
- AppAction.cs
- CodeEntryPointMethod.cs
- SeekableReadStream.cs
- TextTreeTextNode.cs
- Query.cs
- SqlLiftIndependentRowExpressions.cs
- HwndMouseInputProvider.cs
- Overlapped.cs
- SHA1.cs
- IPPacketInformation.cs
- HitTestWithPointDrawingContextWalker.cs
- ListenerElementsCollection.cs
- ApplicationServicesHostFactory.cs
- ExclusiveTcpListener.cs
- SHA256Cng.cs
- GAC.cs
- TransportChannelFactory.cs