Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / wpf / src / Core / CSharp / MS / Internal / Shaping / CompositeTypefaceMetrics.cs / 1305600 / CompositeTypefaceMetrics.cs
//------------------------------------------------------------------------ // // Microsoft Windows Client Platform // Copyright (C) Microsoft Corporation, 2001 // // File: CompositeTypefaceMetrics.cs // // Contents: Typeface metrics of a composite font // // Created: 5-26-2003 Worachai Chaoweeraprasit (wchao) // //----------------------------------------------------------------------- using System; using System.Collections.Generic; using System.Diagnostics; using System.Windows; using System.Windows.Media; using System.Windows.Markup; // for XmlLanguage using MS.Internal.FontFace; using System.Globalization; namespace MS.Internal.Shaping { ////// Character-based info of a font family /// internal class CompositeTypefaceMetrics : ITypefaceMetrics { private double _underlinePosition; private double _underlineThickness; private double _strikethroughPosition; private double _strikethroughThickenss; private double _capsHeight; private double _xHeight; private FontStyle _style; private FontWeight _weight; private FontStretch _stretch; // the following figures are collected from observation of 'Times New Roman' // at 72 pt in MS-Word. [wchao, 5/26/2003] // The following Offsets are offsets from baseline. Negative means below the baseline. private const double UnderlineOffsetDefaultInEm = -0.15625; private const double UnderlineSizeDefaultInEm = (-UnderlineOffsetDefaultInEm) / 2; private const double StrikethroughOffsetDefaultInEm = 0.3125; private const double StrikethroughSizeDefaultInEm = UnderlineSizeDefaultInEm; private const double CapsHeightDefaultInEm = 1; private const double XHeightDefaultInEm = 0.671875; internal CompositeTypefaceMetrics( double underlinePosition, double underlineThickness, double strikethroughPosition, double strikethroughThickness, double capsHeight, double xHeight, FontStyle style, FontWeight weight, FontStretch stretch ) { _underlinePosition = underlinePosition != 0 ? underlinePosition : UnderlineOffsetDefaultInEm; _underlineThickness = underlineThickness > 0 ? underlineThickness : UnderlineSizeDefaultInEm; _strikethroughPosition = strikethroughPosition != 0 ? strikethroughPosition : StrikethroughOffsetDefaultInEm; _strikethroughThickenss = strikethroughThickness > 0 ? strikethroughThickness : StrikethroughSizeDefaultInEm; _capsHeight = capsHeight > 0 ? capsHeight : CapsHeightDefaultInEm; _xHeight = xHeight > 0 ? xHeight : XHeightDefaultInEm; _style = style; _weight = weight; _stretch = stretch; } internal CompositeTypefaceMetrics() : this( UnderlineOffsetDefaultInEm, UnderlineSizeDefaultInEm, StrikethroughOffsetDefaultInEm, StrikethroughSizeDefaultInEm, CapsHeightDefaultInEm, XHeightDefaultInEm, FontStyles.Normal, FontWeights.Regular, FontStretches.Normal ) { } ////// (Western) x-height relative to em size. /// public double XHeight { get { return _xHeight; } } ////// Distance from baseline to top of English ----, relative to em size. /// public double CapsHeight { get { return _capsHeight; } } ////// Distance from baseline to underline position /// public double UnderlinePosition { get { return _underlinePosition; } } ////// Underline thickness /// public double UnderlineThickness { get { return _underlineThickness; } } ////// Distance from baseline to strike-through position /// public double StrikethroughPosition { get { return _strikethroughPosition; } } ////// strike-through thickness /// public double StrikethroughThickness { get { return _strikethroughThickenss; } } ////// Flag indicate whether this is symbol typeface /// public bool Symbol { get { return false; } } ////// Style simulation flags for this typeface. /// public StyleSimulations StyleSimulations { get { return StyleSimulations.None; } } ////// Collection of localized face names adjusted by the font differentiator. /// public IDictionaryAdjustedFaceNames { get { return FontDifferentiator.ConstructFaceNamesByStyleWeightStretch(_style, _weight, _stretch); } } } } // 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, 2001 // // File: CompositeTypefaceMetrics.cs // // Contents: Typeface metrics of a composite font // // Created: 5-26-2003 Worachai Chaoweeraprasit (wchao) // //----------------------------------------------------------------------- using System; using System.Collections.Generic; using System.Diagnostics; using System.Windows; using System.Windows.Media; using System.Windows.Markup; // for XmlLanguage using MS.Internal.FontFace; using System.Globalization; namespace MS.Internal.Shaping { /// /// Character-based info of a font family /// internal class CompositeTypefaceMetrics : ITypefaceMetrics { private double _underlinePosition; private double _underlineThickness; private double _strikethroughPosition; private double _strikethroughThickenss; private double _capsHeight; private double _xHeight; private FontStyle _style; private FontWeight _weight; private FontStretch _stretch; // the following figures are collected from observation of 'Times New Roman' // at 72 pt in MS-Word. [wchao, 5/26/2003] // The following Offsets are offsets from baseline. Negative means below the baseline. private const double UnderlineOffsetDefaultInEm = -0.15625; private const double UnderlineSizeDefaultInEm = (-UnderlineOffsetDefaultInEm) / 2; private const double StrikethroughOffsetDefaultInEm = 0.3125; private const double StrikethroughSizeDefaultInEm = UnderlineSizeDefaultInEm; private const double CapsHeightDefaultInEm = 1; private const double XHeightDefaultInEm = 0.671875; internal CompositeTypefaceMetrics( double underlinePosition, double underlineThickness, double strikethroughPosition, double strikethroughThickness, double capsHeight, double xHeight, FontStyle style, FontWeight weight, FontStretch stretch ) { _underlinePosition = underlinePosition != 0 ? underlinePosition : UnderlineOffsetDefaultInEm; _underlineThickness = underlineThickness > 0 ? underlineThickness : UnderlineSizeDefaultInEm; _strikethroughPosition = strikethroughPosition != 0 ? strikethroughPosition : StrikethroughOffsetDefaultInEm; _strikethroughThickenss = strikethroughThickness > 0 ? strikethroughThickness : StrikethroughSizeDefaultInEm; _capsHeight = capsHeight > 0 ? capsHeight : CapsHeightDefaultInEm; _xHeight = xHeight > 0 ? xHeight : XHeightDefaultInEm; _style = style; _weight = weight; _stretch = stretch; } internal CompositeTypefaceMetrics() : this( UnderlineOffsetDefaultInEm, UnderlineSizeDefaultInEm, StrikethroughOffsetDefaultInEm, StrikethroughSizeDefaultInEm, CapsHeightDefaultInEm, XHeightDefaultInEm, FontStyles.Normal, FontWeights.Regular, FontStretches.Normal ) { } ////// (Western) x-height relative to em size. /// public double XHeight { get { return _xHeight; } } ////// Distance from baseline to top of English ----, relative to em size. /// public double CapsHeight { get { return _capsHeight; } } ////// Distance from baseline to underline position /// public double UnderlinePosition { get { return _underlinePosition; } } ////// Underline thickness /// public double UnderlineThickness { get { return _underlineThickness; } } ////// Distance from baseline to strike-through position /// public double StrikethroughPosition { get { return _strikethroughPosition; } } ////// strike-through thickness /// public double StrikethroughThickness { get { return _strikethroughThickenss; } } ////// Flag indicate whether this is symbol typeface /// public bool Symbol { get { return false; } } ////// Style simulation flags for this typeface. /// public StyleSimulations StyleSimulations { get { return StyleSimulations.None; } } ////// Collection of localized face names adjusted by the font differentiator. /// public IDictionaryAdjustedFaceNames { get { return FontDifferentiator.ConstructFaceNamesByStyleWeightStretch(_style, _weight, _stretch); } } } } // 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
- WindowsAuthenticationEventArgs.cs
- TableStyle.cs
- X509ClientCertificateCredentialsElement.cs
- OdbcConnectionPoolProviderInfo.cs
- AnnotationResource.cs
- ISSmlParser.cs
- FileFormatException.cs
- XmlNode.cs
- BuildProvider.cs
- querybuilder.cs
- ManagementClass.cs
- XmlNodeChangedEventManager.cs
- Matrix3DConverter.cs
- ParseNumbers.cs
- _Semaphore.cs
- OperatingSystem.cs
- FacetDescription.cs
- AppLevelCompilationSectionCache.cs
- EnumUnknown.cs
- WebPartDisplayModeCancelEventArgs.cs
- TransactionTable.cs
- WSSecurityTokenSerializer.cs
- ListView.cs
- MatrixTransform3D.cs
- PropertyManager.cs
- RSAPKCS1KeyExchangeDeformatter.cs
- DescendantOverDescendantQuery.cs
- MailWebEventProvider.cs
- AstNode.cs
- TreePrinter.cs
- TextLine.cs
- Logging.cs
- SqlDataSourceCustomCommandEditor.cs
- TypeListConverter.cs
- AttributedMetaModel.cs
- DataSetViewSchema.cs
- HttpRuntimeSection.cs
- ActivityTypeDesigner.xaml.cs
- StringUtil.cs
- CapabilitiesState.cs
- BoundsDrawingContextWalker.cs
- JapaneseCalendar.cs
- SoapSchemaMember.cs
- DelegateHelpers.cs
- ExpressionEditorAttribute.cs
- SiteMapNodeItem.cs
- COM2PropertyBuilderUITypeEditor.cs
- WebPartDisplayModeCollection.cs
- ParserContext.cs
- DataErrorValidationRule.cs
- IPipelineRuntime.cs
- WindowsGraphicsWrapper.cs
- ToolStripItemImageRenderEventArgs.cs
- ChangeConflicts.cs
- Style.cs
- OracleString.cs
- Memoizer.cs
- DrawingImage.cs
- CodeParameterDeclarationExpression.cs
- DataGridViewColumnHeaderCell.cs
- SystemPens.cs
- TableItemProviderWrapper.cs
- EntityDataSourceReferenceGroup.cs
- SwitchLevelAttribute.cs
- ToolStripLabel.cs
- CounterCreationData.cs
- Variant.cs
- LogWriteRestartAreaAsyncResult.cs
- TimeManager.cs
- CommentEmitter.cs
- DelegatingConfigHost.cs
- ResourceFallbackManager.cs
- GetImportFileNameRequest.cs
- EpmSyndicationContentDeSerializer.cs
- BrowserCapabilitiesCodeGenerator.cs
- InkCanvasInnerCanvas.cs
- PerformanceCounterPermissionAttribute.cs
- AdobeCFFWrapper.cs
- LoginUtil.cs
- XmlDeclaration.cs
- SubordinateTransaction.cs
- QilName.cs
- CodeCatchClauseCollection.cs
- HandleCollector.cs
- MsmqHostedTransportManager.cs
- ModelPerspective.cs
- DynamicActivityTypeDescriptor.cs
- SweepDirectionValidation.cs
- ObfuscateAssemblyAttribute.cs
- METAHEADER.cs
- columnmapfactory.cs
- TraceListener.cs
- objectresult_tresulttype.cs
- ServerIdentity.cs
- XmlConverter.cs
- CmsInterop.cs
- SessionParameter.cs
- LoadedEvent.cs
- XsdValidatingReader.cs
- HttpWrapper.cs