.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
david stephan
Gaurav Pal
Post New Web Links

Getting usWeightClass of a GlyphTypeface

Posted By:      Posted Date: September 10, 2010    Points: 0   Category :WPF
I'm trying to get the equivalent of a font file's usWeightClass from the OS2 table to determine a font's boldness in a GlyphTypeface, but I can't figure out where GlyphTypeface is getting it's value of Weight from. Moreover, FontWeights Class appears to just be an enum of usWeightClass possible values and can't get the Weight Class of a font. For example, Arial Rounded MT Bold, in a GlyphTypeface, as a value of Bold, 700. But this is incorrect in terms of it's Weight Class (usWeightClass in the OS2 table), which is actually 400, and the fsSelection (also in the OS2 table) has bit 6 set, which means "Normal" or "Regular" (i.e. not bold or italic). Obviously, GlyphTypeface is interpretting something in the file to set .Weight = Bold, but I don't know where it is getting its value from. Sub GetFontWeight() Dim arialRoundedMTBold As GlyphTypeface = New GlyphTypeface(New Uri("file:///C:/WINDOWS/FONTS/ARLRDBD.TTF")) Dim weight = arialRoundedMTBold.Weight Dim weightClass = weight.ToOpenTypeWeight Console.WriteLine("Weight: " & weight.ToString & ":" & weightClass.ToString) Console.ReadLine() End Sub Is there anyway to get a font's usWeightClass value in .NET? ??  

View Complete Post

More Related Resource Links

ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend