/// ------------------------------------------------------------------------------------ /// <summary> /// Setups the font features. /// </summary> /// ------------------------------------------------------------------------------------ private void SetupFontFeatures() { if (m_fontName == null || m_fontName == "") { Enabled = false; return; } IRenderEngine renderer; if (FontHasGraphiteTables(m_fontName, false, false)) { renderer = FwGrEngineClass.Create(); } else { renderer = UniscribeEngineClass.Create(); } renderer.WritingSystemFactory = m_wsf; HoldDummyGraphics hdg = new HoldDummyGraphics(m_fontName, false, false, CreateGraphics()); renderer.InitRenderer(hdg.m_vwGraphics, m_fontFeatures); m_featureEngine = renderer as IRenderingFeatures; if (m_featureEngine == null) { Enabled = false; hdg.Close(); return; } int cfid; m_featureEngine.GetFeatureIDs(0, null, out cfid); if (cfid == 0) { Enabled = false; hdg.Close(); return; } if (cfid == 1) { // What if it's the dummy built-in graphite feature that we ignore? // Get the list of features (only 1). using (ArrayPtr idsM = MarshalEx.ArrayToNative(cfid, typeof(int))) { m_featureEngine.GetFeatureIDs(cfid, idsM, out cfid); int [] ids = (int[])MarshalEx.NativeToArray(idsM, cfid, typeof(int)); if (ids[0] == kGrLangFeature) { Enabled = false; hdg.Close(); return; } } } Enabled = true; hdg.Close(); }
/// ------------------------------------------------------------------------------------ /// <summary> /// Setups the font features. /// </summary> /// ------------------------------------------------------------------------------------ public void SetupFontFeatures() { CheckDisposed(); #if __MonoCS__ // TODO-Linux: Neither Graphite or UniscribeEngine Avaliable m_featureEngine = null; return; #else if (m_fontName == null || m_fontName == "") { Enabled = false; m_isGraphiteFont = false; return; } IRenderEngine renderer; if (FontHasGraphiteTables(m_fontName, false, false)) { renderer = FwGrEngineClass.Create(); m_isGraphiteFont = true; } else { renderer = UniscribeEngineClass.Create(); m_isGraphiteFont = false; } renderer.WritingSystemFactory = m_wsf; using (HoldDummyGraphics hdg = new HoldDummyGraphics(m_fontName, false, false, this)) { renderer.InitRenderer(hdg.m_vwGraphics, m_fontFeatures); m_featureEngine = renderer as IRenderingFeatures; if (m_featureEngine == null) { Enabled = false; return; } int cfid; m_featureEngine.GetFeatureIDs(0, null, out cfid); if (cfid == 0) { Enabled = false; return; } if (cfid == 1) { // What if it's the dummy built-in graphite feature that we ignore? // Get the list of features (only 1). using (ArrayPtr idsM = MarshalEx.ArrayToNative <int>(cfid)) { m_featureEngine.GetFeatureIDs(cfid, idsM, out cfid); int [] ids = MarshalEx.NativeToArray <int>(idsM, cfid); if (ids[0] == kGrLangFeature) { Enabled = false; return; } } } Enabled = true; } #endif }