CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 6 of 6

Hybrid View

  1. #1
    Join Date
    Nov 2001
    Posts
    11

    Printing unicode data onto PRINTER using TextOut/TextOutW

    Im facing a strange problem while printing unicode data onto my PRINTER using TextOut. On the screen it displays all characters properly(my string includes English, Russian, Japanese and European characters.). When I print this onto the printer, some strange characters are printed. Strangely my English characters and some European characters are printed properly. However, when I use TextOutW some weird Asian characters-looked like Japanese or Chinese to me- are printed. I tried converting my string using MultiByteToWideChar(...) and I started getting some '.' in BOLD..!!! Any idea where Im making mistake?

    F1 F1 F1..!! Please help me..!!

    Note: I have enen tried with different unicode fonts that supports the languages above. Im working on VC++ 6.0 on WinXP

  2. #2
    Join Date
    Sep 2001
    Location
    San Diego
    Posts
    2,147
    This is probably because Windows is trying to optimize the printing for you by sending the text to the printer as text. Windows may be (incorrectly) assuming that your printer has the required font installed.

    If the font is not installed on the printer, the printer will select something it thinks is appropriate - this may not be suitable.

    One good solution for your situation where you are using many different languages, is to configure the printer to not make these optimizations...

    Try enabling Print TrueType As Graphics in the Fonts tab of the printer’s Properties sheet.

    This forces the text to be sent to the printer as an image instead of as plain text. The printer will then just draw whatever the text looks like, without trying to interpret it.

    Hope this helps,

    - Nigel

  3. #3
    Join Date
    Oct 2007
    Posts
    1

    Re: Printing unicode data onto PRINTER using TextOut/TextOutW

    Quote Originally Posted by NigelQ
    This is probably because Windows is trying to optimize the printing for you by sending the text to the printer as text. Windows may be (incorrectly) assuming that your printer has the required font installed.

    If the font is not installed on the printer, the printer will select something it thinks is appropriate - this may not be suitable.

    One good solution for your situation where you are using many different languages, is to configure the printer to not make these optimizations...

    Try enabling Print TrueType As Graphics in the Fonts tab of the printer’s Properties sheet.

    This forces the text to be sent to the printer as an image instead of as plain text. The printer will then just draw whatever the text looks like, without trying to interpret it.

    Hope this helps,

    - Nigel
    Hi,
    I'm having trouble printing uncode text to a picturebox. I'm using vb6+ xp+pro sp2. I set a unicode font to the picturebox and use the TextOut API
    to print...but some chars doesn't seem to be displayed...any suggestion? What am I missing?

    Kind regards

  4. #4
    Join Date
    Apr 2007
    Posts
    2

    Re: Printing unicode data onto PRINTER using TextOut/TextOutW

    I am having the same problem but not while printing. On screen my strings have not been printed correctly. The English characters have turned to be like Japanese characters.

    This is how I create my font:
    Font = CreateFontW(-iHeight, 0, iRot2, 0,200,0,(m_cFontStyle & 2)?1:0,(m_cFontStyle & 4)?1:0,DEFAULT_CHARSET,0,0,0,0,TEXT("Arial Unicode MS"));
    Font2 = (HFONT)SelectObject(a_GI.m_HDC, Font);

    And this is how I do the text output:

    WCHAR *m_CBuf = new WCHAR[m_Value[i].length()+1];

    TextOut(a_GI.m_HDC, P.x, P.y, m_CBuf, lstrlen(m_CBuf));

    Can someone please help me?
    Thanks in advance.

  5. #5
    Join Date
    Nov 2000
    Location
    Voronezh, Russia
    Posts
    6,620

    Re: Printing unicode data onto PRINTER using TextOut/TextOutW

    Quote Originally Posted by ~faith~ View Post
    Can someone please help me?
    You need to make a small compilable project where you reproduce your current project settings and have the same problem, and post it here. This way you can get some help.

    Otherwise you make us guess about your project settings and omitted code parts, that is counterproductive.
    Best regards,
    Igor

  6. #6
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,395

    Re: Printing unicode data onto PRINTER using TextOut/TextOutW

    I don't see any "English characters" in your m_CBuf... You have not set any character to it at all.
    Victor Nijegorodov

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured