private string GetNormalStyleFontSize(int ws) { ILgWritingSystemFactory wsf = Cache.LanguageWritingSystemFactoryAccessor; Font myFont = FontHeightAdjuster.GetFontForNormalStyle(ws, m_mediator, wsf); return(myFont.Size.ToString() + "pt"); }
/// <summary> /// Creates a ListViewItem for the given ICmObject /// </summary> /// <param name="semDom">A Semantic Domain</param> /// <param name="stylesheet"></param> /// <param name="createChecked"></param> /// <param name="displayUsage"></param> /// <returns></returns> public static ListViewItem CreateLabelListItem(ICmObject semDom, IVwStylesheet stylesheet, bool createChecked, bool displayUsage) { var semanticDomainItem = semDom as ICmSemanticDomain; if (semanticDomainItem == null) { return(new ListViewItem(DetailControlsStrings.ksSemanticDomainInvalid)); } var strbldr = new StringBuilder(semanticDomainItem.AbbrAndName); if (semanticDomainItem.OwningPossibility != null) { var parentName = semanticDomainItem.OwningPossibility.Name.BestAnalysisAlternative.Text; strbldr.AppendFormat(" [{0}]", parentName); } if (displayUsage) { var count = SenseReferenceCount(semanticDomainItem); if (count > 0) { strbldr.AppendFormat(" ({0})", count); } } var item = new ListViewItem(strbldr.ToString()) { Checked = createChecked, Tag = semanticDomainItem.Hvo }; var cache = semDom.Cache; item.Font = FontHeightAdjuster.GetFontForNormalStyle(cache.DefaultAnalWs, stylesheet, cache); return(item); }
private string GetNormalStyleFontSize(int ws) { ILgWritingSystemFactory wsf = Cache.WritingSystemFactory; using (Font myFont = FontHeightAdjuster.GetFontForNormalStyle(ws, m_mediator, wsf)) return(myFont.Size + "pt"); }
/// <summary> /// Set up the dlg in preparation to showing it. /// </summary> /// <param name="cache">FDO cache.</param> /// <param name="mediator"></param> /// <param name="entry">LexEntry</param> public void SetDlgInfo(FdoCache cache, Mediator mediator, ILexEntry entry) { CheckDisposed(); Debug.Assert(cache != null); m_mediator = mediator; m_cache = cache; m_entry = entry; m_tsf = m_cache.TsStrFactory; m_fwTextBoxBottomMsg.WritingSystemFactory = m_cache.WritingSystemFactory; //m_fwTextBoxBottomMsg.WritingSystemCode = 1; // What!? Why? No longer makes ANY sense! IVwStylesheet stylesheet = FontHeightAdjuster.StyleSheetFromMediator(mediator); // We want to do this BEFORE the text gets set, to avoid overriding its height properties. // However, because of putting multiple lines in the box, we also need to do it AFTER we set the text // (in SetBottomMessage) so it adjusts to the resulting even greater height. m_fwTextBoxBottomMsg.AdjustForStyleSheet(this, null, stylesheet); Font f = FontHeightAdjuster.GetFontForNormalStyle( m_cache.ServiceLocator.WritingSystems.DefaultVernacularWritingSystem.Handle, stylesheet, m_cache.LanguageWritingSystemFactoryAccessor); foreach (IMoForm allo in entry.AlternateFormsOS) { ListViewItem lvi = m_lvAlloOptions.Items.Add(allo.Form.VernacularDefaultWritingSystem.Text); lvi.Tag = allo; lvi.UseItemStyleForSubItems = true; lvi.Font = f; } m_lvAlloOptions.Font = f; // Get location to the stored values, if any. object locWnd = m_mediator.PropertyTable.GetValue("swapDlgLocation"); // And when I do this, it works the first time, but later times the window is // too small and doesn't show all the controls. Give up on smart location for now. //object szWnd = this.Size; object szWnd = null; // suppresses the smart location stuff. //if (locWnd != null && szWnd != null) //{ // Rectangle rect = new Rectangle((Point)locWnd, (Size)szWnd); // ScreenUtils.EnsureVisibleRect(ref rect); // DesktopBounds = rect; // StartPosition = FormStartPosition.Manual; //} m_lvAlloOptions.Items[0].Selected = true; Text = LexEdStrings.ksSwapLexWithAllo; label2.Text = LexEdStrings.ksAlternateForms; // Determine the help file to use, if any m_helpTopic = "khtpSwapLexemeWithAllomorph"; if (m_mediator.HelpTopicProvider != null) { helpProvider = new HelpProvider(); helpProvider.HelpNamespace = m_mediator.HelpTopicProvider.HelpFile; helpProvider.SetHelpKeyword(this, m_mediator.HelpTopicProvider.GetHelpString(m_helpTopic)); helpProvider.SetHelpNavigator(this, HelpNavigator.Topic); } }
private static Font GetVernacularFont(ILgWritingSystemFactory wsf, int wsVern, IVwStylesheet stylesheet) { if (stylesheet == null) { ILgWritingSystem wsEngine = wsf.get_EngineOrNull(wsVern); string fontName = wsEngine.DefaultFontName; return(new Font(fontName, (float)10.0)); } else { return(FontHeightAdjuster.GetFontForNormalStyle(wsVern, stylesheet, wsf)); } }
protected string TransformToHtml(XPathDocument doc, TransformKind kind) { string sOutput = null; XslCompiledTransform transformer = new XslCompiledTransform(); XsltArgumentList args = new XsltArgumentList(); switch (kind) { case TransformKind.kcptParse: sOutput = CreateTempFile(m_sParse, "htm"); transformer.Load(Path.Combine(TransformPath, m_sFormatParse)); break; case TransformKind.kcptTrace: sOutput = CreateTempFile(m_sTrace, "htm"); transformer.Load(Path.Combine(TransformPath, m_sFormatTrace)); string sIconPath = CreateIconPath(); args.AddParam("prmIconPath", "", sIconPath); break; case TransformKind.kcptWordGrammarDebugger: string sDepthLevel = m_XmlHtmlStack.Count.ToString(); sOutput = CreateTempFile(CreateWordGrammarDebuggerFileName(), "htm"); transformer.Load(Path.Combine(TransformPath, "FormatXAmpleWordGrammarDebuggerResult.xsl")); break; } TextWriter writer = File.CreateText(sOutput); ILgWritingSystemFactory wsf = m_cache.LanguageWritingSystemFactoryAccessor; Font myFont = FontHeightAdjuster.GetFontForNormalStyle(m_cache.LangProject.DefaultAnalysisWritingSystem, m_mediator, wsf); args.AddParam("prmAnalysisFont", "", myFont.FontFamily.Name); args.AddParam("prmAnalysisFontSize", "", myFont.Size.ToString() + "pt"); int vernWs = m_cache.LangProject.DefaultVernacularWritingSystem; myFont = FontHeightAdjuster.GetFontForNormalStyle(vernWs, m_mediator, wsf); args.AddParam("prmVernacularFont", "", myFont.FontFamily.Name); args.AddParam("prmVernacularFontSize", "", myFont.Size.ToString() + "pt"); string sRTL = "N"; IWritingSystem wsObj = wsf.get_EngineOrNull(vernWs); if (wsObj != null && wsObj.RightToLeft) { sRTL = "Y"; } args.AddParam("prmVernacularRTL", "", sRTL); transformer.Transform(doc, args, writer); writer.Close(); return(sOutput); }
public void Initialize(IEnumerable <ObjectLabel> labels, IEnumerable <ICmObject> selectedItems) { m_semdomRepo = Cache.ServiceLocator.GetInstance <ICmSemanticDomainRepository>(); m_stylesheet = FontHeightAdjuster.StyleSheetFromMediator(Mediator); selectedDomainsList.Font = FontHeightAdjuster.GetFontForNormalStyle( Cache.DefaultAnalWs, m_stylesheet, Cache); m_selectedItems.UnionWith(selectedItems); UpdateDomainTreeAndListLabels(labels); searchTextBox.WritingSystemFactory = Cache.LanguageWritingSystemFactoryAccessor; searchTextBox.AdjustForStyleSheet(m_stylesheet); m_SearchTimer = new SearchTimer(this, 500, SearchSemanticDomains, new List <Control> { domainTree, domainList }); searchTextBox.TextChanged += OnSearchTextChanged; }
private void SetWritingSystemBasedArguments(LcmCache cache, PropertyTable propertyTable, XsltArgumentList argumentList) { ILgWritingSystemFactory wsf = cache.WritingSystemFactory; IWritingSystemContainer wsContainer = cache.ServiceLocator.WritingSystems; CoreWritingSystemDefinition defAnalWs = wsContainer.DefaultAnalysisWritingSystem; using (var myFont = FontHeightAdjuster.GetFontForNormalStyle(defAnalWs.Handle, wsf, propertyTable)) { argumentList.AddParam("prmAnalysisFont", "", myFont.FontFamily.Name); argumentList.AddParam("prmAnalysisFontSize", "", myFont.Size + "pt"); } CoreWritingSystemDefinition defVernWs = wsContainer.DefaultVernacularWritingSystem; using (var myFont = FontHeightAdjuster.GetFontForNormalStyle(defVernWs.Handle, wsf, propertyTable)) { argumentList.AddParam("prmVernacularFont", "", myFont.FontFamily.Name); argumentList.AddParam("prmVernacularFontSize", "", myFont.Size + "pt"); } string sRtl = defVernWs.RightToLeftScript ? "Y" : "N"; argumentList.AddParam("prmVernacularRTL", "", sRtl); }
private void SetWritingSystemBasedArguments(List <XmlUtils.XSLParameter> args) { ILgWritingSystemFactory wsf = m_cache.WritingSystemFactory; IWritingSystemContainer wsContainer = m_cache.ServiceLocator.WritingSystems; IWritingSystem defAnalWs = wsContainer.DefaultAnalysisWritingSystem; using (var myFont = FontHeightAdjuster.GetFontForNormalStyle(defAnalWs.Handle, m_mediator, wsf)) { args.Add(new XmlUtils.XSLParameter("prmAnalysisFont", myFont.FontFamily.Name)); args.Add(new XmlUtils.XSLParameter("prmAnalysisFontSize", myFont.Size + "pt")); } IWritingSystem defVernWs = wsContainer.DefaultVernacularWritingSystem; using (var myFont = FontHeightAdjuster.GetFontForNormalStyle(defVernWs.Handle, m_mediator, wsf)) { args.Add(new XmlUtils.XSLParameter("prmVernacularFont", myFont.FontFamily.Name)); args.Add(new XmlUtils.XSLParameter("prmVernacularFontSize", myFont.Size + "pt")); } string sRTL = defVernWs.RightToLeftScript ? "Y" : "N"; args.Add(new XmlUtils.XSLParameter("prmVernacularRTL", sRTL)); }
private static Font GetFontForFormFromObjectLabels(IEnumerable <ObjectLabel> labelList, IVwStylesheet stylesheet) { var cache = labelList.First().Object.Cache; return(FontHeightAdjuster.GetFontForNormalStyle(cache.DefaultAnalWs, stylesheet, cache)); }