Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » RichText,QTF,RTF... » Need help with setting RichEdit fonts in droplist [SOLVED]
Need help with setting RichEdit fonts in droplist [SOLVED] [message #41995] Mon, 10 February 2014 09:53 Go to next message
slashupp is currently offline  slashupp
Messages: 231
Registered: July 2009
Experienced Member
using upp svn6883 on debian

When RE starts the fontfaces droplist contains only serif, sans-serif and monospace.

I want to be have it filled with the fonts available on my system,
and then be able to specify a default font, say Times roman instead of sans-serif.

(I've tested with a copy of RE by changing the source I can have my
system fonts shown (using a custom Display()) but cannot set the default font to one of my choosing.)

With the standard RE is there a way in which I can achieve both these?

thx

[Updated on: Mon, 17 February 2014 09:30]

Report message to a moderator

Re: Need help with setting RichEdit fonts in droplist [message #42033 is a reply to message #41995] Wed, 12 February 2014 18:40 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
Yes.

	Vector<int> ff;
	ff.Add(Font::ARIAL);
	ff.Add(Font::ROMAN);
	ff.Add(Font::COURIER);
	if(allfonts)
		for(int i = Font::COURIER + 1; i < Font::GetFaceCount(); i++)
			if(Font::GetFaceInfo(i) & Font::SCALEABLE)
				ff.Add(i);
	editor.FontFaces(ff);


the use ApplyFormatInfo to set initial font.
Re: Need help with setting RichEdit fonts in droplist [message #42079 is a reply to message #42033] Mon, 17 February 2014 09:29 Go to previous message
slashupp is currently offline  slashupp
Messages: 231
Registered: July 2009
Experienced Member
Thx mirek

filling the droplist works correctlu, thanks.

But to set the default selected font:
Quote:

the use ApplyFormatInfo to set initial font.

does not work.

This works:
RichText::FormatInfo FI=myRE.GetFormatInfo();
//FI.SetDefaultFont(Font(deffont,11)); <--- doesn't! (deffont was set when droplist was filled)
FI.FaceName("Times New Roman");
FI.Height(myRE.PtToDot(11)); //must use PtToDot here
myRE.ApplyFormatInfo(FI);
Previous Topic: Allow line-break after '-' sign within a word?
Next Topic: [BUG] RichTextView and VCenter
Goto Forum:
  


Current Time: Thu Mar 28 19:21:30 CET 2024

Total time taken to generate the page: 0.01132 seconds