Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2011-05

TFreeTypeFont Rotated Text

19 messages · 4 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Michael Van Canneyt
to Leonardo M. Ramé
Leonardo M. Ram? wrote 5 lines
Hi, I'm writing text over an TFPImageCanvas using TFreeTypeFont, and would like to know how can I write rotated text. The "orientation" property doesn't seems to do anything using this font class.

This is not yet supported in fpImage.
I don't know whether FreeType supports rotated text.

Michael.

Reply by email

Leonardo M. Ramé
to Michael Van Canneyt
Michael Van Canneyt wrote 14 lines
On Thu, 26 May 2011, Leonardo M. Ram? wrote: >Hi, I'm writing text over an TFPImageCanvas using TFreeTypeFont, and >would like to know how can I write rotated text. > >The "orientation" property doesn't seems to do anything using this font >class. This is not yet supported in fpImage. I don't know whether FreeType supports rotated text. Michael.

Well, yes, it does. Here is an example:

http://www.freetype.org/freetype1/image/freetst2.png

Reply by email

Michael Van Canneyt
to Leonardo M. Ramé
Leonardo M. Ram? wrote 19 lines
On 2011-05-26 23:57:48 +0200, Michael Van Canneyt wrote: > > > On Thu, 26 May 2011, Leonardo M. Ram? wrote: > >> Hi, I'm writing text over an TFPImageCanvas using TFreeTypeFont, and >> would like to know how can I write rotated text. >> >> The "orientation" property doesn't seems to do anything using this font >> class. > > This is not yet supported in fpImage. I don't know whether FreeType supports > rotated text. > > Michael. Well, yes, it does. Here is an example: http://www.freetype.org/freetype1/image/freetst2.png

Ok, in that case please file a feature request in the bugtracker so I don't forget. (better yet if you could provide a patch ;) )

Michael.

Reply by email

Alexander Klenin
to Michael Van Canneyt

2011/5/27 Michael Van Canneyt :

Show quoted text 8 lines
> Well, yes, it does. Here is an example: > > http://www.freetype.org/freetype1/image/freetst2.png Ok, in that case please file a feature request in the bugtracker so I don't forget. (better yet if you could provide a patch ;) )

I am traveling now, so can't check, but if I recall correctly, nogui demo of TAChart does include rotated labels with freetype text.

Alexander S. Klenin

Reply by email

Leonardo M. Ramé
to Alexander Klenin
Alexander Klenin wrote 13 lines
2011/5/27 Michael Van Canneyt : >> Well, yes, it does. Here is an example: >> >> http://www.freetype.org/freetype1/image/freetst2.png > > Ok, in that case please file a feature request in the bugtracker so I don't > forget. > (better yet if you could provide a patch ;) ) > I am traveling now, so can't check, but if I recall correctly, nogui demo of TAChart does include rotated labels with freetype text.

Hi Alexander, I get this when I run noguidemo on Ubuntu 11.04 64bits.

[FORMS.PP] ExceptionOccurred
Sender=FreeTypeException
Exception=Error 10 while making string bitmaps step 4 Stack trace:
$000000000071FBBE
$000000000071FC4B
$000000000072189F
$0000000000722090
$000000000071F62E
$000000000071F2BE
$000000000047B3EA
$0000000000479F61
$000000000048A72A line 275 of ../../tadrawerfpcanvas.pas $000000000048C2BB line 344 of ../../tadrawutils.pas $0000000000617B6C line 634 of ../../tatypes.pas
$0000000000615348 line 666 of ../../tachartaxis.pas $0000000000614FF0 line 689 of ../../tachartaxis.pas $000000000061605C line 915 of ../../tachartaxis.pas $0000000000483753 line 1052 of ../../tagraph.pas
$0000000000481CFE line 711 of ../../tagraph.pas
$000000000042F188 line 39 of noguidemo.lpr
TApplication.HandleException Error 10 while making string bitmaps step 4 Stack trace:
$000000000071FBBE
$000000000071FC4B
$000000000072189F
$0000000000722090
$000000000071F62E
$000000000071F2BE
$000000000047B3EA
$0000000000479F61
$000000000048A72A line 275 of ../../tadrawerfpcanvas.pas $000000000048C2BB line 344 of ../../tadrawutils.pas $0000000000617B6C line 634 of ../../tatypes.pas
$0000000000615348 line 666 of ../../tachartaxis.pas $0000000000614FF0 line 689 of ../../tachartaxis.pas $000000000061605C line 915 of ../../tachartaxis.pas $0000000000483753 line 1052 of ../../tagraph.pas
$0000000000481CFE line 711 of ../../tagraph.pas
$000000000042F188 line 39 of noguidemo.lpr
exception at 000000000071FBBE:
Error 10 while making string bitmaps step 4.

Reply by email

Leonardo M. Ramé
to Mattias Gaertner
Mattias Gaertner wrote 13 lines
On Fri, 27 May 2011 18:06:25 -0400 Alexander Klenin wrote: > On Fri, May 27, 2011 at 09:09, Leonardo M. Ram? wrote: > > Alexander, I tried with DejaVuSans and got the same result. > > Too bad. I have only tested on Windows -- no idea why FreeType does not work > on other platforms. Read the fine manual: http://wiki.lazarus.freepascal.org/fcl-image#Drawing_text

FreeType works, what does not work is the rotation.

Reply by email

Mattias Gaertner
to Leonardo M. Ramé
Show quoted text 16 lines
On 2011-05-28 00:20:18 +0200, Mattias Gaertner wrote: > On Fri, 27 May 2011 18:06:25 -0400 > Alexander Klenin wrote: > > > On Fri, May 27, 2011 at 09:09, Leonardo M. Ram? wrote: > > > Alexander, I tried with DejaVuSans and got the same result. > > > > Too bad. I have only tested on Windows -- no idea why FreeType does not work > > on other platforms. > > Read the fine manual: > > http://wiki.lazarus.freepascal.org/fcl-image#Drawing_text > FreeType works, what does not work is the rotation.

