trichview.support
Re: A question on the Editor demo |
Author |
Message |
Sergey Tkachenko |
Posted: 03/20/2003 23:19:46 Hi, This demo gets current font from the editor, in OnCurTextStyleChange event. procedure TForm1.rveCurTextStyleChanged(Sender: TObject); var fi: TFontInfo; begin ... fi := rvs.TextStyles[rve.CurTextStyleNo]; cmbFont.ItemIndex := cmbFont.Items.IndexOf(fi.FontName); cmbFontSize.Text := IntToStr(fi.Size); ... end; For simplification, cmbFontSize is filled with a set of predefined values: 8 9 10 11 12 14 16 18 20 22 24 26 28 36 48 72. This is ok for TrueType fonts (and most of Windows fonts are TrueType) which can be of any size. But for fixed-size fonts, only some font sizes produce a nice text (otherwise font will be stretched). You can find special FontName, FontSize, and FontCharset combo-boxes in RichViewActions: http://www.trichview.com/resources/actions/ There is a demo how to use them. But you can use these combo-boxes even without actions. > > Hi, > I tried out the Editor demo. I cannot understand how you parse the Windows > default font size and Font Name to the appropriate FontName Combobox and > fontsize combobox. > > At start up: > procedure TForm1.FormCreate(Sender: TObject); > begin > // Filling font names combobox > cmbFont.Items.Assign(Screen.Fonts); > New; > end; > ============================================= > After the above codes filled the combo items with screen fonts, how do you > get the default windows font and put it as the combo.text? And how do you > get the default font size? > > I have read through the demo but really cannot find the codes that do the > text filling of default font and default font size. > > Thanks for your time. > |
Powered by ABC Amber Outlook Express Converter