Solved

Canvas text size

Posted on 2001-08-06
3
187 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

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

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

Suggested Solutions

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

832 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