I\'m using Borland C++ Builder 2009 and I display the right and left pointing arrows like so:
Button2->Hint = L\"Ctrl+\\u2190\" ;
Button3->Hint = L\"Ct
Just for reference and the Google Gods:
bool UnicodeCharSupported(HWND Handle, wchar_t Char)
{
if (Handle)
{
DWORD dwSize = GetFontUnicodeRanges(Handle, NULL);
if (dwSize)
{
bool Supported = false ;
BYTE* bBuffer = new BYTE[dwSize];
GLYPHSET* pGlyphSet = reinterpret_cast<GLYPHSET*>(bBuffer);
if (GetFontUnicodeRanges(Handle, pGlyphSet))
{
for (DWORD x = 0 ; x < pGlyphSet->cRanges && !Supported ; x++)
{
Supported = (Char >= pGlyphSet->ranges[x].wcLow &&
Char < (pGlyphSet->ranges[x].wcLow + pGlyphSet->ranges[x].cGlyphs)) ;
}
}
delete[] bBuffer;
return Supported ;
}
}
return false ;
}
Example, relating to my Question:
if (!UnicodeCharSupported(Canvas->Handle, 0x2190))
{ /* Character not supported in current Font, use different character */ }
You can use GetFontUnicodeRanges() to see which characters are supported by the font currently selected into the DC. Note that this API requires you to call it once to find out how big the buffer needs to be, and a second time to actually get the data.
DWORD dwSize = GetFontUnicodeRanges(hDC, nullptr);
BYTE* bBuffer = new BYTE[dwSize];
GLYPHSET* pGlyphSet = reinterpret_cast<GLYPHSET*>(bBuffer);
GetFontUnicodeRanges(hDC, pGlyphSet);
// use data in pGlyphSet, then free the buffer
delete[] bBuffer;
The GLYPHSET structure has a member array called ranges
which lets you determine the range of characters supported by the font.