方法一、用ps里的钢笔把字抠出来
方法二、下载常用的字体 再对照 常用的就是 方正 汉宜 文鼎 之类的 也不用都下 下一套就行 因为也都差不多
方法三、如果你非常有经验的话 自然能看出那是什么字体
方法四、直接用盖印图章 把字盖掉 然后 用你有的字体 打上去就行了
通过GetStockObject函数可以取得系统字体。
The GetStockObject function retrieves a handle to one of the stock pens, brushes, fonts, or palettes
HGDIOBJ GetStockObject(
int fnObject // stock object type
);
其中fnObject可以是以下字体:
ANSI_FIXED_FONT Windows fixed-pitch (monospace) system font
ANSI_VAR_FONT Windows variable-pitch (proportional space) system font
DEVICE_DEFAULT_FONT Windows NT/2000/XP: Device-dependent font
DEFAULT_GUI_FONT Default font for user interface objects such as menus and dialog boxes This is MS Sans Serif Compare this with SYSTEM_FONT
OEM_FIXED_FONT Original equipment manufacturer (OEM) dependent fixed-pitch (monospace) font
SYSTEM_FONT System font By default, the system uses the system font to draw menus, dialog box controls, and text
Windows 95/98 and Windows NT: The system font is MS Sans Serif
Windows 2000/XP: The system font is Tahoma
SYSTEM_FIXED_FONT Fixed-pitch (monospace) system font This stock object is provided only for compatibility with 16-bit Windows versions earlier than 30
首先了解一下CHARFORMAT结构
SetDefaultCharFormat(
CHARFORMAT&
cf
);
typedef
struct
_charformat
{
UINT
cbSize;
_WPAD
_wPad1;
DWORD
dwMask;
DWORD
dwEffects;
LONG
yHeight;
LONG
yOffset;
COLORREF
crTextColor;
BYTE
bCharSet;
BYTE
bPitchAndFamily;
TCHAR
szFaceName[LF_FACESIZE];
_WPAD
_wPad2;
}
CHARFORMAT;
其中bCharSet有如下值
lfCharSet
Specifies
the
character
set
The
following
values
are
predefined:
ANSI_CHARSET
BALTIC_CHARSET
CHINESEBIG5_CHARSET
DEFAULT_CHARSET
EASTEUROPE_CHARSET
GB2312_CHARSET
GREEK_CHARSET
HANGUL_CHARSET
MAC_CHARSET
OEM_CHARSET
RUSSIAN_CHARSET
SHIFTJIS_CHARSET
SYMBOL_CHARSET
TURKISH_CHARSET
Korean
Windows:
JOHAB_CHARSET
Middle-Eastern
Windows:
HEBREW_CHARSET
ARABIC_CHARSET
Thai
Windows:
THAI_CHARSET
OnChangeFont()
是对话框中一按钮消息响应函数
void
CTransformDlg::OnChangeFont()
{
//
TODO:
Add
your
control
notification
handler
code
here
CHARFORMAT
cf;
LOGFONT
lf;
memset(&cf,
0,
sizeof(CHARFORMAT));
memset(&lf,
0,
sizeof(LOGFONT));
//判断是否选择了内容
BOOL
m_bSelect
=
(m_RichEditCtrlTSGetSelectionType()
!=
SEL_EMPTY)
TRUE
:
FALSE;
if
(m_bSelect)
{
m_RichEditCtrlTSGetSelectionCharFormat(cf);
}
else
{
m_RichEditCtrlTSGetDefaultCharFormat(cf);
}
//得到相关字体属性
BOOL
bIsBold
=
cfdwEffects
&
CFE_BOLD;
BOOL
bIsItalic
=
cfdwEffects
&
CFE_ITALIC;
BOOL
bIsUnderline
=
cfdwEffects
&
CFE_UNDERLINE;
BOOL
bIsStrickout
=
cfdwEffects
&
CFE_STRIKEOUT;
//设置属性
lflfCharSet
=
cfbCharSet;
lflfHeight
=
cfyHeight/15;
lflfPitchAndFamily
=
cfbPitchAndFamily;
lflfItalic
=
bIsItalic;
lflfWeight
=
(bIsBold
FW_BOLD
:
FW_NORMAL);
lflfUnderline
=
bIsUnderline;
lflfStrikeOut
=
bIsStrickout;
sprintf(lflfFaceName,
cfszFaceName);
//strcpy(lflfFaceName,
cfszFaceName);
CFontDialog
dlg(&lf);
dlgm_cfrgbColors
=
cfcrTextColor;
if
(dlgDoModal()
==
IDOK)
{
dlgGetCharFormat(cf);
//获得所选的字体属性,如字体、颜色、大小等
if
(m_bSelect)
m_RichEditCtrlTSSetSelectionCharFormat(cf);
//为选定的内容设定所选字体
else
m_RichEditCtrlTSSetWordCharFormat(cf);
//为将要输入的内容设定字体//m_RichEditCtrlTSSetDefaultCharFormat(cf);
//设置输入框内所有字符的字体,包括已经输入的和将要输入的字符
}
}CFont
说明
CFont
font;
VERIFY(fontCreateFont(
12,
//
nHeight
0,
//
nWidth
0,
//
nEscapement
0,
//
nOrientation
FW_NORMAL,
//
nWeight
FALSE,
//
bItalic
FALSE,
//
bUnderline
0,
//
cStrikeOut
ANSI_CHARSET,
//
nCharSet
OUT_DEFAULT_PRECIS,
//
nOutPrecision
CLIP_DEFAULT_PRECIS,
//
nClipPrecision
DEFAULT_QUALITY,
//
nQuality
DEFAULT_PITCH
|
FF_SWISS,
//
nPitchAndFamily
"Arial"));
//
lpszFacename
以上就是关于如何获取照片上面的字体全部的内容,包括:如何获取照片上面的字体、VC怎么能获取系统字体、VC 如何获取一个控件内的字体等相关内容解答,如果想了解更多相关内容,可以关注我们,你们的支持是我们更新的动力!
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)