Solved

How to determine if font is unicode?

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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Introduction: Load and Save to file, Document-View interaction inside the SDI. Continuing from the second article about sudoku.   Open the project in visual studio. From the class view select CSudokuDoc and double click to open the header …
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…
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…

746 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

12 Experts available now in Live!

Get 1:1 Help Now