各位仁兄新年好---帮我一把------关于字体的发布 (50分)

  • 主题发起人 主题发起人 浪子
  • 开始时间 开始时间

浪子

Unregistered / Unconfirmed
GUEST, unregistred user!
我要做一个维语显示的程序,可在发布时需要把维语的字体发布上去,
请教如何发布字体呢,急用,也不想再找资料了,
 
做安装程序时带上字体文件就可以了
拷贝到系统目录的 fonts目录下
use wise9.0
 
我用的是delphi自带的发布程序,
不行的,不但拷贝到这个目录下,而且还相应的修改了
两个注册表项,
还是不行的,
 
有没有一种不管是什么安装工具的方法呢,就自已也可以
注册上字体的,
 
在系统中安装字体。
AddFontResource('字体文件名称');
SendMessage( HWND_BROADCAST, WM_FONTCHANGE, 0, 0 );
 
楼上的,帮就帮到底的了,如何检测这种字体是否已经安装过了呢,
 
$%#*$%@?
I'm sorry,ido
n't know。
 
windows的字体文件都在font目录下,读这个目录不就
可以检测了?拷贝到这个目录也可以注册字体。
用API得到系统font目录的方法(不过不好意思,这是用vb写的):
'取系统字体目录
'并写入注册表
Const CSIDL_DESKTOP = &H0
Const CSIDL_PROGRAMS = &H2
Const CSIDL_CONTROLS = &H3
Const CSIDL_PRINTERS = &H4
Const CSIDL_PERSONAL = &H5
Const CSIDL_FAVORITES = &H6
Const CSIDL_STARTUP = &H7
Const CSIDL_RECENT = &H8
Const CSIDL_SENDTO = &H9
Const CSIDL_BITBUCKET = &HA
Const CSIDL_STARTMENU = &HB
Const CSIDL_DESKTOPDIRECTORY = &H10
Const CSIDL_DRIVES = &H11
Const CSIDL_NETWORK = &H12
Const CSIDL_NETHOOD = &H13
Const CSIDL_FONTS = &H14
Const CSIDL_TEMPLATES = &H15
Const MAX_PATH = 260
Private Type ****EMID
cb As Long
abID As Byte
End Type
Private Type ITEMIDLIST
mkid As ****EMID
End Type
Private Declare Function ShellAbout Lib "shell32.dll" Alias "ShellAboutA" (ByVal hwnd As Long, ByVal szApp As String, ByVal szOtherStuff As String, ByVal hIcon As Long) As Long
Private Declare Function SHGetSpecialFolderLocation Lib "shell32.dll" (ByVal hwndOwner As Long, ByVal nFolder As Long, pidl As ITEMIDLIST) As Long
Private Declare Function SHGetPathFromIDList Lib "shell32.dll" Alias "SHGetPathFromIDListA" (ByVal pidl As Long, ByVal pszPath As String) As Long
Private Sub Main()
Dim str1 As String
str1 = GetSpecialfolder(CSIDL_FONTS)
Dim temp_long As Long
Dim temp_long2 As Long
Dim security1 As SECURITY_ATTRIBUTES
Dim hKey As Long
temp_long = RegCreateKeyEx(HKEY_LOCAL_MACHINE, "SOFTWARE/CSC/Jwcampus/Temp_Setup", 0, 0, 0, KEY_ALL_ACCESS, security1, hKey, temp_long2)
If temp_long <> 0 then
'MsgBox "安装程序无法访问注册表,安装失败(内部代号:0)。"
End
End If
temp_long = RegSetValueExString(hKey, "FontDir", 0, REG_SZ, str1, Len(str1))
If temp_long <> 0 then
'MsgBox "安装程序无法正确访问注册表,安装失败(内部代号:1)。"
End
End If
RegCloseKey hKey
End Sub
Private Function GetSpecialfolder(CSIDL As Long) As String
Dim r As Long
Dim IDL As ITEMIDLIST
Dim Path As String
'Get the special folder
r = SHGetSpecialFolderLocation(100, CSIDL, IDL)
If r = 0 then
'Create a buffer
Path$ = Space$(512)
'Get the path from the IDList
r = SHGetPathFromIDList(ByVal IDL.mkid.cb, ByVal Path$)
'Remove the unnecessary chr$(0)'s
GetSpecialfolder = Left$(Path, InStr(Path, Chr$(0)) - 1)
Exit Function
End If
GetSpecialfolder = ""
End Function
 
楼上的兄弟,我想你的方法可能不行,因为字体文件是否存在与是否安装完全是两回事。
何况字体也不一定要在系统字体目录啊。
不过通常情况下无需判断字体是否已经安装,用之前按前面的方法装一次就得了。
 
哈哈,我是菜鸟一个的,第一次做字体的发布,昨天又试了一遍,
就如同gxcooo所说,只要把字体文件拷贝到fonts目录下就行的,
看来微软也行的吗,:)
可我在试的时候机子环境已不是纯净的,(安装过一个维语软件,我又删除了)
有兴趣的仁兄试一下的,
看我说的对不对
 
多人接受答案了。
 
后退
顶部