/// <summary> /// Creates a new instace of FreeTypeFont /// </summary> /// <param name="fontData">Contents of the font file</param> /// <param name="size">Size of the font</param> /// <param name="style">Style of the font</param> /// <param name="superSampleLevels">Super sample levels</param> /// <param name="scale">Scale</param> /// <exception cref="ArgumentException"></exception> public FreeTypeFont(byte[] fontData, float size, FontStyle style, int superSampleLevels = 1, float scale = 1.0f) { StyleFlags fontStyle = StyleFlags.None; switch (style) { case FontStyle.Bold: fontStyle = StyleFlags.Bold; break; case FontStyle.Italic: fontStyle = StyleFlags.Italic; break; case FontStyle.Regular: fontStyle = StyleFlags.None; break; default: Debug.WriteLine("Invalid style flag chosen for FreeTypeFont: " + style); break; } LoadFontFace(fontData, size, fontStyle, superSampleLevels, scale); }
/// <summary> /// Creates a new instace of FreeTypeFont /// </summary> /// <param name="fontPath">The path to the font file</param> /// <param name="size">Size of the font</param> /// <param name="style">Style of the font</param> /// <param name="superSampleLevels">Super sample levels</param> /// <param name="scale">Scale</param> /// <exception cref="ArgumentException"></exception> public FreeTypeFont(string fontPath, float size, FontStyle style, int superSampleLevels = 1, float scale = 1.0f) { // Check that the font exists if (!File.Exists(fontPath)) { throw new ArgumentException("The specified font path does not exist", nameof(fontPath)); } StyleFlags fontStyle = StyleFlags.None; switch (style) { case FontStyle.Bold: fontStyle = StyleFlags.Bold; break; case FontStyle.Italic: fontStyle = StyleFlags.Italic; break; case FontStyle.Regular: fontStyle = StyleFlags.None; break; default: Debug.WriteLine("Invalid style flag chosen for FreeTypeFont: " + style); break; } LoadFontFace(fontPath, size, fontStyle, superSampleLevels, scale); }
protected void Construct() { if (false == bInitialized) { // initialize the cursor array Cursors[0] = System.Windows.Forms.Cursors.SizeNWSE; Cursors[1] = System.Windows.Forms.Cursors.SizeNESW; Cursors[2] = Cursors[0]; Cursors[3] = Cursors[1]; Cursors[4] = System.Windows.Forms.Cursors.SizeNS; Cursors[5] = System.Windows.Forms.Cursors.SizeWE; Cursors[6] = Cursors[4]; Cursors[7] = Cursors[5]; Cursors[8] = System.Windows.Forms.Cursors.SizeAll; Cursors[9] = System.Windows.Forms.Cursors.PanSW; bInitialized = true; BlackDottedPen = new Pen(System.Drawing.Color.Black, 1); HatchBrush = new HatchBrush(HatchStyle.Percent20, Color.Black, Color.FromArgb(0)); DotedPen = new Pen(Color.Black, 1); DotedPen.DashStyle = DashStyle.Dot; } m_nStyle = 0; m_nHandleSize = HandleSize; m_sizeMin.Height = m_sizeMin.Width = m_nHandleSize * 2; m_rectLast = new Rectangle(0, 0, 0, 0); m_sizeLast.Width = m_sizeLast.Height = 0; m_bErase = false; m_bFinalErase = false; }
private void LoadFontFace(byte[] fontData, float size, StyleFlags fontStyle, int superSampleLevels, float scale) { // Get total number of faces in a font file var tempFace = _fontLibrary.NewMemoryFace(fontData, -1); int numberOfFaces = tempFace.FaceCount; // Dispose of the temporary face tempFace.Dispose(); tempFace = null; // Loop through to find the style we want for (int i = 0; i < numberOfFaces; i++) { tempFace = _fontLibrary.NewMemoryFace(fontData, i); // If we've found the style, exit loop if (tempFace.StyleFlags == fontStyle) { break; } // Dispose temp face and keep searching tempFace.Dispose(); tempFace = null; } // Use default font face if correct style not found if (tempFace == null) { Debug.WriteLine("Could not find correct face style in font: " + fontStyle); tempFace = _fontLibrary.NewMemoryFace(fontData, 0); } // Set the face for this instance _fontFace = tempFace; // Set the size Size = size * scale * superSampleLevels; _fontFace.SetCharSize(0, Size, 0, DPI); }
/// <summary> /// Creates a <see cref="FormatItem"/> to represent the display name of an <see cref="AssemblyData"/> with the specified formatting. /// </summary> public static FormatItem AssemblyName(AssemblyData assembly, StyleFlags style = StyleFlags.Normal) { return(new FormatItem(assembly.DisplayName, style)); }
private FormatItem(string text, StyleFlags style) { this.Style = style; this.Text = text; }
/// <summary> /// Creates a <see cref="FormatItem"/> to represent the type name of a typed item with the specified formatting. /// </summary> public static FormatItem TypedItemTypeName(ITypedItem item, StyleFlags style = StyleFlags.Normal) { return(new FormatItem(GetTypeDisplayName(item), style)); }
/// <summary> /// Creates a <see cref="FormatItem"/> to represent the full name of a typed item with the specified formatting. /// </summary> public static FormatItem TypedItemName(ITypedItem item, StyleFlags style = StyleFlags.Normal) { return(new FormatItem(GetFullMemberName((MemberDataBase)item), style)); }
public RectTracker(Rectangle rect, StyleFlags nStyle) { Construct(); m_rect = rect; m_nStyle = nStyle; }
/// <summary> /// Creates a <see cref="FormatItem"/> to represent the full name of a <see cref="MemberDataBase"/> with the specified formatting. /// </summary> public static FormatItem MemberName(MemberDataBase member, StyleFlags style = StyleFlags.Normal) { return(new FormatItem(GetFullMemberName(member), style)); }
public RectTracker() { Construct(); m_nHandleSize = 6; m_nStyle = StyleFlags.resizeOutside; }
protected void Construct() { if(false==bInitialized) { // initialize the cursor array Cursors[0] = System.Windows.Forms.Cursors.SizeNWSE; Cursors[1] = System.Windows.Forms.Cursors.SizeNESW; Cursors[2] = Cursors[0]; Cursors[3] = Cursors[1]; Cursors[4] = System.Windows.Forms.Cursors.SizeNS; Cursors[5] = System.Windows.Forms.Cursors.SizeWE; Cursors[6] = Cursors[4]; Cursors[7] = Cursors[5]; Cursors[8] = System.Windows.Forms.Cursors.SizeAll; Cursors[9] = System.Windows.Forms.Cursors.PanSW; bInitialized = true; BlackDottedPen=new Pen(System.Drawing.Color.Black,1); HatchBrush=new HatchBrush(HatchStyle.Percent20,Color.Black,Color.FromArgb(0)); DotedPen=new Pen(Color.Black,1); DotedPen.DashStyle=DashStyle.Dot; } m_nStyle = 0; m_nHandleSize = HandleSize; m_sizeMin.Height = m_sizeMin.Width = m_nHandleSize*2; m_rectLast=new Rectangle(0,0,0,0); m_sizeLast.Width = m_sizeLast.Height = 0; m_bErase = false; m_bFinalErase = false; }
/// <summary> /// Creates a <see cref="FormatItem"/> to represent the full name of an entity with parameters with the specified formatting. /// </summary> public static FormatItem ParameterizedItemName(IParameterizedItem item, StyleFlags style = StyleFlags.Normal) => new FormatItem(GetFullMemberName((MemberDataBase)item), style);
private FormatItem(string text, StyleFlags style) { Style = style; Text = text; }
/// <summary> /// Creates a <see cref="FormatItem"/> to represent the default value of a <see cref="ParameterData"/> with the specified formatting. /// </summary> public static FormatItem DefaultParameterValue(ParameterData parameter, StyleFlags style = StyleFlags.Normal) { return(new FormatItem(parameter.GetDefaultValueDisplayText(), style)); }
/// <summary> /// Creates a <see cref="FormatItem"/> to represent the C# name of a <see cref="MemberDataBase"/> with the specified formatting. /// </summary> public static FormatItem MemberKind(MemberDataBase member, StyleFlags style = StyleFlags.Normal) { return(new FormatItem(GetItemDescription(member), style)); }
public RectTracker(Rectangle rect, StyleFlags nStyle) { Construct(); m_rect=rect; m_nStyle = nStyle; }
/// <summary> /// Creates a <see cref="FormatItem"/> to represent the name of a <see cref="ParameterData"/> with the specified formatting. /// </summary> public static FormatItem ParameterName(ParameterData parameter, StyleFlags style = StyleFlags.Normal) { return(new FormatItem(parameter.DisplayName, style)); }
/// <summary> /// Creates a <see cref="FormatItem"/> to represent the C# name of a typed item with the specified formatting. /// </summary> public static FormatItem TypedItemKind(ITypedItem item, StyleFlags style = StyleFlags.Normal) { return(new FormatItem(GetItemDescription((MetadataItemBase)item), style)); }
/// <summary> /// Creates a new instance of a SetTextStyle instruction. /// </summary> public SetTextStyle(StyleFlags styleFlags) : base("set_text_style", 0x11, OpcodeTypeKind.Var, new ZOperand((byte)styleFlags)) { }