Solved

Canvas text size

Posted on 2001-08-06
3
183 Views
Last Modified: 2010-04-06
I want to print a number on form canvas. The number is inside a box.

In a procedure I wrote

Var  Rect : TRect;
begin
  Rect := ...
  canvas.font.height := rect.bottom -rect.top - 5;
  textrect(rect.left, rect.top, inttostr(Num));
end;

I found the size of the number was changed with the rect's size, but it's smallest size is about 6,how can I let it smaller?

PeterShaw
0
Comment
Question by:petershaw8
  • 2
3 Comments
 
LVL 2

Expert Comment

by:bugroger
ID: 6355261
Hi,
 I think you don 't use a TrueType - Font.

Try to set the font to a TrueType Font:

Var  Rect : TRect;
begin
 Rect := ...
 Canvas.Font.Name := 'MS Song'; <-- Set Font to TT - Font
 canvas.font.height := rect.bottom -rect.top - 5;
 textrect(rect.left, rect.top, inttostr(Num));
end;

Now the smallest size should be 1 !!!

GL
 Bug





0
 

Author Comment

by:petershaw8
ID: 6376255
Hi,
Iam using the default font, that is MS Sans Serif. Is it a TT font?

Thankuvery much.

PeterShaw
0
 
LVL 2

Accepted Solution

by:
bugroger earned 100 total points
ID: 6377925
Hi,

The MS Sans Serif is not a TrueType Font.

If you want to know if a Font is a TrueType Font
you can look at the FontDialog.
Just klick on [...] at the "FONT" Property of any
component which used this property.
If a TT-Glyph will be display on the left side of the
FontName (in the ListBox) then it is a TrueType Font.


GL
 Bug









0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …
A simple description of email encryption using a secure portal service. This is one of the choices offered by The Email Laundry for email encryption. The other choices are pdf encryption which creates an encrypted pdf of your email and any attachmen…

911 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now