Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

GetFontUnicodeRanges trouble

Hi all, I'm new to the board and have quite a diffcult dilemna. In writing a small MFC app I want to print out all characters that a particular font can display. In my search I came across the function GetFontUnicodeRanges which is laid out like so:

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

DWORD GetFontUnicodeRanges(
HDC hdc, // handle to DC
LPGLYPHSET lpgs // glyph set
);
Parameters
hdc
[in] Handle to the device context.
lpgs
[out] Pointer to a GLYPHSET structure that receives the glyph set information. If this parameter is NULL, the function returns the size of the GLYPHSET structure required to store the information.
Return Values
If the function succeeds, it returns number of bytes written to the GLYPHSET structure or, if the lpgs parameter is NULL, it returns the size of the GLYPHSET structure required to store the information.

If the function fails, it returns zero.
[/code]

I can get the function to work correctly but my problem is AFTER the call is made. Here is a sample of my code:

[code]
CClientDC dc(this);
dc.CreateCompatibleDC(&dc);
CFont* pOld = dc.SelectObject(&m_fCurrentFont);
GetFontUnicodeRanges(dc.GetSafeHdc(), m_pGS);
dc.SelectObject(pOld);
return m_pGS->cGlyphsSupported;
[/code]

m_fCurrentFont is a font that I have created and DOES exist on my system. The problem occurs when I try to select the previous font (pOld) back into the device context. any thoughts?

Comments

  • Shawn CarterShawn Carter Member Posts: 0

    _____ < http://forcoder.org /> free ebooks and video tutorials about | Objective-C, PL/SQL, Perl, C++, Swift, Visual Basic, Python, Go, Delphi, Assembly, PHP, MATLAB, Ruby, Scratch, R, C, Visual Basic .NET, JavaScript, Java, C# Prolog, Bash, VBScript, COBOL, D, Alice, Crystal, Fortran, LabVIEW, Apex, Logo, Lisp, Scala, Awk, Erlang, Lua, F#, Kotlin, Ada, Transact-SQL, FoxPro, ABAP, SAS, Hack, Dart, Julia, Rust, Scheme, ML, Clojure | ___

Sign In or Register to comment.