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... » how get font height
Re: how get font height [message #22206 is a reply to message #22205] Wed, 24 June 2009 12:49 Go to previous messageGo to previous message
mirek is currently offline  mirek
Messages: 13976
Registered: November 2005
Ultimate Member
bonami wrote on Wed, 24 June 2009 06:04

i have a RichTextCtrl, i want it to be the height of the text on it.
RichTextCtrl rt;
...
	String str = "[3A^test^ Graphical introduction]";
	rt = str;
	typedef const unsigned short screen_size_t;
	screen_size_t linkSpace = 10;
	screen_size_t linkSize = Arial(20).Info().GetLineHeight();
	Add(rt.LeftPos(linkSpace, GetSize().cx - 2 * linkSpace).TopPos(linkSpace, linkSize));

the above code's rt fits. but i wonder how Arial(20) is related to "[3A", whose text should be of 100 dots/12 points. manual cites "points" everywhere, while it seems to mean differently.


"Points"? I hope it states "dots" Smile

1 dot is defined as pixel of 600dpi printer. This is used "real-world" measure when printing on printer. There is of course relation between dots and points, as point is defined as 1/72 inch, therefore pt = 72 * dot / 600.

Anyway, to display on screen, you need to scale down. In practice, the most convenient is to base the scale on actual default font size (otherwise the text size looks odd).

See GetRichTextStdScreenZoom which defines normal RichText->screen zooming. This is then used as default for RichTextView.

Mirek
 
Read Message icon5.gif
Read Message
Read Message
Read Message
Read Message
Read Message icon14.gif
Previous Topic: Inserting text into the current cursor position
Next Topic: Font alignment issues
Goto Forum:
  


Current Time: Sat May 11 13:48:51 CEST 2024

Total time taken to generate the page: 0.03035 seconds