📄 tomfmt.cpp
字号:
dwMask = _CF.dwMask; // Use this mask in case this
} // font is active
else
{ // Need to call pFont for all font
prg = _prg; // properties
_prg = NULL; // Be sure it's a clone during
// transfer
pFont->GetStyle(&Value);
SetStyle(Value);
pFont->GetAllCaps(&Value);
SetAllCaps(Value);
pFont->GetAnimation(&Value);
SetAnimation(Value);
pFont->GetBackColor(&Value);
SetBackColor(Value);
pFont->GetBold(&Value);
SetBold(Value);
pFont->GetEmboss(&Value);
SetEmboss(Value);
pFont->GetForeColor(&Value);
SetForeColor(Value);
pFont->GetHidden(&Value);
SetHidden(Value);
pFont->GetEngrave(&Value);
SetEngrave(Value);
pFont->GetItalic(&Value);
SetItalic(Value);
pFont->GetKerning(&x);
SetKerning(x);
pFont->GetLanguageID(&Value);
SetLanguageID(Value);
pFont->GetName(&bstr);
SetName(bstr);
pSysFreeString(bstr);
pFont->GetOutline(&Value);
SetOutline(Value);
pFont->GetPosition(&x);
SetPosition(x);
pFont->GetProtected(&Value);
SetProtected(Value);
pFont->GetShadow(&Value);
SetShadow(Value);
pFont->GetSize(&x);
SetSize(x);
pFont->GetSmallCaps(&Value);
SetSmallCaps(Value);
pFont->GetSpacing(&x);
SetSpacing(x);
pFont->GetStrikeThrough(&Value);
SetStrikeThrough(Value);
pFont->GetSubscript(&Value);
SetSubscript(Value);
pFont->GetSuperscript(&Value);
SetSuperscript(Value);
pFont->GetUnderline(&Value);
SetUnderline(Value);
_prg = prg; // Restore original value
}
return FormatSetter(dwMask); // Apply it unless !_prg
}
/*
* ITextFont::SetEmboss(long Value)
*
* @mfunc
* Property put method that sets the embossed state according
* to the value given by Value
*
* @rdesc
* HRESULT = (if success) ? NOERROR :
* (protected) ? E_ACCESSDENIED : E_OUTOFMEMORY
*/
STDMETHODIMP CTxtFont::SetEmboss (
long Value) //@parm New value. Default value: tomToggle
{
TRACEBEGIN(TRCSUBSYSTOM, TRCSCOPEEXTERN, "CTxtFont::SetEmboss");
return EffectSetter(Value, CFM_EMBOSS, CFE_EMBOSS);
}
/*
* ITextFont::SetForeColor(long Value)
*
* @mfunc
* Property put method that sets the foreground color according
* to the value given by Value.
*
* @rdesc
* HRESULT = (if success) ? NOERROR :
* (protected) ? E_ACCESSDENIED : E_OUTOFMEMORY
*/
STDMETHODIMP CTxtFont::SetForeColor (
long Value ) //@parm New COLORREF value to use
{
TRACEBEGIN(TRCSUBSYSTOM, TRCSCOPEEXTERN, "CTxtFont::SetForeColor");
if(Value == tomUndefined) // NINCH
return NOERROR;
_CF.dwEffects |= CFE_AUTOCOLOR; // Default AutoColor
if(Value != tomAutoColor)
{
if(Value < 0)
return E_INVALIDARG;
_CF.dwEffects &= ~CFE_AUTOCOLOR; // Turn off AutoColor
_CF.crTextColor = (COLORREF)Value; // Use new TextColor
}
return FormatSetter(CFM_COLOR);
}
/*
* ITextFont::SetHidden(long Value)
*
* @mfunc
* Property put method that sets the hidden state according to
* the value given by Value.
*
* @rdesc
* HRESULT = (if success) ? NOERROR :
* (protected) ? E_ACCESSDENIED : E_OUTOFMEMORY
*/
STDMETHODIMP CTxtFont::SetHidden (
long Value) //@parm New value. Default value: tomToggle
{
TRACEBEGIN(TRCSUBSYSTOM, TRCSCOPEEXTERN, "CTxtFont::SetHidden");
return EffectSetter(Value, CFM_HIDDEN, CFE_HIDDEN);
}
/*
* ITextFont::SetEngrave(long Value)
*
* @mfunc
* Property put method that sets the imprint state according to
* the value given by Value.
*
* @rdesc
* HRESULT = (if success) ? NOERROR :
* (protected) ? E_ACCESSDENIED : E_OUTOFMEMORY
*/
STDMETHODIMP CTxtFont::SetEngrave (
long Value) //@parm New value. Default value: tomToggle
{
TRACEBEGIN(TRCSUBSYSTOM, TRCSCOPEEXTERN, "CTxtFont::SetEngrave");
return EffectSetter(Value, CFM_IMPRINT, CFE_IMPRINT);
}
/*
* ITextFont::SetItalic(long Value)
*
* @mfunc
* Property put method that sets the italic state according to
* the value given by Value.
*
* @rdesc
* HRESULT = (if success) ? NOERROR :
* (protected) ? E_ACCESSDENIED : E_OUTOFMEMORY
*/
STDMETHODIMP CTxtFont::SetItalic (
long Value) //@parm New value. Default value: tomToggle
{
TRACEBEGIN(TRCSUBSYSTOM, TRCSCOPEEXTERN, "CTxtFont::SetItalic");
return EffectSetter(Value, CFM_ITALIC, CFE_ITALIC);
}
/*
* ITextFont::SetKerning(float Value)
*
* @mfunc
* Property set method that sets the minimum kerning size,
* which is given in floating-point points.
*
* @rdesc
* HRESULT = (Value < 0) ? E_INVALIDARG :
* (if success) ? NOERROR :
* (protected) ? E_ACCESSDENIED : E_OUTOFMEMORY
*/
STDMETHODIMP CTxtFont::SetKerning (
float Value) //@parm New value of minimum kerning size
{
TRACEBEGIN(TRCSUBSYSTOM, TRCSCOPEEXTERN, "CTxtFont::SetKerning");
return SetParameter((long *)&_CF.wKerning, CFM_KERNING, -2, *(long *)&Value);
}
/*
* ITextFont::SetLanguageID(long Value)
*
* @mfunc
* Property put method that sets the language ID (more
* generally LCID) according to the value given by Value. See
* GetLanguageID() for more information.
*
* @rdesc
* HRESULT = (if success) ? NOERROR :
* (protected) ? E_ACCESSDENIED : E_OUTOFMEMORY
*/
STDMETHODIMP CTxtFont::SetLanguageID (
long Value) //@parm New LCID to use
{
TRACEBEGIN(TRCSUBSYSTOM, TRCSCOPEEXTERN, "CTxtFont::SetLanguageID");
return SetParameter((long *)&_CF.lcid, CFM_LCID, 4, Value);
}
/*
* ITextFont::SetName(BSTR Name)
*
* @mfunc
* Property put method that sets the font name to Name.
*
* @rdesc
* HRESULT = (Name too long) ? E_INVALIDARG :
* (if success) ? NOERROR :
* (protected) ? E_ACCESSDENIED : E_OUTOFMEMORY
*/
STDMETHODIMP CTxtFont::SetName(
BSTR Name) //@parm New font name
{
TRACEBEGIN(TRCSUBSYSTOM, TRCSCOPEEXTERN, "CTxtFont::SetName");
LONG cch = pSysStringLen(Name);
if(cch > LF_FACESIZE)
return E_INVALIDARG;
if(!cch) // NINCH
return NOERROR;
wcscpy(_CF.szFaceName, Name);
_CF.bCharSet = DEFAULT_CHARSET;
return FormatSetter(CFM_FACE + CFM_CHARSET);
}
/*
* ITextFont::SetOutline(long Value)
*
* @mfunc
* Property put method that sets the outline state according to
* the value given by Value.
*
* @rdesc
* HRESULT = (if success) ? NOERROR :
* (protected) ? E_ACCESSDENIED : E_OUTOFMEMORY
*/
STDMETHODIMP CTxtFont::SetOutline (
long Value) //@parm New value. Default value: tomToggle
{
TRACEBEGIN(TRCSUBSYSTOM, TRCSCOPEEXTERN, "CTxtFont::SetOutline");
return EffectSetter(Value, CFM_OUTLINE, CFE_OUTLINE);
}
/*
* ITextFont::SetPosition(float Value)
*
* @mfunc
* Property set method that sets the character position
* relative to the baseline. The value is given in floating-point
* points.
*
* @rdesc
* HRESULT = (if success) ? NOERROR :
* (protected) ? E_ACCESSDENIED : E_OUTOFMEMORY
*/
STDMETHODIMP CTxtFont::SetPosition (
float Value) //@parm New value of relative vertical position
{
TRACEBEGIN(TRCSUBSYSTOM, TRCSCOPEEXTERN, "CTxtFont::SetPosition");
return SetParameter(&_CF.yOffset, CFM_OFFSET, -4, *(long *)&Value);
}
/*
* ITextFont::SetProtected(long Value)
*
* @mfunc
* Property put method that sets the protected state according
* to the value given by Value.
*
* @rdesc
* HRESULT = (if success) ? NOERROR : S_FALSE
*/
STDMETHODIMP CTxtFont::SetProtected (
long Value) //@parm New value. Default value: tomToggle
{
TRACEBEGIN(TRCSUBSYSTOM, TRCSCOPEEXTERN, "CTxtFont::SetProtected");
return EffectSetter(Value, CFM_PROTECTED, CFE_PROTECTED);
}
/*
* ITextFont::SetShadow(long Value)
*
* @mfunc
* Property put method that sets the shadow state according to
* the value given by Value.
*
* @rdesc
* HRESULT = (if success) ? NOERROR :
* (protected) ? E_ACCESSDENIED : E_OUTOFMEMORY
*/
STDMETHODIMP CTxtFont::SetShadow (
long Value) //@parm New value. Default value: tomToggle
{
TRACEBEGIN(TRCSUBSYSTOM, TRCSCOPEEXTERN, "CTxtFont::SetShadow");
return EffectSetter(Value, CFM_SHADOW, CFE_SHADOW);
}
/*
* ITextFont::SetSize(float Value)
*
* @mfunc
* Property put method that sets the font size = Value (in
* floating-point points).
*
* @rdesc
* HRESULT = (if success) ? NOERROR :
* (protected) ? E_ACCESSDENIED : E_OUTOFMEMORY
*/
STDMETHODIMP CTxtFont::SetSize (
float Value) //@parm New font size to use
{
TRACEBEGIN(TRCSUBSYSTOM, TRCSCOPEEXTERN, "CTxtFont::SetSize");
return SetParameter(&_CF.yHeight, CFM_SIZE, -4, *(long *)&Value);
}
/*
* ITextFont::SetSmallCaps(long Value)
*
* @mfunc
* Property put method that sets the SmallCaps state according
* to the value given by Value.
*
* @rdesc
* HRESULT = (if success) ? NOERROR :
* (protected) ? E_ACCESSDENIED : E_OUTOFMEMORY
*/
STDMETHODIMP CTxtFont::SetSmallCaps (
long Value) //@parm New value. Default value: tomToggle
{
TRACEBEGIN(TRCSUBSYSTOM, TRCSCOPEEXTERN, "CTxtFont::SetSmallCaps");
return EffectSetter(Value, CFM_ALLCAPS | CFM_SMALLCAPS, CFE_SMALLCAPS);
}
/*
* ITextFont::SetSpacing(float Value)
*
* @mfunc
* Property set method that sets the intercharacter spacing,
* which is given in floating-point points.
*
* @rdesc
* HRESULT = (if success) ? NOERROR :
* (protected) ? E_ACCESSDENIED : E_OUTOFMEMORY
*/
STDMETHODIMP CTxtFont::SetSpacing (
float Value) //@parm New value of intercharacter spacing
{
TRACEBEGIN(TRCSUBSYSTOM, TRCSCOPEEXTERN, "CTxtFont::SetSpacing");
return SetParameter((long *)&_CF.sSpacing, CFM_SPACING, -2, *(long *)&Value);
}
/*
* ITextFont::SetStrikeThrough(long Value)
*
* @mfunc
* Property put method that sets the StrikeThrough state
* according to the value given by Value.
*
* @rdesc
* HRESULT = (if success) ? NOERROR :
* (protected) ? E_ACCESSDENIED : E_OUTOFMEMORY
*/
STDMETHODIMP CTxtFont::SetStrikeThrough (
long Value) //@parm New value. Default value: tomToggle
{
TRACEBEGIN(TRCSUBSYSTOM, TRCSCOPEEXTERN, "CTxtFont::SetStrikeThrough");
return EffectSetter(Value, CFM_STRIKEOUT, CFE_STRIKEOUT);
}
/*
* ITextFont::SetStyle(long Value)
*
* @mfunc
* Property put method that sets the character style handle for
* the characters in a range. See GetStyle() for further discussion.
*
* @rdesc
* HRESULT = (if success) ? NOERROR :
* (protected) ? E_ACCESSDENIED : E_OUTOFMEMORY
*/
STDMETHODIMP CTxtFont::SetStyle (
long Value) //@parm New character style handle
{
TRACEBEGIN(TRCSUBSYSTOM, TRCSCOPEEXTERN, "CTxtFont::SetStyle");
if(Value == tomUndefined)
return NOERROR;
if(Value < -32768 || Value > 32767)
return E_INVALIDARG;
return SetParameter((long *)&_CF.sStyle, CFM_STYLE, 2, Value);
}
/*
* ITextFont::SetSubscript(long Value)
*
* @mfunc
* Property put method that sets the subscript state according
* to the value given by Value.
*
* @rdesc
* HRESULT = (if success) ? NOERROR :
* (protected) ? E_ACCESSDENIED : E_OUTOFMEMORY
*/
STDMETHODIMP CTxtFont::SetSubscript (
long Value) //@parm New value. Default value: tomToggle
{
TRACEBEGIN(TRCSUBSYSTOM, TRCSCOPEEXTERN, "CTxtFont::SetSubscript");
return EffectSetter(Value, CFM_SUBSCRIPT | CFM_SUPERSCRIPT, CFE_SUBSCRIPT);
}
/*
* ITextFont::SetSuperscript(long Value)
*
* @mfunc
* Property put method that sets the superscript state
* according to the value given by Value
*
* @rdesc
* HRESULT = (if success) ? NOERROR :
* (protected) ? E_ACCESSDENIED : E_OUTOFMEMORY
*/
STDMETHODIMP CTxtFont::SetSuperscript (
long Value) //@parm New value. Default value: tomToggle
{
TRACEBEGIN(TRCSUBSYSTOM, TRCSCOPEEXTERN, "CTxtFont::SetSuperscript");
return EffectSetter(Value, CFM_SUBSCRIPT | CFM_SUPERSCRIPT, CFE_SUPERSCRIPT);
}
/*
* ITextFont::SetUnderline(long Value)
*
* @mfunc
* Property put method that sets the underline style according
* to the value given by Value.
*
* @rdesc
* HRESULT = (if success) ? NOERROR :
* (protected) ? E_ACCESSDENIED : E_OUTOFMEMORY
*/
STDMETHODIMP CTxtFont::SetUnderline (
long Value) //@parm New value of underline type
{
TRACEBEGIN(TRCSUBSYSTOM, TRCSCOPEEXTERN, "CTxtFont::SetUnderline");
_CF.bUnderlineType = 0; // Default no underline type
if(Value < 0) // tomTrue, tomUndefined, or
return EffectSetter(Value, CFM_UNDERLINETYPE | CFM_UNDERLINE, CFE_UNDERLINE);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -