public FRFont(FRFontTemplate FontTemplate) { Debug.Assert(FontTemplate != null); m_FontTemplate = FontTemplate; FontStyle TheStyle = FontStyle.Regular; if (m_FontTemplate.m_bBold) TheStyle |= FontStyle.Bold; if (m_FontTemplate.m_bItalic) TheStyle |= FontStyle.Italic; if (m_FontTemplate.m_bUnderLine) TheStyle |= FontStyle.Underline; try { m_Font = new Font(m_FontTemplate.m_FontName, m_FontTemplate.m_Size, TheStyle); } catch { Debug.Assert(false, "Create font failed"); } }
private int GetFontID(FRFontTemplate FontTemplate) { Debug.Assert(FontTemplate != null); for (int i = 0; i < m_FontList.Count; i++) { if (FontTemplate == m_FontList[i].m_FontTemplate) return i; } return -1; }
private void AddDefaultFont() { Debug.Assert(FontNameList.Count > 0); if (FontNameList.Count < 0) return; FRFontTemplate FontTemplate = new FRFontTemplate( FontNameList[0] , 7f, false, false, false); m_ApplicationDefaultFontID = AddFont(FontTemplate); }
private int AddFont(FRFontTemplate FontTemplate) { Debug.Assert(FontTemplate != null); FRFont NewFont = new FRFont(FontTemplate); m_FontList.Add(NewFont); return m_FontList.Count - 1; }
// The font id is the index of the FRFont in the list. public int GetFontID(string FontName, float fSize , bool bBold, bool bItalic, bool bUnderLine) { Debug.Assert(FontName.Trim().Length != 0 && fSize > 0); if (FontName.Trim().Length == 0 || fSize < 0) return -1; FRFontTemplate FontTemplate = new FRFontTemplate(FontName , fSize, bBold, bItalic, bUnderLine); int ID = GetFontID(FontTemplate); if(ID == -1) { ID = AddFont(FontTemplate); } return ID; }