Solved

Canvas text size

Posted on 2001-08-06
3
194 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Working with hours 3 85
DBGrid or StringGrid ? 6 133
scroll down TListBox component in Delphi 1 42
MS Access from Delphi 31 98
Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
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…
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …

738 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