#region PDFsharp - A .NET library for processing PDF // // Authors: // Stefan Lange // // Copyright (c) 2005-2017 empira Software GmbH, Cologne Area (Germany) // // http://www.pdfsharp.com // http://sourceforge.net/projects/pdfsharp // // Permission is hereby granted, free of charge, to any person obtaining a // copy of this software and associated documentation files (the "Software"), // to deal in the Software without restriction, including without limitation // the rights to use, copy, modify, merge, publish, distribute, sublicense, // and/or sell copies of the Software, and to permit persons to whom the // Software is furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included // in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. #endregion // Not used in PDFsharp 1.x. namespace PdfSharp.Drawing { enum FontWeightValues { Thin = 100, ExtraLight = 200, Light = 300, Normal = 400, Medium = 500, SemiBold = 600, Bold = 700, ExtraBold = 800, Black = 900, ExtraBlack = 950, } #if true_ // PDFSHARP20 /// /// Defines a set of static predefined XFontWeight values. /// public static class XFontWeights { internal static bool FontWeightStringToKnownWeight(string s, IFormatProvider provider, ref XFontWeight fontWeight) { int num; switch (s.ToLower()) { case "thin": fontWeight = Thin; return true; case "extralight": fontWeight = ExtraLight; return true; case "ultralight": fontWeight = UltraLight; return true; case "light": fontWeight = Light; return true; case "normal": fontWeight = Normal; return true; case "regular": fontWeight = Regular; return true; case "medium": fontWeight = Medium; return true; case "semibold": fontWeight = SemiBold; return true; case "demibold": fontWeight = DemiBold; return true; case "bold": fontWeight = Bold; return true; case "extrabold": fontWeight = ExtraBold; return true; case "ultrabold": fontWeight = UltraBold; return true; case "heavy": fontWeight = Heavy; return true; case "black": fontWeight = Black; return true; case "extrablack": fontWeight = ExtraBlack; return true; case "ultrablack": fontWeight = UltraBlack; return true; } if (Int32.TryParse(s, NumberStyles.Integer, provider, out num)) { fontWeight = new XFontWeight(num); return true; } return false; } internal static bool FontWeightToString(int weight, out string convertedValue) { switch (weight) { case 100: convertedValue = "Thin"; return true; case 200: convertedValue = "ExtraLight"; return true; case 300: convertedValue = "Light"; return true; case 400: convertedValue = "Normal"; return true; case 500: convertedValue = "Medium"; return true; case 600: convertedValue = "SemiBold"; return true; case 700: convertedValue = "Bold"; return true; case 800: convertedValue = "ExtraBold"; return true; case 900: convertedValue = "Black"; return true; case 950: convertedValue = "ExtraBlack"; return true; } convertedValue = null; return false; } /// /// Specifies a "Thin" font weight. /// public static XFontWeight Thin { get { return new XFontWeight(100); } } /// /// Specifies a "ExtraLight" font weight. /// public static XFontWeight ExtraLight { get { return new XFontWeight(200); } } /// /// Specifies a "UltraLight" font weight. /// public static XFontWeight UltraLight { get { return new XFontWeight(200); } } /// /// Specifies a "Light" font weight. /// public static XFontWeight Light { get { return new XFontWeight(300); } } /// /// Specifies a "Normal" font weight. /// public static XFontWeight Normal { get { return new XFontWeight(400); } } /// /// Specifies a "Regular" font weight. /// public static XFontWeight Regular { get { return new XFontWeight(400); } } /// /// Specifies a "Medium" font weight. /// public static XFontWeight Medium { get { return new XFontWeight(500); } } /// /// Specifies a "SemiBold" font weight. /// public static XFontWeight SemiBold { get { return new XFontWeight(600); } } /// /// Specifies a "DemiBold" font weight. /// public static XFontWeight DemiBold { get { return new XFontWeight(600); } } /// /// Specifies a "Bold" font weight. /// public static XFontWeight Bold { get { return new XFontWeight(700); } } /// /// Specifies a "ExtraBold" font weight. /// public static XFontWeight ExtraBold { get { return new XFontWeight(800); } } /// /// Specifies a "UltraBold" font weight. /// public static XFontWeight UltraBold { get { return new XFontWeight(800); } } /// /// Specifies a "Heavy" font weight. /// public static XFontWeight Heavy { get { return new XFontWeight(900); } } /// /// Specifies a "Black" font weight. /// public static XFontWeight Black { get { return new XFontWeight(900); } } /// /// Specifies a "ExtraBlack" font weight. /// public static XFontWeight ExtraBlack { get { return new XFontWeight(950); } } /// /// Specifies a "UltraBlack" font weight. /// public static XFontWeight UltraBlack { get { return new XFontWeight(950); } } } #endif }