Newsgroup: it.comp.programmare.win32
Titolo: InstallShield e Font

Ciao,
    ho realizzato un'applicazione tramite VC++ che fa uso di font
non standard. Per permettere agli utenti una corretta visualizzazione
devo quindi distribuirli e installarli insieme al software. Ho
realizzato
il programma di install tramite InstallShield. L'install copia i font
all'interno della cartella FONTS di Windows ma, nonostante
essi siano presenti, il programma "non riesce" ad usarli. Mi spiego
quando lancio la mia applicazione viene utilizzato un font "standard"
al posto di quello da me desiderato. Se entro nella cartella font
e faccio doppio click sul font e quindi rilancio il programma
vengono utilizzati i miei font ! Come devo fare, con installshield,
per installarli correttamente ?
Grazie in anticipo
--
 Stefano Malavasi
---------------------------------------------------------------------
s_malavasi_REMOVETHIS_@_REMOVETHIS_lycos.it
Remove the string _REMOVETHIS_ to reply by e-mail


Semplicemente copiare il file nella cartella dei font non basta.
Devi anche aggiornare la tabella di sistema dei font con AddFontResource
(o AddFontResourceEx).
Poi dovresti messaggiare tutte le finestre top-level con WM_FONTCHANGE,
per avvertire che la tabella dei font è stata alterata.
Ti riport da MSDN
Font Installation and Deletion
An application can use a font to draw text only if that font is either
resident on a specified device or installed in the system font table. The
font table is an internal array that identifies all nondevice fonts that are
available to an application. An application can retrieve the names of fonts
currently installed on a device or stored in the internal font table by
calling the EnumFontFamilies or ChooseFont functions.
To temporarily install a font, call AddFontResource or AddFontResourceEx.
These functions load a font that is stored in a font-resource file. However,
this is a temporary installation because after a reboot the font will not be
present.
To install a font that will remain after the system is rebooted, use one of
the following methods:
- Go to the Control Panel, click the Fonts icon, and select Install New
Fonts from the File menu. The font is available to an application even
before the reboot. However, in a terminal server situation the font is
available for the current session but is not available for other sessions
until after a reboot.
- Copy the font into the %windir%\fonts folder. Then, either go to the
Control Panel and click the Fonts icon, or call AddFontResource or
AddFontResourceEx. The font is available to an application even before the
reboot. However, in a terminal server situation the font is available for
the current session but is not available for other sessions until after a
reboot. If you only copy the font into the %windir%\fonts folder, the font
will be available only after the system is rebooted.
In the case of TrueType and OpenType fonts, an additional step is sometimes
necessary before the font can be installed in the font table. Some font
manufacturers ship only the TrueType or OpenType font-data files (identified
by the .ttf extension). Before The system can load these fonts, it requires
a corresponding header file (identified by the .fot extension). To create
this header file, an application must call the CreateScalableFontResource
function and pass the name of the font-data file as the third parameter.
When this header file is created, an application can install the font by
calling the AddFontResource or AddFontResourceEx function and passing the
name of the new header file. For an application that installs TrueType
fonts, see the Font Installation SDK at 
http://fontweb/tools/install/
.
When an application finishes using an installed font, it must remove that
font by calling the RemoveFontResource function.
Whenever an application calls the functions that add and delete font
resources, it should also call the SendMessage function and send a
WM_FONTCHANGE message to all top-level windows in the system. This message
notifies other applications that the internal font table has been altered by
an application that added or removed a font.
Ciao
Porlock