Click here to Skip to main content
15,909,466 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionText coming out in a wrong orientation Pin
Anthony Appleyard1-Sep-09 5:10
Anthony Appleyard1-Sep-09 5:10 
AnswerRe: Text coming out in a wrong orientation Pin
Richard MacCutchan1-Sep-09 6:00
mveRichard MacCutchan1-Sep-09 6:00 
GeneralRe: Text coming out in a wrong orientation Pin
Anthony Appleyard1-Sep-09 6:37
Anthony Appleyard1-Sep-09 6:37 
GeneralRe: Text coming out in a wrong orientation Pin
Cedric Moonen1-Sep-09 7:33
Cedric Moonen1-Sep-09 7:33 
GeneralRe: Text coming out in a wrong orientation Pin
Richard MacCutchan1-Sep-09 7:54
mveRichard MacCutchan1-Sep-09 7:54 
General[Message Deleted] Pin
Anthony Appleyard1-Sep-09 8:15
Anthony Appleyard1-Sep-09 8:15 
QuestionRe: Text coming out in a wrong orientation Pin
David Crow1-Sep-09 8:52
David Crow1-Sep-09 8:52 
AnswerRe: Text coming out in a wrong orientation Pin
Anthony Appleyard1-Sep-09 11:31
Anthony Appleyard1-Sep-09 11:31 
Done. Thanks for the advice.

//spec[] is an array: spec[i] = 1 if character i is special
         else {SIZE K[256]; HFONT zaf; char*n;
               sprintf(tit,"TYPECASE: Select a Unicode character from 0x%02x00 to 0x%02xff: %s %s",
                        nalph2,nalph2,alph[nalph2]+3,alph[nalph2]+21);
               wc[1]=0; di=int(r.right/double(I)); dj=int(r.bottom/double(J+sb));
               for(i=0;i<256;i++) {wc[0]=i+256*nalph2; GetTextExtentPoint32W(dc,wc,1,&K[i]);}
               for(k=j=1,i=0;i<256;i++) {k=max(k,short(K[i].cx)); j=max(j,short(K[i].cy));}
               h=short(.9*min(dj,j*di/double(k)));
               yaf=CreateFont(h,0,0,0,LF.lfWeight,LF.lfItalic,0,0,1,0,0,0,FF_DONTCARE,font);
               zaf=CreateFont(int(dj*.4/(p1616?1:4)),0,0,0,LF.lfWeight,LF.lfItalic,0,0,1,0,0,0,FF_DONTCARE,font);
               of=(HFONT)SelectObject(dc,zaf); COLORREF oldpen=SetTextColor(dc,RGB(255,0,0));
               for(j=0;j<J;j++) for(i=0;i<I;i++) if(m=i+j*I+256*nalph2,n=spec[m],n) {
// instead of a character, a small note in red in that character's box
                     /*   di=char(r.right/16); dj=char(r.bottom/(16+sb));*/
               alphnote(dc,i,j,di,dj,n,n+18);}
               SetTextColor(dc,oldpen); SelectObject(dc,yaf);
               for(j=0;j<J;j++) for(i=0;i<I;i++) if(m=i+j*I+256*nalph2,n=spec[m],!n) {
                        wc[0]=i+j*I+256*nalph2; TextOutW(dc,i*di+2,j*dj+2,wc,1);} // print the character
               SelectObject(dc,of); DeleteObject(yaf); DeleteObject(zaf);
               for(j=1;j<=J;j++) Line(dc,0,j*dj,I*di,j*dj);
               for(i=1;i<=I;i++) Line(dc,i*di,0,i*di,J*dj);}


In CreateFont, the 4th arg is "The angle, in tenths of degrees, between each character's base line and the x-axis of the device.": here, correctly 0.

TextOutW(dc,i*di+2,j*dj+2,wc,1); prints the character.

Is "@Arial Unicode MS" a very new font with internal features that older write-text functions such as CreateFont and TextOutW do not handle properly? This trouble does not happen with my Windows Vista's default font.
GeneralRe: Text coming out in a wrong orientation Pin
Richard MacCutchan1-Sep-09 12:02
mveRichard MacCutchan1-Sep-09 12:02 
GeneralRe: Text coming out in a wrong orientation Pin
Anthony Appleyard1-Sep-09 23:59
Anthony Appleyard1-Sep-09 23:59 
GeneralRe: Text coming out in a wrong orientation [modified] Pin
Richard MacCutchan2-Sep-09 4:25
mveRichard MacCutchan2-Sep-09 4:25 
GeneralRe: Text coming out in a wrong orientation Pin
Anthony Appleyard2-Sep-09 5:13
Anthony Appleyard2-Sep-09 5:13 
GeneralRe: Text coming out in a wrong orientation Pin
Richard MacCutchan2-Sep-09 5:19
mveRichard MacCutchan2-Sep-09 5:19 
GeneralRe: Text coming out in a wrong orientation Pin
Anthony Appleyard2-Sep-09 6:18
Anthony Appleyard2-Sep-09 6:18 
GeneralRe: Text coming out in a wrong orientation Pin
Rick York2-Sep-09 11:53
mveRick York2-Sep-09 11:53 
GeneralRe: Text coming out in a wrong orientation Pin
Randor 2-Sep-09 9:51
professional Randor 2-Sep-09 9:51 
GeneralRe: Text coming out in a wrong orientation Pin
Richard MacCutchan3-Sep-09 2:04
mveRichard MacCutchan3-Sep-09 2:04 
QuestionHow to find that an application is executed from command prompt or by double clicking the application ? Pin
Dharmendra Bhargava1-Sep-09 4:51
Dharmendra Bhargava1-Sep-09 4:51 
AnswerRe: How to find that an application is executed from command prompt or by double clicking the application ? Pin
zhu_lin1-Sep-09 4:59
zhu_lin1-Sep-09 4:59 
GeneralRe: How to find that an application is executed from command prompt or by double clicking the application ? Pin
Dharmendra Bhargava1-Sep-09 20:51
Dharmendra Bhargava1-Sep-09 20:51 
AnswerRe: How to find that an application is executed from command prompt or by double clicking the application ? Pin
David Crow1-Sep-09 5:20
David Crow1-Sep-09 5:20 
AnswerRe: How to find that an application is executed from command prompt or by double clicking the application ? Pin
Michael Schubert1-Sep-09 5:25
Michael Schubert1-Sep-09 5:25 
QuestionHow to accept Enter key in Button control. Pin
birajendu1-Sep-09 3:59
birajendu1-Sep-09 3:59 
AnswerRe: How to accept Enter key in Button control. Pin
basementman1-Sep-09 4:02
basementman1-Sep-09 4:02 
GeneralRe: How to accept Enter key in Button control. Pin
birajendu1-Sep-09 4:18
birajendu1-Sep-09 4:18 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.