Solved

How to determine if font is unicode?

Posted on 2002-06-05
2
680 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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Introduction: The undo support, implementing a stack. Continuing from the eigth article about sudoku.   We need a mechanism to keep track of the digits entered so as to implement an undo mechanism.  This should be a ‘Last In First Out’ collec…
Introduction: Dialogs (1) modal - maintaining the database. Continuing from the ninth article about sudoku.   You might have heard of modal and modeless dialogs.  Here with this Sudoku application will we use one of each type: a modal dialog …
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…

808 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