15 мая 2023 года "Исходники.РУ" отмечают своё 23-летие!
Поздравляем всех причастных и неравнодушных с этим событием!
И огромное спасибо всем, кто был и остаётся с нами все эти годы!

Главная Форум Журнал Wiki DRKB Discuz!ML Помощь проекту


Rotating fonts in win95

Carsten Schwartz -- csn@dhi.dk
Tuesday, December 03, 1996


Environment: VC++ 4.2-flat, Win 95

We have a problem rotating true type fonts in  windows 95.

We do like this under NT4.0:

LOGFONT *pFont = GetLogFont();
pFont->lfEscapement = (LONG)angInDegX10;

But under Windows 95 it is displayed as a normal text (horizontal).

What do we do?
_____________________________________________________
Carsten Schwartz            Email : csn@dhi.dk
Software Engineer           www   : http://www.dhi.dk
Danish Hydraulic Institute  Tel.  : +45 45 76 95 55
Agern Alle 5                Fax.  : +45 45 76 25 67
2970 Horsholm
Denmark

And they shall know no fear...
_____________________________________________________





Mats Mеnhav -- manhav@connectum.skurup.se
Thursday, December 05, 1996

[Mini-digest: 6 responses]

-- [ From: Mats Manhav * EMC.Ver #2.5.02 ] --

The rotation of texts is only possible on TrueType fonts.
Maybe by pure luck the font you are working with under NT is a TT and by
pure no-luck under 95 it isn't.

Mats
-------- REPLY, Original message follows --------

> Date: Tuesday, 03-Dec-96 07:06 AM
> 
> From: Carsten Schwartz         \ Internet:    (csn@dhi.dk)
> To:   MFCList                  \ Internet:    (mfc-l@netcom.com)
> 
> Subject: Rotating fonts in win95
> 
Environment: VC++ 4.2-flat, Win 95
> 
> We have a problem rotating true type fonts in  windows 95.
> 
> We do like this under NT4.0:
> 
> LOGFONT *pFont = GetLogFont();
> pFont->lfEscapement = (LONG)angInDegX10;
> 
> But under Windows 95 it is displayed as a normal text (horizontal).
> 
> What do we do?
> _____________________________________________________
> Carsten Schwartz            Email : csn@dhi.dk
> Software Engineer           www   : http://www.dhi.dk
> Danish Hydraulic Institute  Tel.  : +45 45 76 95 55
> Agern Alle 5                Fax.  : +45 45 76 25 67
> 2970 Horsholm
> Denmark
> 
> And they shall know no fear...
> _____________________________________________________
> 
> 

-------- REPLY, End of original message --------


--
==========================================================================
Mats Mеnhav (Mats Manhav for 7-bit people)
email:manhav@connectum.skurup.se   WWW: http://connectum.skurup.se/~manhav
FAX:  (int) 46 (0) 414 243 05      Phone: (int) 46 (0) 414 243 05         
==========================================================================

-----From: joew@statsoft.com (Joe Willcoxson)

>
>Environment: VC++ 4.2-flat, Win 95
>
>We have a problem rotating true type fonts in  windows 95.
>
>We do like this under NT4.0:
>
>LOGFONT *pFont = GetLogFont();
>pFont->lfEscapement = (LONG)angInDegX10;
>
>But under Windows 95 it is displayed as a normal text (horizontal).

pFont->lfOrientation = pFont->lfEscapement; //?
--
Joe Willcoxson (joew@statsoft.com), Senior Software Engineer
Visit us: http://www.statsoft.com, Visit me: http://users.aol.com/chinajoe
#define STD_DISCLAIMER "I speak only for myself"
"Lotteries are a tax on people who do not understand statistics."


-----From: Patrick Shainin 

Changing the lfEscapement field of the LOGFONT structure works in my app 
to rotate text on Win 95, but I am using a CFont object which I select 
into the active DC.  You might also want use lfClipPrecision | 
CLIP_LH_ANGLES to keep all devices rotating in the same direction.  
Here's a snippet:

CFont              rotatedFont;
CFont              tempFont;
LOGFONT    logFont;

tempFont.CreatePointFont(100,"Courier New");
tempFont.GetLogFont(&logFont);

logFont.lfEscapement = angle;
logFont.lfClipPrecision = logFont.ClipPrecision | CLIP_LH_ANGLES;

rotatedFont.CreateFontIndirect(&logFont);
pDC->SelectObject(&rotatedFont);

Patrick Shainin
patrick@shainin.com

Carsten Schwartz wrote:

>Environment: VC++ 4.2-flat, Win 95
>
>We have a problem rotating true type fonts in  windows 95.
>
>We do like this under NT4.0:
>
>LOGFONT *pFont = GetLogFont();
>pFont->lfEscapement = (LONG)angInDegX10;
>
>But under Windows 95 it is displayed as a normal text (horizontal).
>
>What do we do?
-----From: David Little 

I never tried rotating just by getting a pointer.  I usually rotate it =
in CreateFont, and if I need another rotation somewhere else, I just =
have two CFont objects and SelectObject() accordingly....

----------
From: 	Carsten Schwartz[SMTP:csn@dhi.dk]
Sent: 	Tuesday, December 03, 1996 1:06 AM
To: 	'MFC Mailing List'
Subject: 	Rotating fonts in win95


Environment: VC++ 4.2-flat, Win 95

We have a problem rotating true type fonts in  windows 95.

We do like this under NT4.0:

LOGFONT *pFont =3D GetLogFont();
pFont->lfEscapement =3D (LONG)angInDegX10;

But under Windows 95 it is displayed as a normal text (horizontal).

What do we do?
_____________________________________________________
Carsten Schwartz            Email : csn@dhi.dk
Software Engineer           www   : http://www.dhi.dk
Danish Hydraulic Institute  Tel.  : +45 45 76 95 55
Agern Alle 5                Fax.  : +45 45 76 25 67
2970 Horsholm
Denmark

And they shall know no fear...
_____________________________________________________
-----From: "Charles N. Johnson" 

Carsten -- Check out the following code I have used to do exactly this in
Windows 95:

void CMyView::OnDraw(CDC* pDC)
{
	// get the size of our view... you never know, the user may
	// change things!
	CRect rcClient;
	GetClientRect(rcClient);

	// create a string to whirl about...let's see...hmmmm
	CString str(_T("Spin this, Dudes!"));

	// Now, how about a blue text with transparent background??
	pDC->SetBkMode(TRANSPARENT);
	pDC->SetTextColor(RGB(0, 0, 255));

	// create a font object
	CFont font;

	// create the font definition structure
	LOGFONT stFont;

	// clear the structure, and set the attributes that
	// will remain constant throughout this process...towit:
	memset(&stFont, 0, sizeof(LOGFONT));
	stFont.lfHeight = MulDiv(14, -pDC->GetDeviceCaps(LOGPIXELSY), 72);
	stFont.lfWeight = FW_NORMAL;
	stFont.lfClipPrecision = CLIP_LH_ANGLES;
	strcpy(stFont.lfFaceName, "Arial");		//Boring!!!

	// now, draw the text at what...15 degree intervals??  Okay!
	// Mike B. maybe won't like this use of resources
	for (int theAngle = 0; theAngel < 3600; theAngle += 150)
	{
		// set the angle of rotation
		stFont.lfEscapement = theAngle;

		// make the font and select the
		// font into the device context, 
		// save old font too
		font.CreateFontIndirect(&stFont);
		CFont pOldFont = pDC->SelectObject(&font);

		// Hey! Hey! Whirl away!
		pDC->TextOut(rcClient.right/2, rcClient.bottom/2, str);

		// hosekeeping chores...select font out of device context
		// and destroy GDI object
		pDC->SelectObject(pOldFont);
		font.DeleteObject();
	}
}


----------
> From: Carsten Schwartz 
> To: 'MFC Mailing List' 
> Subject: Rotating fonts in win95
> Date: Tuesday, December 03, 1996 1:06 AM
> 
> 
> Environment: VC++ 4.2-flat, Win 95
> 
> We have a problem rotating true type fonts in  windows 95.
> 
> We do like this under NT4.0:
> 
> LOGFONT *pFont = GetLogFont();
> pFont->lfEscapement = (LONG)angInDegX10;
> 
> But under Windows 95 it is displayed as a normal text (horizontal).
> 
> What do we do?
> _____________________________________________________
> Carsten Schwartz            Email : csn@dhi.dk
> Software Engineer           www   : http://www.dhi.dk
> Danish Hydraulic Institute  Tel.  : +45 45 76 95 55
> Agern Alle 5                Fax.  : +45 45 76 25 67
> 2970 Horsholm
> Denmark
> 
> And they shall know no fear...
> _____________________________________________________
> 
> 
-----From: "Beaudry, Tom" 


There's two different modes under NT and apparently the default mode   
produces what you want.  Under Win95 there is only one mode and you have   
to set both the escapement and orientation to get the desired result.

The applicable extract from the ::CreateFont online help:


nEscapement
Specifies the angle, in tenths of degrees, between the escapement vector   
and the x-axis of the device. The escapement vector is parallel to the   
base line of a row of text.
Windows NT:
When the graphics mode is set to GM_ADVANCED, you can specify the   
escapement angle of the string independently of the orientation angle of   
the string's characters.
When the graphics mode is set to GM_COMPATIBLE, nEscapement specifies   
both the escapement and orientation. You should set nEscapement and   
nOrientation to the same value.
Windows 95:
The nEscapement parameter specifies both the escapement and orientation.   
You should set nEscapement and nOrientation to the same value.
nOrientation
Specifies the angle, in tenths of degrees, between each character's base   
line and the x-axis of the device.


 ----------
From:  Carsten Schwartz[SMTP:csn@dhi.dk]
Sent:  Tuesday, December 03, 1996 7:06 AM
To:  'MFC Mailing List'
Subject:  Rotating fonts in win95


Environment: VC++ 4.2-flat, Win 95

We have a problem rotating true type fonts in  windows 95.

We do like this under NT4.0:

LOGFONT *pFont = GetLogFont();
pFont->lfEscapement = (LONG)angInDegX10;

But under Windows 95 it is displayed as a normal text (horizontal).

What do we do?
_____________________________________________________
Carsten Schwartz            Email : csn@dhi.dk
Software Engineer           www   : http://www.dhi.dk
Danish Hydraulic Institute  Tel.  : +45 45 76 95 55
Agern Alle 5                Fax.  : +45 45 76 25 67
2970 Horsholm
Denmark

And they shall know no fear...
_____________________________________________________






| Вернуться в корень Архива |