CSGetFontUnicodeRange Function
Description
Get the starting unicode character code of a unicode glyph set, and the number of glyphs in that set.
Syntax
VB/A 32bits
Private Declare Function CSGetFontUnicodeRange Lib "consoul_010205_32.dll" ( _
ByVal hWnd As Long, _
ByVal lIndex As Long, _
ByVal lRetLow As Long, _
ByVal lRetCount As Long _
) As Integer
VB/A 64bits
Private Declare PtrSafe Function CSGetFontUnicodeRange Lib "consoul_010205_64.dll" ( _
ByVal hWnd As LongPtr, _
ByVal lIndex As Long, _
ByVal lRetLow As LongPtr, _
ByVal lRetCount As LongPtr _
) As Integer
Return Value
The return value returns 1 (one) if it was successfull, or 0 (zero) if hWnd
is not a valid Consoul window handle.
Parameters
hWnd
The window handle (HWND) of the Consoul window, as returned by CSCreateLogWindow.
lIndex
Zero based index of the range among those returned by the CSLoadUnicodeRanges().
lRetLow
Address of a 2 bytes memory buffer (a word, Integer in VB/A) that will receive a unicode character code, that is the lowest unicode character code in the range.
lRetCount
Address of a 2 bytes memory buffer (a word, Integer in VB/A) that will receive glyph count for the range.
Remarks
Usage example
'Sample usage (from AsciiPaint 2 source code in the character map window) of
'CSLoadFontUnicodeRanges() and CSGetFontUnicodeRange(), to get all the glyphs
'of the consoul window. The scope of the consoul window, mhWnd, is a module
'level variable.
'palRetCharCodes is an array of Long integer, declared Like:
'Dim alCharCodes() as Long.
Public Function GetUnicodeCharCodes(ByRef palRetCharCodes() As Long) As Long
If mhWnd = 0 Then Exit Function
Dim i As Long
Dim lRangeCt As Long
Dim lTotGlyphCt As Long
Dim iStart As Integer
Dim iGlyphCt As Integer
Dim k As Long
On Error GoTo GetUnicodeCharCodes_Err
lRangeCt = CSLoadFontUnicodeRanges(mhWnd)
For i = 1 To lRangeCt
If CSGetFontUnicodeRange(mhWnd, i, VarPtr(iStart), VarPtr(iGlyphCt)) Then
If iGlyphCt Then
ReDim Preserve palRetCharCodes(1 To lTotGlyphCt + iGlyphCt) As Long
For k = 1 To iGlyphCt
palRetCharCodes(lTotGlyphCt + k) = iStart + k - 1
Next k
lTotGlyphCt = lTotGlyphCt + iGlyphCt
End If
End If
Next i
CSUnloadFontUnicodeRanges mhWnd
GetUnicodeCharCodes = lTotGlyphCt
GetUnicodeCharCodes_Exit:
Exit Function
GetUnicodeCharCodes_Err:
Resume GetUnicodeCharCodes_Exit
End Function
Last updated: May 13 2022.