mirror of
https://github.com/ONLYOFFICE/core.git
synced 2026-02-10 18:05:41 +08:00
Fix bug #74726
This commit is contained in:
@ -163,9 +163,9 @@ namespace SVG
|
||||
else if (eNodeType == XmlUtils::XmlNodeType_Element && "tspan" == oReader.GetName())
|
||||
{
|
||||
const TBounds oBounds{GetBounds()};
|
||||
const Point oPoint{oBounds.m_dRight, oBounds.m_dTop};
|
||||
const Point oPoint{oBounds.m_dRight, oBounds.m_dBottom};
|
||||
|
||||
AddObject(CRenderedObject::Create<CTSpan>(oReader, pSvgFile, this, m_pFontManager, oPoint));
|
||||
AddObject(CObject::Create<CTSpan>(oReader, pSvgFile, this, m_pFontManager, oPoint));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -187,8 +187,14 @@ namespace SVG
|
||||
{
|
||||
if (!m_wsText.empty())
|
||||
{
|
||||
ApplyFont(pRenderer, dX, dY);
|
||||
Aggplus::CMatrix oCurrentMatrix;
|
||||
ApplyFont(pRenderer, dX, dY, oCurrentMatrix);
|
||||
|
||||
pRenderer->CommandDrawText(m_wsText, dX, dY, 0, 0);
|
||||
|
||||
pRenderer->SetTransform(oCurrentMatrix.sx(), oCurrentMatrix.shy(),
|
||||
oCurrentMatrix.shx(), oCurrentMatrix.sy(),
|
||||
oCurrentMatrix.tx(), oCurrentMatrix.ty());
|
||||
}
|
||||
}
|
||||
|
||||
@ -230,12 +236,12 @@ namespace SVG
|
||||
nTypePath += c_nWindingFillMode;
|
||||
}
|
||||
|
||||
void CTSpan::ApplyFont(IRenderer* pRenderer, double& dX, double& dY) const
|
||||
void CTSpan::ApplyFont(IRenderer* pRenderer, double& dX, double& dY, Aggplus::CMatrix& oOldMatrix) const
|
||||
{
|
||||
std::wstring wsFontFamily = DefaultFontFamily;
|
||||
double dFontSize = ((!m_oFont.GetSize().Empty()) ? m_oFont.GetSize().ToDouble(NSCSS::Pixel) : DEFAULT_FONT_SIZE) * 72. / 25.4;
|
||||
|
||||
Normalize(pRenderer, dX, dY, dFontSize);
|
||||
Normalize(pRenderer, dX, dY, dFontSize, oOldMatrix);
|
||||
|
||||
if (!m_oFont.GetFamily().Empty())
|
||||
{
|
||||
@ -340,7 +346,7 @@ namespace SVG
|
||||
|
||||
if (NULL != pParentTSpan)
|
||||
{
|
||||
m_oFont.UpdateSize((!pParentTSpan->m_oFont.GetSize().Empty()) ? pParentTSpan->m_oFont.GetSize().ToDouble(NSCSS::Pixel) : DEFAULT_FONT_SIZE, DEFAULT_FONT_SIZE);
|
||||
m_oFont.UpdateSize((!pParentTSpan->m_oFont.GetSize().Empty()) ? pParentTSpan->m_oFont.GetSize().ToDouble(NSCSS::Point) : DEFAULT_FONT_SIZE, DEFAULT_FONT_SIZE);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -478,7 +484,7 @@ namespace SVG
|
||||
dY = m_oY.ToDouble(NSCSS::Pixel, oBounds.m_dBottom - oBounds.m_dTop);
|
||||
}
|
||||
|
||||
void CTSpan::Normalize(IRenderer *pRenderer, double &dX, double &dY, double &dFontHeight) const
|
||||
void CTSpan::Normalize(IRenderer *pRenderer, double &dX, double &dY, double &dFontHeight, Aggplus::CMatrix& oOldMatrix) const
|
||||
{
|
||||
if (NULL == pRenderer)
|
||||
return;
|
||||
@ -521,6 +527,8 @@ namespace SVG
|
||||
|
||||
pRenderer->GetTransform(&dM11, &dM12, &dM21, &dM22, &dDx, &dDy);
|
||||
|
||||
oOldMatrix.SetElements(dM11, dM12, dM21, dM22, dDx, dDy);
|
||||
|
||||
Aggplus::CMatrix oMatrix(dM11, dM12, dM21, dM22, dDx, dDy);
|
||||
|
||||
oMatrix.Scale(dXScale, dYScale);
|
||||
|
||||
@ -32,7 +32,7 @@ namespace SVG
|
||||
void InheritStyles(const CTSpan* pTSpan);
|
||||
private:
|
||||
void ApplyStyle(IRenderer* pRenderer, const TSvgStyles* pStyles, const CSvgFile* pFile, int& nTypePath, const CRenderedObject* pContexObject = NULL) const override;
|
||||
void ApplyFont(IRenderer* pRenderer, double& dX, double& dY) const;
|
||||
void ApplyFont(IRenderer* pRenderer, double& dX, double& dY, Aggplus::CMatrix& oOldMatrix) const;
|
||||
|
||||
void UpdateFontSize();
|
||||
bool UseExternalFont(const CSvgFile* pFile, double dX, double dY, IRenderer* pRenderer, CommandeMode oMode = CommandeModeDraw, const TSvgStyles* pOtherStyles = NULL, const CRenderedObject* pContexObject = NULL) const;
|
||||
@ -44,7 +44,7 @@ namespace SVG
|
||||
|
||||
void CalculatePosition(double& dX, double& dY) const;
|
||||
|
||||
void Normalize(IRenderer* pRenderer, double& dX, double& dY, double& dFontHeight) const;
|
||||
void Normalize(IRenderer* pRenderer, double& dX, double& dY, double& dFontHeight, Aggplus::CMatrix& oOldMatrix) const;
|
||||
void SetPosition(const Point& oPosition);
|
||||
|
||||
void SetPositionFromParent(CRenderedObject* pParent);
|
||||
|
||||
Reference in New Issue
Block a user