Skip to content

Latest commit

 

History

History
41 lines (22 loc) · 1.17 KB

CppGetFontHeight.md

File metadata and controls

41 lines (22 loc) · 1.17 KB

 

 

 

 

 

 

Function to get the height of a Font in pixels.

The member function Font::Size and std::abs on Font::Height don't work perfectly.

Use Canvas::TextHeight on a random string instead.

 


//From http://www.richelbilderbeek.nl/CppGetFontHeight.htm const int GetFontHeight(const TImage * const image) {   // const_cast necessary as the VCL is not const-correct. Grumble, grumble...   return const_cast<TImage*>(image)->Canvas->TextHeight("x"); }