EDN Admin
Well-known member
<p align="left" style="text-align:left; margin-bottom:12pt; word-break:keep-all
<span lang="EN-US" style="font-family:Verdana,sans-serif; font-size:9pt Hello,
<p align="left" style="text-align:left; margin-bottom:12pt; word-break:keep-all
<span lang="EN-US" style="font-family:Verdana,sans-serif; font-size:9pt I am tryint to align at left/bottom when font orientation is 90,180,270 degree.
<p align="left" style="text-align:left; margin-bottom:12pt; word-break:keep-all
<span lang="EN-US" style="font-family:Verdana,sans-serif; font-size:9pt When a font orientation is 0 degree, left/bottom aligning is good.
<p align="left" style="text-align:left; margin-bottom:12pt; word-break:keep-all
<span lang="EN-US" style="font-family:Verdana,sans-serif; font-size:9pt but in the case of the other orientation, text aligning is not left/bottom.
<p align="left" style="text-align:left; margin-bottom:12pt; word-break:keep-all
<span lang="EN-US" style="font-family:Verdana,sans-serif; font-size:9pt Te following code is a drawing some text aligned left/bottom when orientation is 90,180,270.
<pre class="prettyprint void test_escape_orient(HDC hDC, int x, int y, int escape, int orient)
{
HFONT hFont = CreateFont(
-20,
-20,
escape,
orient,
FW_NORMAL, 0, 0, 0,
ANSI_CHARSET,
OUT_TT_ONLY_PRECIS,
CLIP_STROKE_PRECIS,
PROOF_QUALITY,
FIXED_PITCH|FF_MODERN,
_T("Courier"));
if(hFont) {
HFONT hOldFont = (HFONT)SelectObject(hDC, hFont);
TCHAR tc[128];
_stprintf(tc, _T("x %d,y %d string"), x, y);
TextOut(hDC, x, y, tc, _tcslen(tc));
//mark origin of textout
RECT rc;
::SetRect(&rc, x-1, y-1, x+1, y+1);
::Rectangle(hDC, rc.left, rc.top, rc.right, rc.bottom);
SelectObject(hDC, hOldFont);
DeleteObject(hFont);
}
}
void CtxtView::OnPaint()
{
CPaintDC dc(this);
CDC hDC = dc.GetSafeHdc();
SetGraphicsMode(hDC, GM_ADVANCED);
SetTextAlign(hDC, TA_LEFT | TA_BOTTOM|TA_NOUPDATECP);
test_escape_orient(hDC, 100, 100, 0, 0);
test_escape_orient(hDC, 100, 150, 0, 1800);
test_escape_orient(hDC, 100, 200, 0, 900);
test_escape_orient(hDC, 100, 250, 0, 2700);
}[/code]
<br/>
<p align="left" style="text-align:left; margin-bottom:12pt; word-break:keep-all
<span lang="EN-US" style="font-family:Verdana,sans-serif; font-size:9pt I also mark the align point of textout.
<p align="left" style="text-align:left; margin-bottom:12pt; word-break:keep-all
<span lang="EN-US" style="font-family:Verdana,sans-serif; font-size:9pt The first image is an output of the upper code and the next is my expecting result.
<p align="left" style="text-align:left; margin-bottom:12pt; word-break:keep-all
<span lang="EN-US" style="font-family:Verdana,sans-serif; font-size:9pt <img alt="" src="http://social.msdn.microsoft.com/Forums/getfile/100555
<p align="left" style="text-align:left; margin-bottom:12pt; word-break:keep-all
<span lang="EN-US" style="font-family:Verdana,sans-serif; font-size:9pt I wonder my expecting marking point is wrong which is aligned at left/bottom of character X.
<p align="left" style="text-align:left; margin-bottom:12pt; word-break:keep-all
<span lang="EN-US" style="font-family:Verdana,sans-serif; font-size:9pt Would you guide me how to find the aligning point when orientation is 90,180,270?
<p align="left" style="text-align:left; margin-bottom:12pt; word-break:keep-all
<span lang="EN-US" style="font-family:Verdana,sans-serif; font-size:9pt
<p align="left" style="text-align:left; margin-bottom:12pt; word-break:keep-all
<span lang="EN-US" style="font-family:Verdana,sans-serif; font-size:9pt one more thing...
<p align="left" style="text-align:left; margin-bottom:12pt; word-break:keep-all
<span lang="EN-US" style="font-family:Verdana,sans-serif; font-size:9pt When orientation is 0 or 180, the output sting is with a fixed width.
<p align="left" style="text-align:left; margin-bottom:12pt; word-break:keep-all
<span lang="EN-US" style="font-family:Verdana,sans-serif; font-size:9pt I set LOGFONT.lfPitchAndFamily to FIXED_PITCH for all calling,
<p align="left" style="text-align:left; margin-bottom:12pt; word-break:keep-all
<span lang="EN-US" style="font-family:Verdana,sans-serif; font-size:9pt but When orientation is 90 or 270, the sting is very condensed.
<p align="left" style="text-align:left; margin-bottom:12pt; word-break:keep-all
<span lang="EN-US" style="font-family:Verdana,sans-serif; font-size:9pt Would you guide me how to output with a fixed width when orientation is 90 or 270.
<p align="left" style="text-align:left; margin-bottom:12pt; word-break:keep-all
<span lang="EN-US" style="font-family:Verdana,sans-serif; font-size:9pt Thank you very much for reading.
View the full article
<span lang="EN-US" style="font-family:Verdana,sans-serif; font-size:9pt Hello,
<p align="left" style="text-align:left; margin-bottom:12pt; word-break:keep-all
<span lang="EN-US" style="font-family:Verdana,sans-serif; font-size:9pt I am tryint to align at left/bottom when font orientation is 90,180,270 degree.
<p align="left" style="text-align:left; margin-bottom:12pt; word-break:keep-all
<span lang="EN-US" style="font-family:Verdana,sans-serif; font-size:9pt When a font orientation is 0 degree, left/bottom aligning is good.
<p align="left" style="text-align:left; margin-bottom:12pt; word-break:keep-all
<span lang="EN-US" style="font-family:Verdana,sans-serif; font-size:9pt but in the case of the other orientation, text aligning is not left/bottom.
<p align="left" style="text-align:left; margin-bottom:12pt; word-break:keep-all
<span lang="EN-US" style="font-family:Verdana,sans-serif; font-size:9pt Te following code is a drawing some text aligned left/bottom when orientation is 90,180,270.
<pre class="prettyprint void test_escape_orient(HDC hDC, int x, int y, int escape, int orient)
{
HFONT hFont = CreateFont(
-20,
-20,
escape,
orient,
FW_NORMAL, 0, 0, 0,
ANSI_CHARSET,
OUT_TT_ONLY_PRECIS,
CLIP_STROKE_PRECIS,
PROOF_QUALITY,
FIXED_PITCH|FF_MODERN,
_T("Courier"));
if(hFont) {
HFONT hOldFont = (HFONT)SelectObject(hDC, hFont);
TCHAR tc[128];
_stprintf(tc, _T("x %d,y %d string"), x, y);
TextOut(hDC, x, y, tc, _tcslen(tc));
//mark origin of textout
RECT rc;
::SetRect(&rc, x-1, y-1, x+1, y+1);
::Rectangle(hDC, rc.left, rc.top, rc.right, rc.bottom);
SelectObject(hDC, hOldFont);
DeleteObject(hFont);
}
}
void CtxtView::OnPaint()
{
CPaintDC dc(this);
CDC hDC = dc.GetSafeHdc();
SetGraphicsMode(hDC, GM_ADVANCED);
SetTextAlign(hDC, TA_LEFT | TA_BOTTOM|TA_NOUPDATECP);
test_escape_orient(hDC, 100, 100, 0, 0);
test_escape_orient(hDC, 100, 150, 0, 1800);
test_escape_orient(hDC, 100, 200, 0, 900);
test_escape_orient(hDC, 100, 250, 0, 2700);
}[/code]
<br/>
<p align="left" style="text-align:left; margin-bottom:12pt; word-break:keep-all
<span lang="EN-US" style="font-family:Verdana,sans-serif; font-size:9pt I also mark the align point of textout.
<p align="left" style="text-align:left; margin-bottom:12pt; word-break:keep-all
<span lang="EN-US" style="font-family:Verdana,sans-serif; font-size:9pt The first image is an output of the upper code and the next is my expecting result.
<p align="left" style="text-align:left; margin-bottom:12pt; word-break:keep-all
<span lang="EN-US" style="font-family:Verdana,sans-serif; font-size:9pt <img alt="" src="http://social.msdn.microsoft.com/Forums/getfile/100555
<p align="left" style="text-align:left; margin-bottom:12pt; word-break:keep-all
<span lang="EN-US" style="font-family:Verdana,sans-serif; font-size:9pt I wonder my expecting marking point is wrong which is aligned at left/bottom of character X.
<p align="left" style="text-align:left; margin-bottom:12pt; word-break:keep-all
<span lang="EN-US" style="font-family:Verdana,sans-serif; font-size:9pt Would you guide me how to find the aligning point when orientation is 90,180,270?
<p align="left" style="text-align:left; margin-bottom:12pt; word-break:keep-all
<span lang="EN-US" style="font-family:Verdana,sans-serif; font-size:9pt
<p align="left" style="text-align:left; margin-bottom:12pt; word-break:keep-all
<span lang="EN-US" style="font-family:Verdana,sans-serif; font-size:9pt one more thing...
<p align="left" style="text-align:left; margin-bottom:12pt; word-break:keep-all
<span lang="EN-US" style="font-family:Verdana,sans-serif; font-size:9pt When orientation is 0 or 180, the output sting is with a fixed width.
<p align="left" style="text-align:left; margin-bottom:12pt; word-break:keep-all
<span lang="EN-US" style="font-family:Verdana,sans-serif; font-size:9pt I set LOGFONT.lfPitchAndFamily to FIXED_PITCH for all calling,
<p align="left" style="text-align:left; margin-bottom:12pt; word-break:keep-all
<span lang="EN-US" style="font-family:Verdana,sans-serif; font-size:9pt but When orientation is 90 or 270, the sting is very condensed.
<p align="left" style="text-align:left; margin-bottom:12pt; word-break:keep-all
<span lang="EN-US" style="font-family:Verdana,sans-serif; font-size:9pt Would you guide me how to output with a fixed width when orientation is 90 or 270.
<p align="left" style="text-align:left; margin-bottom:12pt; word-break:keep-all
<span lang="EN-US" style="font-family:Verdana,sans-serif; font-size:9pt Thank you very much for reading.
View the full article