public LoadedFont GetLoadedFont(FontType type) { try { var name = type.ToString(); if (name.StartsWith("Gui")) { name = name.Remove(0, 3); return((LoadedFont)Properties.GuiFonts.Default[name]); } else if (name.StartsWith("Map")) { name = name.Remove(0, 3); return((LoadedFont)Properties.MapFonts.Default[name]); } else { return((LoadedFont)Enum.Parse(typeof(LoadedFont), name)); } } catch (Exception ex) { Program.WriteLog(ex); return(LoadedFont.Rockwell13); } }
public PdfPTable Render() { var baseFont = BaseFont.CreateFont(FontName, FontEncoding, Embedded); var font = new Font(baseFont, FontSize); font.SetColor(FontColor.R, FontColor.G, FontColor.B); font.SetStyle(FontStyle.ToString()); font.SetFamily(FontType.ToString()); var cell = new PdfPCell(new Phrase(Text)) { BorderWidth = 0, VerticalAlignment = 1, HorizontalAlignment = 1 }; var tbl = new PdfPTable(1); tbl.DefaultCell.Phrase = new Phrase() { Font = font }; tbl.AddCell(cell); tbl.WidthPercentage = 100; return(tbl); }
public void SetLoadedFont(FontType type, LoadedFont font) { var name = type.ToString(); if (name.StartsWith("Gui")) { name = name.Remove(0, 3); Properties.GuiFonts.Default[name] = font; } else if (name.StartsWith("Map")) { name = name.Remove(0, 3); Properties.MapFonts.Default[name] = font; } }
public override string ToString() { StringBuilder sb = new StringBuilder(); sb.Append("POI=[Typ=0x"); sb.Append(Type.ToString("x2")); if (Subtype > 0x0) { sb.Append(Subtype.ToString("x2")); } sb.AppendFormat(" {0}x{1}", Width, Height); sb.Append(" ColormodeDay=" + ColormodeDay.ToString()); sb.Append(" ColormodeNight=" + ColormodeNight.ToString()); if (FontType != Fontdata.Default) { sb.Append(" Fonttyp=[" + FontType.ToString() + "]"); } if (FontColType != FontColours.No) { sb.Append(" CustomColours=["); switch (FontColType) { case FontColours.Day: sb.Append("Day=" + colFontColour[0].ToString()); break; case FontColours.Night: sb.Append("Night=" + colFontColour[1].ToString()); break; case FontColours.DayAndNight: sb.Append("Day=" + colFontColour[0].ToString()); sb.Append(" Night=" + colFontColour[0].ToString()); break; } sb.Append("]"); } if (WithString) { sb.Append(" " + Text.ToString()); } sb.Append(" ]"); return(sb.ToString()); }
/// <summary> /// Loads the underlying font. /// </summary> private void LoadIfNecessary() { if (!fontLoaded) { switch (fontType) { case FontType.Link: realFont = new TrueTypeFont(properties); break; case FontType.Embed: case FontType.Subset: realFont = LoadCIDFont(); break; default: throw new Exception("Unknown font type: " + fontType.ToString()); } fontLoaded = true; } }
public override string ToString() { StringBuilder sb = new StringBuilder(); sb.Append("Polyline=[Typ=0x"); sb.Append(Type.ToString("x2")); if (Type >= 0x100) { sb.Append(Subtype.ToString("x2")); } sb.Append(" " + Polylinetype.ToString() + " "); switch (Polylinetype) { case PolylineType.Day2: sb.Append(colDayColor[0].ToString()); sb.Append(" " + colDayColor[1].ToString()); break; case PolylineType.Day2_Night2: sb.Append(colDayColor[0].ToString()); sb.Append(" " + colDayColor[1].ToString()); sb.Append(" " + colNightColor[0].ToString()); sb.Append(" " + colNightColor[1].ToString()); break; case PolylineType.Day1_Night2: sb.Append(colDayColor[0].ToString()); sb.Append(" " + colNightColor[0].ToString()); sb.Append(" " + colNightColor[1].ToString()); break; case PolylineType.NoBorder_Day2_Night1: sb.Append(colDayColor[0].ToString()); sb.Append(" " + colDayColor[1].ToString()); sb.Append(" " + colNightColor[0].ToString()); break; case PolylineType.NoBorder_Day1: sb.Append(colDayColor[0].ToString()); break; case PolylineType.NoBorder_Day1_Night1: sb.Append(colDayColor[0].ToString()); sb.Append(" " + colNightColor[0].ToString()); break; } if (BitmapHeight > 0) { sb.Append(" " + XBitmapDay.ToString()); } if (InnerWidth > 0) { sb.Append(" Width=" + InnerWidth.ToString()); if (BorderWidth > 0) { sb.Append(" Border=" + BorderWidth.ToString()); } } if (FontType != Fontdata.Default) { sb.Append(" Fonttyp=[" + FontType.ToString() + "]"); } if (FontColType != FontColours.No) { sb.Append(" CustomColours=["); switch (FontColType) { case FontColours.Day: sb.Append("Day=" + colFontColour[0].ToString()); break; case FontColours.Night: sb.Append("Night=" + colFontColour[1].ToString()); break; case FontColours.DayAndNight: sb.Append("Day=" + colFontColour[0].ToString()); sb.Append(" Night=" + colFontColour[0].ToString()); break; } sb.Append("]"); } if (WithString) { sb.Append(" " + Text.ToString()); } sb.Append(" ]"); return(sb.ToString()); }
public override string ToString() { StringBuilder sb = new StringBuilder(); sb.Append("Polygone=[Typ=0x"); sb.Append(Type.ToString("x2")); if (Type >= 0x100) { sb.Append(Subtype.ToString("x2")); } sb.Append(" " + Colortype.ToString() + " "); switch (Colortype) { case ColorType.Day1: sb.Append(colDayColor.ToString()); break; case ColorType.Day1_Night1: sb.Append(colDayColor.ToString()); sb.Append(colNightColor.ToString()); break; case ColorType.BM_Day1_Night1: sb.Append(colDayColor[0].ToString()); sb.Append(colNightColor[0].ToString()); sb.Append(XBitmapDay.ToString()); break; case ColorType.BM_Day1_Night2: sb.Append(colDayColor[0].ToString()); sb.Append(colNightColor[0].ToString()); sb.Append(colNightColor[1].ToString()); sb.Append(XBitmapDay.ToString()); break; case ColorType.BM_Day2_Night2: sb.Append(colDayColor[0].ToString()); sb.Append(colDayColor[1].ToString()); sb.Append(colNightColor[0].ToString()); sb.Append(colNightColor[1].ToString()); sb.Append(XBitmapDay.ToString()); break; case ColorType.BM_Day2: sb.Append(colDayColor[0].ToString()); sb.Append(colDayColor[1].ToString()); sb.Append(XBitmapDay.ToString()); break; case ColorType.BM_Day2_Night1: sb.Append(colDayColor[0].ToString()); sb.Append(colDayColor[1].ToString()); sb.Append(colNightColor[0].ToString()); sb.Append(XBitmapDay.ToString()); break; case ColorType.BM_Day1: sb.Append(colDayColor[0].ToString()); sb.Append(XBitmapDay.ToString()); break; } if (WithExtendedOptions) { sb.Append(" Options=[" + FontType.ToString() + "|" + FontColType.ToString() + "]"); } if (WithString) { sb.Append(" " + Text.ToString()); } sb.Append(" ]"); return(sb.ToString()); }
public Text(float x, float y, string content, FontType fontType) : this(x, y, content, $"Morro_{fontType.ToString()}") { }