Click here to Skip to main content
15,896,727 members
Articles / Desktop Programming / MFC

A Simple HTML Drawing Class

Rate me:
Please Sign up or sign in to vote.
4.72/5 (27 votes)
5 Aug 20034 min read 166.8K   5.4K   67  
Drawing HTML text onto a device context
// HTMLFont.h: interface for the CHTMLFont class.
//
//////////////////////////////////////////////////////////////////////
// (c) Jerome Sopocko 2003
// this code worked last time I saw it
//////////////////////////////////////////////////////////////////////

#if !defined(AFX_HTMLFONT_H__84F80EAE_21F9_4BD3_853E_7AA130226700__INCLUDED_)
#define AFX_HTMLFONT_H__84F80EAE_21F9_4BD3_853E_7AA130226700__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

class CHTMLFont : public CObject
{
public:
	CHTMLFont();
	CHTMLFont(const CHTMLFont & Police);
	virtual ~CHTMLFont();

	CHTMLFont & operator = (const CHTMLFont & Police);

protected:
	CString		m_strName;
	double		m_dSize;
	bool 		m_isBold;
	bool 		m_isItalic;
	bool 		m_isUnderline;
	short		m_nCharSet;
	COLORREF	m_rgbColor;
	int			m_nHTMLSize;
protected:
	void CopyProperties(const CHTMLFont & fnt);

public:
	CFont* GetFont(CDC * pDC) const;
	static double GetHTMLSizeCoeffient(int nHTMLSize);
	static void DeleteArray(CObArray & arrTableau);

	const CString& GetName() const 
	{
		return m_strName;
	}
	void SetName(LPCTSTR strName)
	{
		m_strName = strName;
	}
	//
	double GetSize() const 
	{
		return m_dSize;
	}
	void SetSize(double dSize)
	{
		m_dSize = dSize;
	}
	//
	bool IsBold() const 
	{
		return m_isBold;
	}
	void SetBold(bool isBold)
	{
		m_isBold = isBold;
	}
	//
	bool IsItalic() const 
	{
		return m_isItalic;
	}
	void SetItalic(bool isItalic)
	{
		m_isItalic = isItalic;
	}
	//
	bool IsUnderline() const 
	{
		return m_isUnderline;
	}
	void SetUnderline(bool isUnderline)
	{
		m_isUnderline = isUnderline;
	}
	//
	short GetCharSet() const 
	{
		return m_nCharSet;
	}
	void SetCharSet(short nCharSet)
	{
		m_nCharSet = nCharSet;
	}
	//
	COLORREF GetColor() const 
	{
		return m_rgbColor;
	}
	void SetColor(COLORREF nColor)
	{
		m_rgbColor = nColor;
	}
	//
	int GetHTMLSize() const 
	{
		return m_nHTMLSize;
	}
	void SetHTMLSize(int nHTMLSize)
	{
		m_nHTMLSize = nHTMLSize;
	}
	//
	//

};

#endif // !defined(AFX_HTMLFONT_H__84F80EAE_21F9_4BD3_853E_7AA130226700__INCLUDED_)

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.


Written By
Web Developer
United Kingdom United Kingdom
Known as "The Wandering Geek", I have had to often change identities and countries due to the low quality level of the numerous software I have left behind.
Never wrote a software that did more than sorting 3 numbers which actually worked.
Hey but feel free to download my stuff!


Comments and Discussions