Evaluating and changing font smoothing or ClearType during exports
To ensure quality output from ArcGIS image exporters, you can choose to disable the font smoothing option until the exports are complete.
- Define the delegate function SystemParametersInfo from the Microsoft User32 application programming interface (API) along with some API constants in the declaration section. See the following code example:
[DllImport("user32.dll", SetLastError = true)] static extern bool
SystemParametersInfo(uint uiAction, uint uiParam, ref int pvParam, uint fWinIni);
/* Constants used for User32 calls. */
const uint SPI_GETFONTSMOOTHING = 74;
const uint SPI_SETFONTSMOOTHING = 75;
const unit SPI_UPDATEINI = 0x1;
[VB.NET]
Private Declare Auto Function SystemParametersInfo Lib "user32" (ByVal uiAction As UInteger, ByVal uiParam As UInteger, ByRef pvParam As UInteger, ByVal fWinIni As UInteger) As Boolean
Public Const SPI_GETFONTSMOOTHING = 74
Public Const SPI_SETFONTSMOOTHING = 75
Public Const SPIF_UPDATEINIFILE = &H1
- Define some functions to get the font smoothing value and to enable or disable it. See the following code example:
private Boolean GetFontSmoothing()
{
bool iResult;
int pv = 0;
/* Call to systemparametersinfo to get the font smoothing value. */
iResult = SystemParametersInfo(SPI_GETFONTSMOOTHING, 0, ref pv, 0);
if (pv > 0)
{
//pv > 0 means font smoothing is on.
return true;
}
else
{
//pv == 0 means font smoothing is off.
return false;
}
}
private void DisableFontSmoothing()
{
bool iResult;
int pv = 0;
/* Call to systemparametersinfo to set the font smoothing value. */
iResult = SystemParametersInfo(SPI_SETFONTSMOOTHING, 0, ref pv,
SPIF_UPDATEINIFILE);
}
private void EnableFontSmoothing()
{
bool iResult;
int pv = 0;
/* Call to systemparametersinfo to set the font smoothing value. */
iResult = SystemParametersInfo(SPI_SETFONTSMOOTHING, 1, ref pv,
SPIF_UPDATEINIFILE);
}
[VB.NET]
Function GetFontSmoothing() As Boolean
Dim iResults As Boolean
Dim PV As Integer
'Get font smoothing value and return true if font smoothing is turned on.
iResults = SystemParametersInfo(SPI_GETFONTSMOOTHING, 0, PV, 0)
If PV > 0 Then
GetFontSmoothing = True
Else
GetFontSmoothing = False
End If
End Function
Sub DisableFontSmoothing()
Dim iResults As Boolean
Dim PV As Integer
'Call systemparametersinfo to turn font smoothing off.
iResults = SystemParametersInfo(SPI_SETFONTSMOOTHING, 0, PV, SPIF_UPDATEINIFILE)
End Sub
Sub EnableFontSmoothing()
Dim iResults As Boolean
Dim PV As Integer
'Call systemparametersinfo to turn font smoothing on.
iResults = SystemParametersInfo(SPI_SETFONTSMOOTHING, 1, PV, SPIF_UPDATEINIFILE)
End Sub
See Also:
Sample: Export active viewDevelopment licensing | Deployment licensing |
---|---|
ArcView | ArcView |
ArcEditor | ArcEditor |
ArcInfo | ArcInfo |
Engine Developer Kit | Engine Runtime |