private static void AddCharSet(string fontName) { if (fontName == null) { return; } lock (m_charSetLookupLock) { if (m_charSetLookup.ContainsKey(fontName)) { return; } Font font = null; try { bool bold = false; bool italic = false; font = FontCache.CreateGdiPlusFont(fontName, 400f, ref bold, ref italic, lineThrough: false, underLine: false); LOGFONT lOGFONT = new LOGFONT(); font.ToLogFont(lOGFONT); m_charSetLookup.Add(fontName, (CharSet)lOGFONT.lfCharSet); } finally { if (font != null) { font.Dispose(); font = null; } } } }
public void CreateGDIFont(string family, ReportSize size, FontStyles style, FontWeights weight, TextDecorations decoration) { double num = 12.0; bool flag = this.IsBold(weight); bool flag2 = style == FontStyles.Italic; if (size != null) { num = size.ToPoints(); } string fontFamilyName = "Arial"; if (family != null) { fontFamilyName = family; } bool lineThrough = false; bool underLine = false; switch (decoration) { case TextDecorations.Underline: underLine = true; break; case TextDecorations.LineThrough: lineThrough = true; break; } this.m_gdiFont = FontCache.CreateGdiPlusFont(fontFamilyName, (float)num, ref flag, ref flag2, lineThrough, underLine); }
private static void AddCharSet(string fontName) { if (fontName != null) { lock (StyleProperties.m_charSetLookupLock) { if (!StyleProperties.m_charSetLookup.ContainsKey(fontName)) { Font font = null; try { bool flag = false; bool flag2 = false; font = FontCache.CreateGdiPlusFont(fontName, 400f, ref flag, ref flag2, false, false); LOGFONT lOGFONT = new LOGFONT(); font.ToLogFont(lOGFONT); StyleProperties.m_charSetLookup.Add(fontName, (CharSet)lOGFONT.lfCharSet); } finally { if (font != null) { font.Dispose(); font = null; } } } } } }
public static GDIFont GetOrCreateFont(Dictionary <string, GDIFont> gdiFonts, string fontFamily, float fontSize, RPLFormat.FontWeights fontWeight, RPLFormat.FontStyles fontStyle, RPLFormat.TextDecorations textDecoration) { string key = GDIFont.GetKey(fontFamily, fontSize, fontWeight, fontStyle, textDecoration); GDIFont gDIFont = default(GDIFont); if (gdiFonts.TryGetValue(key, out gDIFont)) { return(gDIFont); } bool flag = SharedRenderer.IsWeightBold(fontWeight); bool flag2 = fontStyle == RPLFormat.FontStyles.Italic; bool underLine = false; bool lineThrough = false; switch (textDecoration) { case RPLFormat.TextDecorations.Underline: underLine = true; break; case RPLFormat.TextDecorations.LineThrough: lineThrough = true; break; } Font font = null; try { font = FontCache.CreateGdiPlusFont(fontFamily, fontSize, ref flag, ref flag2, lineThrough, underLine); gDIFont = new GDIFont(key, font, fontSize); gdiFonts.Add(key, gDIFont); return(gDIFont); } catch { if (font != null && !gdiFonts.ContainsKey(key)) { font.Dispose(); font = null; } throw; } }