Solved

How to determine if font is unicode?

Posted on 2002-06-05
2
677 Views
Last Modified: 2013-12-02
In my Unicode application I allow the user to change font between an ordinary 8-bit font and Unicode fonts such as Chinese.

How do I determine whether the current font (CFont or LOGFONT) is a Unicode font, i.e., a font that requires 16-bit to store in a file?

Is there a method that can be called on a CFont to determine that it cannot be represented in 8 bits?
0
Comment
Question by:Claus
2 Comments
 
LVL 23

Expert Comment

by:Roshan Davis
ID: 7055752
find "HOWTO: Translate Unicode Character Codes to TrueType Glyph Indices in Windows 95" in MSDN.

MSDN says

All Microsoft Unicode encodings (Platform ID = 3, Encoding ID = 1) must use Format 4 for their 'cmap' subtable. Microsoft strongly recommends using a Unicode 'cmap' for all fonts. However, some other encodings that appear in current fonts follow:
Platform ID      Encoding ID      Description
3           0           Symbol
3           1           Unicode
3           2            ShiftJIS      
3           3            Big5
3           4            PRC
3           5            Wansung
3           6            Johab


GOOD LUCK
0
 
LVL 86

Accepted Solution

by:
jkr earned 100 total points
ID: 7056275
What about using

GetFontUnicodeRanges

The GetFontUnicodeRanges function returns information about which Unicode characters are supported by a font. The information is returned as a GLYPHSET structure.

WINGDIAPI DWORD WINAPI GetFontUnicodeRanges(
  HDC hdc,         // handle to the device context
  LPGLYPHSET lpgs  // pointer to the glyph set structure
);
 
Parameters
hdc
Handle to the device context.
lpgs
Pointer to a buffer to contain the GLYPHSET structure. If this parameter is NULL, the function returns a pointer to the GLYPHSET structure for the current font.
Return Values
If the function succeeds, it returns a pointer to the font's GLYPHSET structure for the current device context.

If the function fails, it returns zero.

0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

In this article, I'll describe -- and show pictures of -- some of the significant additions that have been made available to programmers in the MFC Feature Pack for Visual C++ 2008.  These same feature are in the MFC libraries that come with Visual …
Introduction: Dialogs (2) modeless dialog and a worker thread.  Handling data shared between threads.  Recursive functions. Continuing from the tenth article about sudoku.   Last article we worked with a modal dialog to help maintain informat…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

912 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now