Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / wpf / src / Core / CSharp / MS / Internal / Shaping / GlyphInfoList.cs / 1305600 / GlyphInfoList.cs
//----------------------------------------------------------------------------
//
//
// Copyright (C) Microsoft Corporation. All rights reserved.
//
//
//
// Description: GlyphInfoList class
//
// History:
// 09/24/2004: Garyyang: Moved GlyphInfoList class out from ShapingEngine.cs
// into this seperate file
//
//---------------------------------------------------------------------------
using System;
using System.Diagnostics;
using System.Windows.Media.TextFormatting;
using System.Security;
using System.Security.Permissions;
using MS.Internal;
using MS.Internal.PresentationCore;
namespace MS.Internal.Shaping
{
///
/// Glyph info list
///
///
/// A bundle of several per-glyph result data of GetGlyphs API.
/// All array members have the same number of elements. They
/// grow and shrink at the same degree at the same time.
///
internal class GlyphInfoList
{
internal GlyphInfoList(int capacity, int leap, bool justify)
{
_glyphs = new UshortList(capacity, leap);
_glyphFlags = new UshortList(capacity, leap);
_firstChars = new UshortList(capacity, leap);
_ligatureCounts = new UshortList(capacity, leap);
}
///
/// Length of the current run
///
public int Length
{
get { return _glyphs.Length; }
}
///
/// Offset of current sublist in storage
///
internal int Offset
{
get { return _glyphs.Offset; }
}
///
/// Validate glyph info length
///
[Conditional("DEBUG")]
internal void ValidateLength(int cch)
{
Debug.Assert(_glyphs.Offset + _glyphs.Length == cch, "Invalid glyph length!");
}
///
/// Limit range of accessing glyphinfo
///
public void SetRange(int index, int length)
{
_glyphs.SetRange(index, length);
_glyphFlags.SetRange(index, length);
_firstChars.SetRange(index, length);
_ligatureCounts.SetRange(index, length);
}
///
/// Set glyph run length (use with care)
///
///
/// Critical - calls critical code
///
[SecurityCritical]
public void SetLength(int length)
{
_glyphs.Length = length;
_glyphFlags.Length = length;
_firstChars.Length = length;
_ligatureCounts.Length = length;
}
public void Insert(int index, int Count)
{
_glyphs.Insert(index, Count);
_glyphFlags.Insert(index, Count);
_firstChars.Insert(index, Count);
_ligatureCounts.Insert(index, Count);
}
public void Remove(int index, int Count)
{
_glyphs.Remove(index, Count);
_glyphFlags.Remove(index, Count);
_firstChars.Remove(index, Count);
_ligatureCounts.Remove(index, Count);
}
public UshortList Glyphs
{
get { return _glyphs; }
}
public UshortList GlyphFlags
{
get { return _glyphFlags; }
}
public UshortList FirstChars
{
get { return _firstChars; }
}
public UshortList LigatureCounts
{
get { return _ligatureCounts; }
}
private UshortList _glyphs;
private UshortList _glyphFlags;
private UshortList _firstChars;
private UshortList _ligatureCounts;
}
[Flags]
internal enum GlyphFlags : ushort
{
/**** [Bit 0-7 OpenType flags] ****/
// Value 0-4 used. Value 5 - 15 Reserved
Unassigned = 0x0000,
Base = 0x0001,
Ligature = 0x0002,
Mark = 0x0003,
Component = 0x0004,
Unresolved = 0x0007,
GlyphTypeMask = 0x0007,
// Bit 4-5 used. Bit 7 Reserved
Substituted = 0x0010,
Positioned = 0x0020,
NotChanged = 0x0000,
// reserved for OTLS internal use
// inside one call
CursiveConnected = 0x0040,
//bit 7 - reserved
/**** [Bit 8-15 Avalon flags] ****/
ClusterStart = 0x0100, // First glyph of cluster
Diacritic = 0x0200, // Diacritic
ZeroWidth = 0x0400, // Blank, ZWJ, ZWNJ etc, with no width
Missing = 0x0800, // Missing glyph
InvalidBase = 0x1000, // Glyph of U+25cc indicating invalid base glyph
}
}
// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
// Copyright (c) Microsoft Corporation. All rights reserved.
//----------------------------------------------------------------------------
//
//
// Copyright (C) Microsoft Corporation. All rights reserved.
//
//
//
// Description: GlyphInfoList class
//
// History:
// 09/24/2004: Garyyang: Moved GlyphInfoList class out from ShapingEngine.cs
// into this seperate file
//
//---------------------------------------------------------------------------
using System;
using System.Diagnostics;
using System.Windows.Media.TextFormatting;
using System.Security;
using System.Security.Permissions;
using MS.Internal;
using MS.Internal.PresentationCore;
namespace MS.Internal.Shaping
{
///
/// Glyph info list
///
///
/// A bundle of several per-glyph result data of GetGlyphs API.
/// All array members have the same number of elements. They
/// grow and shrink at the same degree at the same time.
///
internal class GlyphInfoList
{
internal GlyphInfoList(int capacity, int leap, bool justify)
{
_glyphs = new UshortList(capacity, leap);
_glyphFlags = new UshortList(capacity, leap);
_firstChars = new UshortList(capacity, leap);
_ligatureCounts = new UshortList(capacity, leap);
}
///
/// Length of the current run
///
public int Length
{
get { return _glyphs.Length; }
}
///
/// Offset of current sublist in storage
///
internal int Offset
{
get { return _glyphs.Offset; }
}
///
/// Validate glyph info length
///
[Conditional("DEBUG")]
internal void ValidateLength(int cch)
{
Debug.Assert(_glyphs.Offset + _glyphs.Length == cch, "Invalid glyph length!");
}
///
/// Limit range of accessing glyphinfo
///
public void SetRange(int index, int length)
{
_glyphs.SetRange(index, length);
_glyphFlags.SetRange(index, length);
_firstChars.SetRange(index, length);
_ligatureCounts.SetRange(index, length);
}
///
/// Set glyph run length (use with care)
///
///
/// Critical - calls critical code
///
[SecurityCritical]
public void SetLength(int length)
{
_glyphs.Length = length;
_glyphFlags.Length = length;
_firstChars.Length = length;
_ligatureCounts.Length = length;
}
public void Insert(int index, int Count)
{
_glyphs.Insert(index, Count);
_glyphFlags.Insert(index, Count);
_firstChars.Insert(index, Count);
_ligatureCounts.Insert(index, Count);
}
public void Remove(int index, int Count)
{
_glyphs.Remove(index, Count);
_glyphFlags.Remove(index, Count);
_firstChars.Remove(index, Count);
_ligatureCounts.Remove(index, Count);
}
public UshortList Glyphs
{
get { return _glyphs; }
}
public UshortList GlyphFlags
{
get { return _glyphFlags; }
}
public UshortList FirstChars
{
get { return _firstChars; }
}
public UshortList LigatureCounts
{
get { return _ligatureCounts; }
}
private UshortList _glyphs;
private UshortList _glyphFlags;
private UshortList _firstChars;
private UshortList _ligatureCounts;
}
[Flags]
internal enum GlyphFlags : ushort
{
/**** [Bit 0-7 OpenType flags] ****/
// Value 0-4 used. Value 5 - 15 Reserved
Unassigned = 0x0000,
Base = 0x0001,
Ligature = 0x0002,
Mark = 0x0003,
Component = 0x0004,
Unresolved = 0x0007,
GlyphTypeMask = 0x0007,
// Bit 4-5 used. Bit 7 Reserved
Substituted = 0x0010,
Positioned = 0x0020,
NotChanged = 0x0000,
// reserved for OTLS internal use
// inside one call
CursiveConnected = 0x0040,
//bit 7 - reserved
/**** [Bit 8-15 Avalon flags] ****/
ClusterStart = 0x0100, // First glyph of cluster
Diacritic = 0x0200, // Diacritic
ZeroWidth = 0x0400, // Blank, ZWJ, ZWNJ etc, with no width
Missing = 0x0800, // Missing glyph
InvalidBase = 0x1000, // Glyph of U+25cc indicating invalid base glyph
}
}
// 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
- SmiMetaData.cs
- PKCS1MaskGenerationMethod.cs
- IDispatchConstantAttribute.cs
- WindowsIPAddress.cs
- ApplicationCommands.cs
- HostProtectionPermission.cs
- SoapSchemaMember.cs
- MetadataFile.cs
- ToolStripTextBox.cs
- DataRelationCollection.cs
- WindowsMenu.cs
- DPAPIProtectedConfigurationProvider.cs
- WpfKnownMember.cs
- ContractAdapter.cs
- AnimatedTypeHelpers.cs
- PolyBezierSegment.cs
- PointAnimationClockResource.cs
- ProgressChangedEventArgs.cs
- Light.cs
- XPathDocumentNavigator.cs
- InvalidOperationException.cs
- IgnoreSection.cs
- SessionStateModule.cs
- ColorTranslator.cs
- COAUTHINFO.cs
- NonBatchDirectoryCompiler.cs
- JournalEntry.cs
- ShaderEffect.cs
- NotifyParentPropertyAttribute.cs
- SoapSchemaMember.cs
- SystemColors.cs
- Oid.cs
- DeploymentExceptionMapper.cs
- SendingRequestEventArgs.cs
- CompilerInfo.cs
- NamedObject.cs
- ContextCorrelationInitializer.cs
- ConfigurationException.cs
- BinHexEncoding.cs
- WindowsGraphicsWrapper.cs
- StorageEntityContainerMapping.cs
- DesignerTransactionCloseEvent.cs
- DbProviderFactory.cs
- ColumnHeaderConverter.cs
- StaticFileHandler.cs
- TextEmbeddedObject.cs
- FileDataSourceCache.cs
- COM2ICategorizePropertiesHandler.cs
- ExternalDataExchangeService.cs
- DecimalFormatter.cs
- PropertyHelper.cs
- DependencyPropertyAttribute.cs
- CmsInterop.cs
- DesignerActionMethodItem.cs
- ParseNumbers.cs
- BasicViewGenerator.cs
- InvalidAsynchronousStateException.cs
- SHA512Managed.cs
- Visual3D.cs
- SelectionRange.cs
- DropShadowBitmapEffect.cs
- RootDesignerSerializerAttribute.cs
- ISCIIEncoding.cs
- ExceptionUtil.cs
- EventDescriptor.cs
- WebPartDisplayMode.cs
- PackageProperties.cs
- TrustManagerMoreInformation.cs
- ChannelSinkStacks.cs
- ZipIOZip64EndOfCentralDirectoryBlock.cs
- HtmlInputControl.cs
- BitmapCodecInfoInternal.cs
- RSAPKCS1KeyExchangeDeformatter.cs
- HeaderCollection.cs
- Label.cs
- followingquery.cs
- OletxResourceManager.cs
- DataGridItem.cs
- Menu.cs
- ColumnResult.cs
- LogWriteRestartAreaState.cs
- Script.cs
- FrameworkElementFactory.cs
- TreeNodeBinding.cs
- unitconverter.cs
- BuildManagerHost.cs
- DiffuseMaterial.cs
- DefaultValueAttribute.cs
- BamlLocalizationDictionary.cs
- DispatcherFrame.cs
- MergeFilterQuery.cs
- HttpCacheVary.cs
- PeerEndPoint.cs
- CodeDOMProvider.cs
- NamespaceCollection.cs
- UnsafeNativeMethods.cs
- SafeThemeHandle.cs
- FrameworkReadOnlyPropertyMetadata.cs
- MenuAutomationPeer.cs
- ToolStripTextBox.cs