Changeset 10889
- Timestamp:
- 05/26/14 13:24:43 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Persistence/3.3/Default/Xml/Primitive/System.Drawing/Font2XmlSerializer.cs
r9988 r10889 28 28 public override XmlString Format(Font font) { 29 29 return new XmlString(string.Format("{0};{1};{2};{3};{4};{5}", 30 font.FontFamily.Name,30 GetFontFamilyName(font.FontFamily), 31 31 Float2XmlSerializer.FormatG8(font.Size), 32 32 font.Style, … … 39 39 string[] tokens = fontData.Data.Split(';'); 40 40 return new Font( 41 tokens[0],41 GetFontFamily(tokens[0]), 42 42 Float2XmlSerializer.ParseG8(tokens[1]), 43 43 (FontStyle)Enum.Parse(typeof(FontStyle), tokens[2]), … … 46 46 bool.Parse(tokens[5])); 47 47 } 48 49 public const string GENERIC_MONOSPACE_NAME = "_GenericMonospace"; 50 public const string GENERIC_SANS_SERIF_NAME = "_GenericSansSerif"; 51 public const string GENERIC_SERIF_NAME = "_GenericSerif"; 52 53 public static FontFamily GetFontFamily(string name) { 54 if (name == GENERIC_MONOSPACE_NAME) return FontFamily.GenericMonospace; 55 if (name == GENERIC_SANS_SERIF_NAME) return FontFamily.GenericSansSerif; 56 if (name == GENERIC_SERIF_NAME) return FontFamily.GenericSerif; 57 return new FontFamily(name); 58 } 59 60 public string GetFontFamilyName(FontFamily ff) { 61 if (ff.Equals(FontFamily.GenericMonospace)) return GENERIC_MONOSPACE_NAME; 62 if (ff.Equals(FontFamily.GenericSansSerif)) return GENERIC_SANS_SERIF_NAME; 63 if (ff.Equals(FontFamily.GenericSerif)) return GENERIC_SERIF_NAME; 64 return ff.Name; 65 } 66 48 67 } 49 68 }
Note: See TracChangeset
for help on using the changeset viewer.