Discussions related to Visual Prolog
Steve Lympany
VIP Member
Posts: 56
Joined: 31 Mar 2001 23:01

Rotated text?

Unread post by Steve Lympany »

Hello,
How can text be drawn at any particular angle?
Steve
Chan Bok
Active Member
Posts: 26
Joined: 13 Sep 2000 23:01

Unread post by Chan Bok »

The LOGFONT structure has a lfOrientation field:

Code: Select all

typedef struct tagLOGFONT {   LONG lfHeight;   LONG lfWidth;   LONG lfEscapement;   LONG lfOrientation;   LONG lfWeight;   BYTE lfItalic;   BYTE lfUnderline;   BYTE lfStrikeOut;   BYTE lfCharSet;   BYTE lfOutPrecision;   BYTE lfClipPrecision;   BYTE lfQuality;   BYTE lfPitchAndFamily;   TCHAR lfFaceName[LF_FACESIZE]; } LOGFONT, *PLOGFONT;

Chan Bok
Axon Research
Kari Rastas
Active Member
Posts: 36
Joined: 4 Mar 2000 0:01

Unread post by Kari Rastas »

Addition to Chan Bok's advice

Code: Select all

        FONT = vpi::fontCreate(ff_helvetica,List,FontSize),         binary::setIndexed_unsigned(Font,2,10*(Angle)),         binary::setIndexed_unsigned(Font,3,10*(Angle)),         .......
Chan Bok
Active Member
Posts: 26
Joined: 13 Sep 2000 23:01

Unread post by Chan Bok »

Yes, it is the Escapement that determines the rotation.
The Orientation can be set to 0.
Steve Lympany
VIP Member
Posts: 56
Joined: 31 Mar 2001 23:01

Unread post by Steve Lympany »

Hi,
Very good, thanks.
I think it would be good to put this in the wiki...
cheers
Steve
User avatar
Ferenc Nagy
VIP Member
Posts: 215
Joined: 24 Apr 2007 12:26

What does Orientation do in the logFont structure?

Unread post by Ferenc Nagy »

OK, I have commented out the stepping with the Orientation variable.
The results were good only by changing the Escapement.
What is the role of the Orientation? Can you give me an example where its value has effect on the drawn text?

Code: Select all

predicates     onTestTextOrientation : window::menuItemListener. clauses     onTestTextOrientation(Task, _MenuTag) :-         tiled:=tile::new1(Task),             _=[                TestWindow             ||                 std::fromToInStep(0,420,60)=Escapement,                 %std::fromToInStep(0,300,60)=Orientation,                 Orientation=0,                 Title=string::format("Escapement= %3d, orientation = %3d",Escapement,Orientation),                 TestWindow=vpi::winCreate(w_TopLevel,rct(0,0,240,240),Title,noMenu,getTaskWindow(),                     plainFigure::plain_flags,                 testOrientationHandler,gui_api::mkL(1000*Escapement+Orientation)),                 asserta(drawmode_window(TestWindow))             ].   predicates     testOrientationHandler:eHandler.   clauses     testOrientationHandler(_, e_Create(_)) = gui_api::rNull /* uncheckedConvert(gui_Native::lResult,0) */ :-         _Fit=taskWindow::tiled:move(applicationWindow::get()),         !.     % Mkr used as recommended in upgrade notes     testOrientationHandler(H, e_Update(_Update_Rect)) = gui_api::mkR(3) :-         D=gui_api::getUnsigned(winGetData(H)),         Escapement=D div 1000,         Orientation=D mod 100,         paintObliqueText(H,winGetClientRect(H),winGetText(H),Escapement,Orientation),         !.     testOrientationHandler(H,e_CloseRequest())=gui_api::rNull :-         retractall(drawmode_window(H)),         winDestroy(H),         !.     testOrientationHandler(_Handler, _Event) = gui_api::rNull.
Attachments
rotated text.PNG
rotated text.PNG (13.49 KiB) Viewed 10077 times
TIA, Regards,
Frank Nagy
User avatar
Thomas Linder Puls
VIP Member
Posts: 1398
Joined: 28 Feb 2000 0:01

Unread post by Thomas Linder Puls »

From the description (LOGFONT structure) it seems that:
  • Orientation is for each character, i.e. without changing the "escapement" (which is apparently the direction in which the entire text line points).
  • If the graphics mode is GM_COMPATIBLE only the escapement have any effect.
It must be some other predicate/function that changes the graphics mode.
Regards Thomas Linder Puls
PDC
User avatar
Ferenc Nagy
VIP Member
Posts: 215
Joined: 24 Apr 2007 12:26

GM_COMPATIBLE and GM_ADVANCED

Unread post by Ferenc Nagy »

Hi,
SetGraphicsMode function:
http://msdn.microsoft.com/en-us/library ... 85%29.aspx
What is GM_COMPATIBLE and GM_ADVANCED?
How can I set them from VIP?
What are their main differences?
TIA, Regards,
Frank Nagy
Post Reply