public static XGlyphTypeface GetOrCreateFromGdi(GdiFont gdiFont) { // $TODO THHO Lock??? string typefaceKey = ComputeKey(gdiFont); XGlyphTypeface glyphTypeface; if (GlyphTypefaceCache.TryGetGlyphTypeface(typefaceKey, out glyphTypeface)) { // We have the glyph typeface already in cache. return(glyphTypeface); } XFontFamily fontFamily = XFontFamily.GetOrCreateFromGdi(gdiFont); XFontSource fontSource = XFontSource.GetOrCreateFromGdi(typefaceKey, gdiFont); // Check if styles must be simulated. XStyleSimulations styleSimulations = XStyleSimulations.None; if (gdiFont.Bold && !fontSource.Fontface.os2.IsBold) { styleSimulations |= XStyleSimulations.BoldSimulation; } if (gdiFont.Italic && !fontSource.Fontface.os2.IsItalic) { styleSimulations |= XStyleSimulations.ItalicSimulation; } glyphTypeface = new XGlyphTypeface(typefaceKey, fontFamily, fontSource, styleSimulations, gdiFont); GlyphTypefaceCache.AddGlyphTypeface(glyphTypeface); return(glyphTypeface); }
internal XFont(string familyName, double emSize, XFontStyle style, XPdfFontOptions pdfOptions, XStyleSimulations styleSimulations) { _familyName = familyName; _emSize = emSize; _style = style; _pdfOptions = pdfOptions; OverrideStyleSimulations = true; StyleSimulations = styleSimulations; Initialize(); }
const string KeyPrefix = "tk:"; // "typeface key" XGlyphTypeface(string key, XFontFamily fontFamily, XFontSource fontSource, XStyleSimulations styleSimulations) { _key = key; _fontFamily = fontFamily; _fontSource = fontSource; _fontface = OpenTypeFontface.CetOrCreateFrom(fontSource); Debug.Assert(ReferenceEquals(_fontSource.Fontface, _fontface)); _styleSimulations = styleSimulations; Initialize(); }
const string KeyPrefix = "tk:"; // "typeface key" #if CORE || GDI XGlyphTypeface(string key, XFontFamily fontFamily, XFontSource fontSource, XStyleSimulations styleSimulations, GdiFont gdiFont) { Key = key; FontFamily = fontFamily; FontSource = fontSource; Fontface = OpenTypeFontface.CetOrCreateFrom(fontSource); Debug.Assert(ReferenceEquals(FontSource.Fontface, Fontface)); GdiFont = gdiFont; StyleSimulations = styleSimulations; Initialize(); }
const string KeyPrefix = "tk:"; // "typeface key" #if CORE || GDI XGlyphTypeface(string key, XFontFamily fontFamily, XFontSource fontSource, XStyleSimulations styleSimulations #if !WITHOUT_DRAWING , GdiFont gdiFont #endif ) { _key = key; _fontFamily = fontFamily; _fontSource = fontSource; _fontface = OpenTypeFontface.CetOrCreateFrom(fontSource); Debug.Assert(ReferenceEquals(_fontSource.Fontface, _fontface)); #if !WITHOUT_DRAWING _gdiFont = gdiFont; #endif _styleSimulations = styleSimulations; Initialize(); }
/// <summary> /// Creates font and enforces bold/italic simulation. /// </summary> public static XFont CreateSpecialFont(string familyName, double emSize, XFontStyle style, XPdfFontOptions pdfOptions, XStyleSimulations styleSimulations) { return new XFont(familyName, emSize, style, pdfOptions, styleSimulations); }
public FontResolvingOptions(XFontStyle fontStyle, XStyleSimulations styleSimulations) { FontStyle = fontStyle; OverrideStyleSimulations = true; StyleSimulations = styleSimulations; }
/// <summary> /// Creates font and enforces bold/italic simulation. /// </summary> public static XFont CreateSpecialFont(string familyName, double emSize, XFontStyle style, XPdfFontOptions pdfOptions, XStyleSimulations styleSimulations) { return(new XFont(familyName, emSize, style, pdfOptions, styleSimulations)); }
/// <summary> /// Initializes a new instance of the <see cref="FontResolverInfo" /> struct. /// </summary> /// <param name="faceName">The name that uniquely identifies the fontface.</param> /// <param name="styleSimulations">The style simulation flags.</param> public FontResolverInfo(string faceName, XStyleSimulations styleSimulations) : this(faceName, (styleSimulations & XStyleSimulations.BoldSimulation) == XStyleSimulations.BoldSimulation, (styleSimulations & XStyleSimulations.ItalicSimulation) == XStyleSimulations.ItalicSimulation, 0) { }