Commit b6dfe6ee authored by Ilya Kirillov's avatar Ilya Kirillov

Fixed bug with reading EMR_EXTCREATEFONTINDIRECTW in EMF.

parent d04f0441
......@@ -352,9 +352,9 @@ namespace MetaFile
{
*this >> oVector.Signature;
*this >> oVector.NumAxes;
oVector.Values = NULL;
if (oVector.NumAxes <= 0)
oVector.Values = NULL;
if (oVector.Signature != 0x08007664 || oVector.NumAxes > 16 || oVector.NumAxes <= 0)
return *this;
oVector.Values = new int[oVector.NumAxes];
......@@ -368,8 +368,19 @@ namespace MetaFile
}
CDataStream& operator>>(CEmfLogFont& oFont)
{
*this >> oFont.LogFontEx;
*this >> oFont.DesignVector;
if (oFont.IsFixedLength())
{
*this >> oFont.LogFontEx.LogFont;
ReadBytes(oFont.LogFontEx.FullName, 64);
ReadBytes(oFont.LogFontEx.Style, 32);
ReadBytes(oFont.LogFontEx.Script, 18);
}
else
{
*this >> oFont.LogFontEx;
*this >> oFont.DesignVector;
}
return *this;
}
CDataStream& operator>>(TEmfBitBlt& oBitBtl)
......
......@@ -1030,13 +1030,17 @@ namespace MetaFile
}
void Read_EMR_EXTCREATEFONTINDIRECTW()
{
unsigned int ulIndex;
CEmfLogFont* pFont = new CEmfLogFont();
unsigned int unSize = m_ulRecordSize - 4;
bool bFixedLength = unSize <= 0x0140 ? true : false;
unsigned int ulIndex;
CEmfLogFont* pFont = new CEmfLogFont(bFixedLength);
if (!pFont)
return SetError();
m_oStream >> ulIndex;
m_oStream >> *pFont;
m_oPlayer.RegisterObject(ulIndex, (CEmfObjectBase*)pFont);
}
void Read_EMR_SETTEXTALIGN()
......
......@@ -117,9 +117,10 @@ namespace MetaFile
class CEmfLogFont : public CEmfObjectBase, public IFont
{
public:
CEmfLogFont()
CEmfLogFont(bool bFixedLength = false)
{
DesignVector.Values = NULL;
m_bFixedLength = bFixedLength;
}
virtual ~CEmfLogFont()
{
......@@ -164,11 +165,19 @@ namespace MetaFile
{
return LogFontEx.LogFont.CharSet;
}
bool IsFixedLength()
{
return m_bFixedLength;
}
public:
TEmfLogFontEx LogFontEx;
TEmfDesignVector DesignVector;
private:
bool m_bFixedLength;
};
class CEmfLogPen : public CEmfObjectBase, public IPen
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment