字体字符集的问题
我用EnumFontFamilies 获取了所有字体的名字,还有他的字符集lfCharSet:
ANSI_CHARSET = 0
DEFAULT_CHARSET = 1
SYMBOL_CHARSET = 2
再请问下, 有没有办法知道他对应于系统的描述名字呢?
比如 ANSI_CHARSET 在中文系统中是:西文
在英文系统中应该对应的是: Western
如果不明我的意思,请看下图所示:http://www.cnsubmit.com/-1_177.gif
谢谢。
[解决办法]
思路:
把你得到的字体名填充到LOGFONT结构中,再用CreateFontIndirectA API建立字体,有了字体就好办了。
参考:
Dim uLF As LOGFONT
Dim lChar As Long
Dim lLMargin As Long
Dim lRMargin As Long
Dim b() As Byte
With New_Font
b = StrConv(.Name & vbNullChar, vbFromUnicode)
ReDim Preserve b(0 To 31) As Byte
CopyMemory uLF.lfFaceName(0), b(0), 32&
uLF.lfHeight = -MulDiv(.Size, GetDeviceCaps(UserControl.hDC, LOGPIXELSY), 72)
uLF.lfItalic = .Italic
uLF.lfWeight = IIf(.Bold, FW_BOLD, FW_NORMAL)
uLF.lfUnderline = .Underline
uLF.lfStrikeOut = .Strikethrough
uLF.lfCharSet = .Charset
End With
Call fDestroyFont
m_hFont = CreateFontIndirectA(uLF)
Call SendMessageLongA(m_hWndEB, WM_SETFONT, m_hFont, ByVal 1&)
Set m_oFont = New_Font