I want to display a multiline text with certain font size. How to determine the font size in windows? How to convert it into point size?
I want to print next line very close to the first line ., means the gap should be minimum.
I have x, y co ordinates of the first string.

Recommended Answers

All 4 Replies

I want to display a multiline text with certain font size. How to determine the font size in windows? How to convert it into point size?

If we talking about pascal then you have to read about Graph Unit.....'Cause the answer is there....

{
-=GetTextSettings (procedure)     (Graph unit)=-
Gets settings for text output in graphics
mode.
Declaration:
procedure GetTextSettings(var TextInfo: TextSettingsType);
Target:
Real, Protected
Remarks:
Returns the current text font, direction,
size, and justification as set by SetTextStyle
and SetTextJustify.

 See Also:
 InitGraph
 SetTextJustify
 SetTextStyle
 TextHeight
 TextWidth

 Sample Code:
}
 {Gettxtst.PAS}

 {Sample code for the GetTextSettings procedure.}

 uses Graph;

 var
  Gd, Gm: Integer;
  OldStyle: TextSettingsType;
 begin
  Gd := Detect;
  InitGraph(Gd, Gm, ' ');
  if GraphResult <> grOk then
    Halt(1);
  GetTextSettings(OldStyle);
  OutTextXY(0, 0, 'Old text style');
  SetTextJustify(LeftText, CenterText);
  SetTextStyle(TriplexFont, VertDir, 4);
  OutTextXY(GetMaxX div 2, GetMaxY div 2, 'New Style');
  with OldStyle do
  begin                 { Restore old text style }
    SetTextJustify(Horiz, Vert);
    SetTextStyle(Font, Direction, CharSize);
  end;
  OutTextXY(0, TextHeight('H'), 'Old style again');
  Readln;

Just reference from turbo pascal 7.0's help :yawn:

I could not find a unit called Graph. And these methods are not part of Delphi 7.0. I think.

In Delphi the font height in included as a property of TFont.

H := -Font.Height;

And is related to the font size (points) and the ppi of your screen. Check Delphi Help's info on TFont.

Unless I missed something. This seems to be a basic concept. No offense.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.