Where does TAChart with FreeType call InitEngine?

Mattias

Reply by email

Michael Van Canneyt
to Leonardo M. Ramé: FreeType works, what does not work is the rotation. Leonardo M. Ram?…
Leonardo M. Ram? wrote 16 lines
On 2011-05-28 00:20:18 +0200, Mattias Gaertner wrote: > On Fri, 27 May 2011 18:06:25 -0400 > Alexander Klenin wrote: > >> On Fri, May 27, 2011 at 09:09, Leonardo M. Ram? wrote: >>> Alexander, I tried with DejaVuSans and got the same result. >> >> Too bad. I have only tested on Windows -- no idea why FreeType does not work >> on other platforms. > > Read the fine manual: > > http://wiki.lazarus.freepascal.org/fcl-image#Drawing_text > FreeType works, what does not work is the rotation.

I had a check, it should not be too hard to add the rotation. But at least 3 functions must be adapted.

Michael.

Reply by email

Alexander Klenin
to Mattias Gaertner: On Fri, 27 May 2011 21:37:21 -0300 Where does TAChart with FreeType call InitEngine?…
Mattias Gaertner wrote 21 lines
On Fri, 27 May 2011 21:37:21 -0300 Leonardo M. Ram? wrote: > On 2011-05-28 00:20:18 +0200, Mattias Gaertner wrote: > > On Fri, 27 May 2011 18:06:25 -0400 > > Alexander Klenin wrote: > > > > > On Fri, May 27, 2011 at 09:09, Leonardo M. Ram? wrote: > > > > Alexander, I tried with DejaVuSans and got the same result. > > > > > > Too bad. I have only tested on Windows -- no idea why FreeType does not work > > > on other platforms. > > > > Read the fine manual: > > > > http://wiki.lazarus.freepascal.org/fcl-image#Drawing_text > > > > FreeType works, what does not work is the rotation. Where does TAChart with FreeType call InitEngine?

The call is in in line 146 of ftfont.pp
On Windows, I verified that it is is called before other low-level freetype functions.
Maybe it is not so on other platforms -- I think
the call should then be removed from ftfont unit.

Alexander S. Klenin

Reply by email

Michael Van Canneyt
to Alexander Klenin
Alexander Klenin wrote 8 lines
2011/5/28 Michael Van Canneyt : >> FreeType works, what does not work is the rotation. > > I had a check, it should not be too hard to add the rotation. > But at least 3 functions must be adapted. It already works under Windows, so I am not sure why further modification is needed.

Probably because you are not using freetype, but LCL windows fonts.

The Free Pascal FreeType has no support for orientation, for the simple reason that the property didn't exist when freetype support was implemented.

You don't need to take my word for it, just check the sources.

Michael.

Reply by email

Alexander Klenin
to Michael Van Canneyt
Michael Van Canneyt wrote
The Free Pascal FreeType has no support for orientation, for the simple reason that the property didn't exist when freetype support was implemented. You don't need to take my word for it, just check the sources.

I have already checked them when I implemented font rotation in TAChart/FPCanvas.
See
https://github.com/graemeg/freepascal/blob/master/packages/fcl-image/src/ftfont.pp#L238 https://github.com/graemeg/lazarus/blob/upstream/components/tachart/tadrawerfpcanvas.pas#L255

Alexander S. Klenin

Reply by email

Michael Van Canneyt
to Alexander Klenin
Alexander Klenin wrote 12 lines
On Sat, May 28, 2011 at 07:57, Michael Van Canneyt wrote: > The Free Pascal FreeType has no support for orientation, for the simple > reason that the property didn't exist when freetype support was implemented. > > You don't need to take my word for it, just check the sources. I have already checked them when I implemented font rotation in TAChart/FPCanvas. See https://github.com/graemeg/freepascal/blob/master/packages/fcl-image/src/ftfont.pp#L238 https://github.com/graemeg/lazarus/blob/upstream/components/tachart/tadrawerfpcanvas.pas#L255

Ah. Well, how am I supposed to know about that ?
The Git repository is private for Graeme. Changes to it are not communicated back to FPC.

Why did you not submit a patch to FPC ?

Michael.

Reply by email

Michael Van Canneyt
to Michael Van Canneyt
Michael Van Canneyt wrote 23 lines
On Sat, 28 May 2011, Alexander Klenin wrote: > On Sat, May 28, 2011 at 07:57, Michael Van Canneyt > wrote: >> The Free Pascal FreeType has no support for orientation, for the simple >> reason that the property didn't exist when freetype support was >> implemented. >> >> You don't need to take my word for it, just check the sources. > > I have already checked them when I implemented font rotation in > TAChart/FPCanvas. > See > https://github.com/graemeg/freepascal/blob/master/packages/fcl-image/src/ftfont.pp#L238 > https://github.com/graemeg/lazarus/blob/upstream/components/tachart/tadrawerfpcanvas.pas#L255 Ah. Well, how am I supposed to know about that ? The Git repository is private for Graeme. Changes to it are not communicated back to FPC. Why did you not submit a patch to FPC ?
Forget this reply;

I understood you wrong, I thought you had implemented it and committed it in Git.

There is a property Angle there (private to FreeType font), but I was looking for Orientation (the LCL and FPCanvas property).

The Angle property should of course be translated to Orientation, to match the LCL.

My apologies for the too fast reaction :/

Michael.

Reply by email